> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dreamto.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Create image

> Generates images from a prompt. The request is synchronous and returns the images as Base64 when done, usually in 10–90 seconds (longer for high quality and large sizes); set the client timeout to at least 5 minutes. With `stream: true` the response is SSE.



## OpenAPI

````yaml /openapi/en/gpt-image-2-6.json post /v1/images/generations
openapi: 3.1.0
info:
  description: >-
    GPT Image 2.6: OpenAI's newest image model in two specs, Sunburst (detailed
    visual work) and Flare (fast iteration), adding complexity control, animated
    GIF and SVG vector output.
  title: GPT Image 2.6
  version: v1
servers:
  - url: https://api.dreamto.ai
security:
  - bearerAuth: []
tags:
  - name: GPT Image 2.6
paths:
  /v1/images/generations:
    post:
      tags:
        - GPT Image 2.6
      summary: Create image
      description: >-
        Generates images from a prompt. The request is synchronous and returns
        the images as Base64 when done, usually in 10–90 seconds (longer for
        high quality and large sizes); set the client timeout to at least 5
        minutes. With `stream: true` the response is SSE.
      operationId: openaiImageGenerate
      requestBody:
        content:
          application/json:
            examples:
              Text to image:
                description: Only a prompt; everything else uses the defaults.
                summary: Text to image
                value:
                  model: gpt-image-2.6-sunburst
                  prompt: >-
                    An orange cat in an astronaut helmet floating in space with
                    Earth behind it, photorealistic
                  size: 1024x1024
                  quality: medium
              2K landscape poster:
                description: Custom size `2048x1152`, high quality, JPEG compressed to 85%.
                summary: 2K landscape poster
                value:
                  model: gpt-image-2.6-sunburst
                  prompt: >-
                    A minimalist coffee brand poster with the words "MORNING
                    BREW" in the center, warm tones, generous white space
                  size: 2048x1152
                  quality: high
                  output_format: jpeg
                  output_compression: 85
              Transparent background:
                description: >-
                  `background: transparent` requires `png` or `webp` output (a
                  preview feature upstream).
                summary: Transparent background
                value:
                  model: gpt-image-2.6-sunburst
                  prompt: A flat green leaf icon, centered, no shadow
                  size: 1024x1024
                  background: transparent
                  output_format: png
              Several images:
                description: >-
                  `n` generates 1–10 images per request; `safety_identifier`
                  carries a hashed end-user ID.
                summary: Several images
                value:
                  model: gpt-image-2.6-sunburst
                  prompt: >-
                    Product shots of a sneaker in four different styles, white
                    background
                  'n': 2
                  size: 1536x1024
                  quality: low
                  moderation: auto
                  safety_identifier: user_5f2b8c1d
              Streaming:
                description: >-
                  `stream: true` returns SSE; `partial_images` sets how many
                  previews are pushed first (0–3).
                summary: Streaming
                value:
                  model: gpt-image-2.6-sunburst
                  prompt: A watercolor cabin in the mountains, morning mist
                  size: 1024x1536
                  stream: true
                  partial_images: 2
              Extra-high quality (xhigh):
                description: >-
                  `quality: xhigh` renders finer texture and small text at
                  higher latency and more output tokens; `max` is the top tier.
                summary: Extra-high quality (xhigh)
                value:
                  model: gpt-image-2.6-sunburst
                  prompt: >-
                    A dense city metro map poster with legible station names,
                    flat design
                  size: 1536x1024
                  quality: xhigh
              Less planning (complexity):
                description: >-
                  For simple images, `complexity: low` plans less before
                  rendering and is faster; `high` when omitted.
                summary: Less planning (complexity)
                value:
                  model: gpt-image-2.6-sunburst
                  prompt: A red apple on a white background, product photography
                  size: 1024x1024
                  quality: medium
                  complexity: low
              Animated GIF:
                description: >-
                  `output_format: gif` returns an animated GIF (9 frames by
                  default upstream); streaming and `output_compression` are not
                  supported.
                summary: Animated GIF
                value:
                  model: gpt-image-2.6-sunburst
                  prompt: A looping pixel-art animation of a kitten wagging its tail
                  size: 1024x1024
                  output_format: gif
              SVG vector:
                description: >-
                  `output_format: svg` returns an editable SVG; `svg.model` must
                  name the text model that writes it. Generations only, with `n`
                  1.
                summary: SVG vector
                value:
                  model: gpt-image-2.6-sunburst
                  prompt: >-
                    A simple two-color outdoor brand logo combining a mountain
                    and a sun
                  size: 1024x1024
                  output_format: svg
                  svg:
                    model: gpt-6.1-terra
            schema:
              $ref: '#/components/schemas/OpenAIImageGenerationRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              examples:
                example:
                  value:
                    created: 1794643200
                    data:
                      - b64_json: <BASE64_IMAGE_DATA>
                    background: opaque
                    output_format: png
                    quality: medium
                    size: 1024x1024
                    usage:
                      input_tokens: 29
                      input_tokens_details:
                        image_tokens: 0
                        text_tokens: 29
                      output_tokens: 1756
                      output_tokens_details:
                        image_tokens: 1756
                        text_tokens: 0
                      total_tokens: 1785
              schema:
                $ref: '#/components/schemas/OpenAIImageResponse'
          description: >-
            Images generated. With `stream: true` the body is
            `text/event-stream`.
          headers:
            X-Request-Id:
              description: ID of this request; include it when reporting issues.
              schema:
                type: string
        '400':
          content:
            application/json:
              examples:
                example:
                  value:
                    error:
                      code: invalid_request
                      http_status: 400
                      message: Invalid request.
                      request_id: req_7c1e9a4b2d3f5a6b8c9d0e1f
                      type: invalid_request_error
              schema:
                $ref: '#/components/schemas/ImageAPIErrorResponse'
          description: >-
            Invalid request: a required parameter is missing, a value is invalid
            or a parameter is not supported. Not charged.
        '401':
          content:
            application/json:
              examples:
                example:
                  value:
                    error:
                      code: unauthorized
                      http_status: 401
                      message: Unauthorized.
                      request_id: req_7c1e9a4b2d3f5a6b8c9d0e1f
                      type: authentication_error
              schema:
                $ref: '#/components/schemas/ImageAPIErrorResponse'
          description: Missing or invalid API Key.
        '402':
          content:
            application/json:
              examples:
                example:
                  value:
                    error:
                      code: insufficient_balance
                      http_status: 402
                      message: Insufficient balance.
                      request_id: req_7c1e9a4b2d3f5a6b8c9d0e1f
                      type: insufficient_balance_error
              schema:
                $ref: '#/components/schemas/ImageAPIErrorResponse'
          description: Insufficient balance.
        '429':
          content:
            application/json:
              examples:
                example:
                  value:
                    error:
                      code: rate_limit_exceeded
                      http_status: 429
                      message: Rate limit exceeded. Please try again later.
                      request_id: req_7c1e9a4b2d3f5a6b8c9d0e1f
                      type: rate_limit_error
              schema:
                $ref: '#/components/schemas/ImageAPIErrorResponse'
          description: Too many requests; retry later.
        '502':
          content:
            application/json:
              examples:
                example:
                  value:
                    error:
                      code: service_unavailable
                      http_status: 502
                      message: Service temporarily unavailable. Please try again later.
                      request_id: req_7c1e9a4b2d3f5a6b8c9d0e1f
                      type: api_error
              schema:
                $ref: '#/components/schemas/ImageAPIErrorResponse'
          description: >-
            Upstream generation failed (including content moderation refusals).
            Not charged; you may retry.
