> ## 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; the response carries image links, download and keep them promptly. Text-to-image only; image editing is not supported.



## OpenAPI

````yaml /openapi/en/qwen-image-2-1-turbo.json post /v1/images/generations
openapi: 3.1.0
info:
  title: Qwen-Image 2.1 Turbo
  version: v1
  description: >-
    Qwen-Image 2.1 Turbo: The 8-step distilled Qwen-Image 2.1, fast and the
    lowest-priced in the series, for batch generation.
servers:
  - url: https://api.dreamto.ai
security:
  - bearerAuth: []
tags:
  - name: Qwen-Image 2.1 Turbo
paths:
  /v1/images/generations:
    post:
      tags:
        - Qwen-Image 2.1 Turbo
      summary: Create image
      description: >-
        Generates images from a prompt. The request is synchronous; the response
        carries image links, download and keep them promptly. Text-to-image
        only; image editing is not supported.
      operationId: qwenImageGenerate
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/QwenImageGenerationRequest'
            examples:
              Text to image:
                summary: Text to image
                value:
                  model: qwen-image-2.1-turbo
                  prompt: >-
                    A cinematic city-at-night poster with the title "NIGHT RIDE"
                    at the top
                  size: 1024x1024
              Several images at once:
                summary: Several images at once
                value:
                  model: qwen-image-2.1-turbo
                  prompt: A watercolor cabin in the mountains, morning mist
                  size: 1536x1024
                  'n': 2
      responses:
        '200':
          description: Generated.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QwenImageResponse'
              examples:
                example:
                  value:
                    created: 1795963958
                    data:
                      - url: >-
                          https://api.dreamto.ai/v1/media/dtm_0123456789abcdef0123456789abcdef
                    usage:
                      image_count: 1
                      width: 1024
                      height: 1024
        '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:
    QwenImageGenerationRequest:
      type: object
      required:
        - model
        - prompt
      properties:
        model:
          type: string
          enum:
            - qwen-image-2.1-turbo
          description: Model name.
        prompt:
          type: string
          description: >-
            Describe the image to generate, in any language. Put any text that
            should appear in the image in quotes.
        size:
          type: string
          description: >-
            Output size as `WIDTHxHEIGHT`. Total pixels from 512×512 to
            2048×2048, aspect ratio from 1:8 to 8:1; when omitted the model
            picks a size for the prompt. Common sizes: `1024x1024`, `1536x1024`,
            `1024x1536`, `1472x1104`, `1104x1472`, `1664x928`, `928x1664`,
            `2048x2048`.
          example: 1024x1024
        'n':
          type: integer
          minimum: 1
          maximum: 6
          default: 1
          description: Number of images per request, 1 to 6, default 1. Billed per image.
      additionalProperties: false
    QwenImageResponse:
      type: object
      required:
        - data
      properties:
        created:
          type: integer
          description: Creation time (Unix seconds).
        data:
          type: array
          description: The generated images.
          items:
            type: object
            required:
              - url
            properties:
              url:
                type: string
                description: Image link.
        usage:
          type: object
          description: Usage.
          properties:
            image_count:
              type: integer
              description: Number of images generated (billed per image).
            width:
              type: integer
              description: Image width in pixels.
            height:
              type: integer
              description: Image height in pixels.
    ImageAPIErrorResponse:
      additionalProperties: false
      description: Error response.
      properties:
        error:
          $ref: '#/components/schemas/ImageAPIError'
          description: Error details.
      required:
        - error
      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
  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.