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

# Qwen Text to Image

> Calls Ali `qwen-image-2.0-pro` to perform text-to-image generation.

The public calling convention keeps top-level `model`, `input`, `response_format`, and exposes `n`, `size`, `negative_prompt`, `prompt_extend`, `watermark`, `seed` as top-level fields. The prompt is placed in `input.messages[0].content[0].text`. The request body does not accept a top-level `parameters` field.



## OpenAPI

````yaml api-reference/en/zmodelImage/ali/qwen-text-to-image.json POST /v1/images/generations
openapi: 3.0.1
info:
  title: Qwen text-to-image
  version: 1.0.0
  description: >-
    Ali Qwen text-to-image capability documentation. The unified API endpoint is
    `/v1/images/generations`. This document describes the public gateway
    contract for `qwen-image-2.0-pro`: `input.messages[].content[].text` carries
    the prompt, while other control fields use top-level OpenAI-style fields
    that the gateway maps to upstream `parameters`.
  license:
    name: Project License
    url: https://github.com/QuantumNous/new-api/blob/main/LICENSE
servers:
  - url: https://api.powertokens.ai
    description: Baze API server endpoint
security: []
tags:
  - name: Qwen Image
    description: Qwen text-to-image capability
paths:
  /v1/images/generations:
    post:
      tags:
        - Qwen Image
      summary: Qwen text-to-image
      description: >-
        Calls Ali `qwen-image-2.0-pro` to perform text-to-image generation.


        The public calling convention keeps top-level `model`, `input`,
        `response_format`, and exposes `n`, `size`, `negative_prompt`,
        `prompt_extend`, `watermark`, `seed` as top-level fields. The prompt is
        placed in `input.messages[0].content[0].text`. The request body does not
        accept a top-level `parameters` field.
      operationId: aliQwenTextToImage
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TextToImageRequest'
            examples:
              basic_generation:
                summary: Basic text-to-image
                value:
                  model: qwen-image-2.0-pro
                  response_format: url
                  input:
                    messages:
                      - role: user
                        content:
                          - text: >-
                              A cute orange cat sitting on a windowsill, bathed
                              in sunlight, realistic style
                  size: 2048*2048
                  'n': 1
                  watermark: false
              advanced_generation:
                summary: Advanced text-to-image
                value:
                  model: qwen-image-2.0-pro
                  response_format: url
                  input:
                    messages:
                      - role: user
                        content:
                          - text: >-
                              Sci-fi cityscape at night, neon lights, futuristic
                              architecture
                  size: 2048*1024
                  'n': 2
                  negative_prompt: low resolution, low quality, blurry
                  prompt_extend: true
                  watermark: false
                  seed: 0
      responses:
        '200':
          description: Success. Returns the image generation result.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ImageResponse'
        '400':
          description: Invalid request parameters.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Authentication failed, e.g. missing or invalid token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '413':
          description: Request body too large.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Rate limit triggered or insufficient account quota.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal server error while processing the request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '502':
          description: Upstream provider returned an abnormal response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '503':
          description: >-
            Upstream provider is temporarily unavailable, or no available
            channel for the current model.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - BearerAuth: []
components:
  schemas:
    TextToImageRequest:
      type: object
      required:
        - model
        - input
      properties:
        model:
          type: string
          enum:
            - qwen-image-2.0-pro
          description: 'Model name. Example: `qwen-image-2.0-pro`.'
        response_format:
          type: string
          enum:
            - url
            - b64_json
          description: >-
            Response format. `url` returns an image download link; `b64_json`
            returns Base64-encoded image data. Default is `url`.
          default: url
        input:
          $ref: '#/components/schemas/QwenTextToImageInput'
        'n':
          type: integer
          minimum: 1
          maximum: 6
          description: >-
            Number of output images. Default is 1. For the `qwen-image-2.0`
            series, you can generate 1-6 images.
        size:
          type: string
          description: >-
            Output image resolution in `width*height` format. For the
            `qwen-image-2.0` series, total output pixels must be between
            `512*512` and `2048*2048`, and the default resolution is
            `2048*2048`. Recommended resolutions: `2688*1536` (16:9),
            `1536*2688` (9:16), `2048*2048` (1:1, default), `2368*1728` (4:3),
            and `1728*2368` (3:4).
          x-options:
            - label: 512*512
              value: 512*512
            - label: 1K
              value: 1000*1000
            - label: 2K
              value: 2000*2000
          default: 512*512
        negative_prompt:
          type: string
          description: >-
            Negative prompt used to describe content that should not appear in
            the image and to constrain the image. Chinese and English are
            supported. Maximum length is 500 characters; extra content is
            automatically truncated. Example: low resolution, low quality,
            malformed limbs, malformed fingers, oversaturated image, wax figure
            appearance, no facial details, overly smooth, AI-like image, chaotic
            composition, blurry or distorted text.
        prompt_extend:
          type: boolean
          description: >-
            Whether to enable smart prompt rewriting. When enabled, the model
            optimizes and polishes the positive prompt. This feature does not
            modify the negative prompt. `true` (default): enabled, recommended
            for more diverse content. `false`: disabled, recommended for more
            controllable details.
        watermark:
          type: boolean
          description: >-
            Whether to add a "Qwen-Image" watermark in the lower-right corner of
            the image. Default is `false`.
          default: false
        seed:
          type: integer
          format: int64
          description: >-
            Random seed. Range [0, 2147483647]. Using the same `seed` value can
            make generated content relatively stable. If omitted, the algorithm
            automatically uses a random seed. Note: generation is probabilistic,
            so the same `seed` cannot guarantee identical results every time.
          minimum: 0
    ImageResponse:
      type: object
      properties:
        created:
          type: integer
          format: int64
          description: Response generation timestamp.
        data:
          type: array
          description: List of generated image results.
          items:
            $ref: '#/components/schemas/ImageData'
        metadata:
          type: object
          description: Pass-through raw response metadata from the upstream provider.
    ErrorResponse:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/ErrorObject'
    QwenTextToImageInput:
      type: object
      required:
        - messages
      properties:
        messages:
          type: array
          minItems: 1
          maxItems: 1
          description: >-
            Request content array. Currently only single-turn conversations are
            supported, and the array must contain exactly one element.
          items:
            $ref: '#/components/schemas/QwenTextToImageMessage'
    ImageData:
      type: object
      properties:
        url:
          type: string
          description: Used when the result is returned as a URL.
        b64_json:
          type: string
          description: Used when the result is returned as Base64.
        revised_prompt:
          type: string
          description: Revised prompt returned by the upstream provider.
    ErrorObject:
      type: object
      properties:
        message:
          type: string
        type:
          type: string
        param:
          type: string
        code:
          type: string
    QwenTextToImageMessage:
      type: object
      required:
        - role
        - content
      properties:
        role:
          type: string
          enum:
            - user
          description: Message role. This parameter must be set to `user`.
        content:
          type: array
          minItems: 1
          maxItems: 1
          description: >-
            Message content array. Only one `text` item is supported; omitting
            it or passing multiple text items causes an error.
          items:
            $ref: '#/components/schemas/QwenTextToImageContentItem'
    QwenTextToImageContentItem:
      type: object
      required:
        - text
      properties:
        text:
          type: string
          description: >-
            Positive prompt used to describe the image content, style, and
            composition you want to generate. Chinese and English are supported.
            The `qwen-image-2.0` series supports up to 1300 tokens; other models
            support up to 800 tokens. Extra content is automatically truncated.
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: 'Pass `Authorization: Bearer <token>` in the request header.'

````