components:
  schemas:
    OpenAIImageGenerationRequest:
      additionalProperties: false
      description: Request body of image generation.
      properties:
        model:
          description: >-
            Model name.


            **Allowed values:**

            - `gpt-image-2.6-sunburst`: GPT Image 2.6 Sunburst, for detailed
            visual work.

            - `gpt-image-2.6-flare`: GPT Image 2.6 Flare, for fast iteration.
          enum:
            - gpt-image-2.6-sunburst
            - gpt-image-2.6-flare
          type: string
        prompt:
          description: Text description of the image, up to 32,000 characters.
          type: string
        'n':
          description: Number of images, 1–10, default 1.
          format: int64
          type: integer
        size:
          description: >-
            Output size: `auto` (default) or `WIDTHxHEIGHT`. Both edges must be
            multiples of 16, the longest edge at most 3840, the long-to-short
            ratio at most 3:1, and the total pixels 655,360–8,294,400. E.g.
            `1024x1024`, `1536x1024`, `2048x1152`, `3840x2160`.
          type: string
        quality:
          default: auto
          description: >-
            Rendering quality; higher is slower and uses more output tokens.


            **Allowed values:**

            - `auto`: Chosen by the model (default).

            - `low`: Low: fastest and cheapest, good for drafts.

            - `medium`: Medium.

            - `high`: High: best detail and text, slowest.

            - `xhigh`: Extra high: finer texture and small text, with more
            latency and output tokens.

            - `max`: Maximum: the slowest and most output tokens; OpenAI
            recommends it only when lower tiers miss a quality requirement.
          enum:
            - auto
            - low
            - medium
            - high
            - xhigh
            - max
          type: string
        background:
          default: auto
          description: >-
            Background type.


            **Allowed values:**

            - `auto`: Decided by the model (default).

            - `transparent`: Transparent; needs `png` or `webp` output (a
            preview feature upstream).

            - `opaque`: Opaque.
          enum:
            - auto
            - transparent
            - opaque
          type: string
        output_format:
          default: png
          description: >-
            Output image format.


            **Allowed values:**

            - `png`: PNG (default).

            - `jpeg`: JPEG: smaller and faster.

            - `webp`: WebP.

            - `gif`: Animated GIF (9 frames by default upstream); no streaming,
            previews or `output_compression`.

            - `svg`: SVG vector: generations only, `n` must be 1 and `svg.model`
            is required; no streaming, previews or `output_compression`.
          enum:
            - png
            - jpeg
            - webp
            - gif
            - svg
          type: string
        output_compression:
          description: Compression level 0–100 (%), default 100; `jpeg` / `webp` only.
          format: int64
          type: integer
        moderation:
          default: auto
          description: |-
            Content moderation level.

            **Allowed values:**
            - `auto`: Standard moderation (default).
            - `low`: Less restrictive moderation.
          enum:
            - auto
            - low
          type: string
        stream:
          description: Stream the result as SSE; default `false`.
          type: boolean
        partial_images:
          description: >-
            Number of preview images pushed while streaming, 0–3, default 0.
            Each preview adds about 100 output tokens.
          format: int64
          type: integer
        user:
          description: >-
            Deprecated; use `safety_identifier`. Used only when
            `safety_identifier` is empty.
          type: string
        safety_identifier:
          description: >-
            A stable end-user identifier for safety monitoring; hash the
            username or email. Up to 128 characters.
          type: string
        complexity:
          default: high
          description: >-
            How much the model plans before rendering; default `high`. More
            planning suits complex layouts and many elements but can add latency
            and unwanted changes. It is independent of `quality`: when the
            layout is right but small text is hard to read, raise `quality`, not
            `complexity`.


            **Allowed values:**

            - `low`: Least planning and fastest, for simple images.

            - `medium`: Moderate planning.

            - `high`: Most planning (default), for complex layouts and many
            elements.
          enum:
            - low
            - medium
            - high
          type: string
        svg:
          $ref: '#/components/schemas/OpenAIImageSVGOptions'
          description: SVG output options; required when `output_format` is `svg`.
      required:
        - model
        - prompt
      type: object
    OpenAIImageResponse:
      additionalProperties: false
      description: Generation result.
      properties:
        created:
          description: Creation time, Unix seconds.
          format: int64
          type: integer
        data:
          description: Generated images.
          items:
            $ref: '#/components/schemas/OpenAIImageData'
          type: array
        background:
          description: |-
            Background actually used.

            **Allowed values:**
            - `transparent`: Transparent.
            - `opaque`: Opaque.
          enum:
            - transparent
            - opaque
          type: string
        output_format:
          default: png
          description: >-
            Actual output format.


            **Allowed values:**

            - `png`: PNG (default).

            - `jpeg`: JPEG: smaller and faster.

            - `webp`: WebP.

            - `gif`: Animated GIF (9 frames by default upstream); no streaming,
            previews or `output_compression`.

            - `svg`: SVG vector: generations only, `n` must be 1 and `svg.model`
            is required; no streaming, previews or `output_compression`.
          enum:
            - png
            - jpeg
            - webp
            - gif
            - svg
          type: string
        quality:
          description: |-
            Actual rendering quality.

            **Allowed values:**
            - `low`: Low.
            - `medium`: Medium.
            - `high`: High.
            - `xhigh`: Extra high.
            - `max`: Maximum.
          enum:
            - low
            - medium
            - high
            - xhigh
            - max
          type: string
        size:
          description: Actual output size, e.g. `1024x1024`.
          type: string
        usage:
          $ref: '#/components/schemas/OpenAIImageUsage'
          description: Token usage.
      required:
        - created
        - data
      type: object
    ImageAPIErrorResponse:
      additionalProperties: false
      description: Error response.
      properties:
        error:
          $ref: '#/components/schemas/ImageAPIError'
          description: Error details.
      required:
        - error
      type: object
    OpenAIImageSVGOptions:
      additionalProperties: false
      description: >-
        SVG output options: a reference image is rendered first (its quality set
        by `quality`), then a text model writes it as SVG.
      properties:
        model:
          description: The text model that writes the SVG, e.g. `gpt-6.1-terra`.
          type: string
      required:
        - model
      type: object
    OpenAIImageData:
      additionalProperties: false
      description: One generated image.
      properties:
        b64_json:
          description: >-
            Base64 image data (no `data:` prefix); decodes to a file in
            `output_format`.
          type: string
      type: object
    OpenAIImageUsage:
      additionalProperties: false
      description: Token usage.
      properties:
        input_tokens:
          description: Input tokens (text and images).
          format: int64
          type: integer
        input_tokens_details:
          $ref: '#/components/schemas/OpenAIImageTokenDetails'
          description: Input token breakdown.
        output_tokens:
          description: Output tokens.
          format: int64
          type: integer
        output_tokens_details:
          $ref: '#/components/schemas/OpenAIImageTokenDetails'
          description: Output token breakdown.
        total_tokens:
          description: Total tokens.
          format: int64
          type: integer
      required:
        - input_tokens
        - output_tokens
        - total_tokens
      type: object
    ImageAPIError:
      additionalProperties: false
      description: Error details.
      properties:
        code:
          description: Error code.
          type: string
        http_status:
          description: HTTP status code.
          format: int64
          type: integer
        message:
          description: Human-readable error message.
          type: string
        request_id:
          description: Request ID; include it when reporting issues.
          type: string
        type:
          description: |-
            Error type.

            **Allowed values:**
            - `invalid_request_error`: Invalid request.
            - `authentication_error`: Authentication failed.
            - `insufficient_balance_error`: Insufficient balance.
            - `permission_error`: Permission denied.
            - `rate_limit_error`: Rate limited.
            - `api_error`: Server or upstream error.
          enum:
            - invalid_request_error
            - authentication_error
            - insufficient_balance_error
            - permission_error
            - rate_limit_error
            - api_error
          type: string
      required:
        - code
        - http_status
        - message
        - request_id
        - type
      type: object
    OpenAIImageTokenDetails:
      additionalProperties: false
      description: Tokens by type.
      properties:
        image_tokens:
          description: Image tokens.
          format: int64
          type: integer
        text_tokens:
          description: Text tokens.
          format: int64
          type: integer
      required:
        - image_tokens
        - text_tokens
      type: object
  securitySchemes:
    bearerAuth:
      description: >-
        API Key created in the DreamTo console, sent as `Authorization: Bearer
        <API Key>`.
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.