> ## 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 Image Edit

> Calls Ali `qwen-image-2.0-pro` to perform single-image editing or multi-image fusion.

The public calling convention keeps top-level `model`, `input`, `response_format`, and exposes `n`, `size`, `watermark`, `prompt_extend`, `negative_prompt`, `seed` as top-level fields. Input images are placed in `input.messages[0].content[].image`, and the editing instruction is in a `text` item within the same array. The request body does not accept a top-level `parameters` field.



## OpenAPI

````yaml api-reference/en/zmodelImage/ali/qwen-edit.json POST /v1/images/edits
openapi: 3.0.1
info:
  title: Qwen image editing
  version: 1.0.0
  description: >-
    Ali Qwen image editing capability documentation. The unified API endpoint is
    `/v1/images/edits`. This document describes the public gateway contract for
    `qwen-image-2.0-pro`: `input.messages[].content[]` carries images and text
    instructions, 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 image editing capability
paths:
  /v1/images/edits:
    post:
      tags:
        - Qwen Image
      summary: Qwen image editing
      description: >-
        Calls Ali `qwen-image-2.0-pro` to perform single-image editing or
        multi-image fusion.


        The public calling convention keeps top-level `model`, `input`,
        `response_format`, and exposes `n`, `size`, `watermark`,
        `prompt_extend`, `negative_prompt`, `seed` as top-level fields. Input
        images are placed in `input.messages[0].content[].image`, and the
        editing instruction is in a `text` item within the same array. The
        request body does not accept a top-level `parameters` field.
      operationId: aliQwenImageEdit
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ImageEditRequest'
            examples:
              single_image_edit:
                summary: Single image edit
                value:
                  model: qwen-image-2.0-pro
                  response_format: url
                  input:
                    messages:
                      - role: user
                        content:
                          - image: https://example.com/source.webp
                          - text: Replace the background with a seaside sunset
                  'n': 2
                  size: 1536*1024
                  watermark: false
                  prompt_extend: true
                  negative_prompt: low quality
                  seed: 0
              multi_image_fusion:
                summary: Multi-image fusion
                value:
                  model: qwen-image-2.0-pro
                  response_format: url
                  input:
                    messages:
                      - role: user
                        content:
                          - image: https://example.com/input1.png
                          - image: https://example.com/input2.png
                          - image: https://example.com/input3.png
                          - text: >-
                              The girl in image 1 wearing the black dress from
                              image 2, sitting in the pose from image 3
                  'n': 2
                  size: 1024*1536
                  watermark: false
                  prompt_extend: true
                  negative_prompt: low resolution
      responses:
        '200':
          description: Success. Returns the image editing 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:
    ImageEditRequest:
      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/QwenImageInput'
        '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 example
            `1024*1536`. For the `qwen-image-2.0` series, total pixels must be
            between `512*512` and `2048*2048`. By default, total pixels are
            close to `1024*1024`, and the aspect ratio is close to the input
            image (for multi-image input, the last image). Recommended common
            resolutions: 1:1 `1024*1024`, `1536*1536`; 2:3 `768*1152`,
            `1024*1536`; 3:2 `1152*768`, `1536*1024`; 3:4 `960*1280`,
            `1080*1440`; 4:3 `1280*960`, `1440*1080`; 9:16 `720*1280`,
            `1080*1920`; 16:9 `1280*720`, `1920*1080`; 21:9 `1344*576`,
            `2048*872`.
          x-options:
            - label: 512*512
              value: 512*512
            - label: 1K
              value: 1000*1000
            - label: 2K
              value: 2000*2000
          default: 512*512
        watermark:
          type: boolean
          description: >-
            Whether to add a "Qwen-Image" watermark in the lower-right corner of
            the image. Default is `false`.
          default: false
        prompt_extend:
          type: boolean
          description: >-
            Whether to enable smart prompt rewriting. Default is `true`. When
            enabled, the model optimizes the positive prompt (`text`), which is
            especially helpful for simple prompts.
        negative_prompt:
          type: string
          description: >-
            Negative prompt used to describe content you do not want to see in
            the image and to constrain the image. Chinese and English are
            supported. Maximum length is 500 characters.
        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.
    ImageResponse:
      type: object
      properties:
        created:
          type: integer
          format: int64
          description: Creation time as a Unix timestamp (seconds).
        data:
          type: array
          description: List of generated images.
          items:
            $ref: '#/components/schemas/ImageData'
        metadata:
          type: object
          description: Additional result information. Field contents vary by capability.
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            type:
              type: string
              description: >-
                Error type, e.g. `invalid_request_error`, `api_error`, or an
                upstream-compatible error type.
            code:
              type: string
            param:
              type: string
    QwenImageInput:
      type: object
      required:
        - messages
      properties:
        messages:
          type: array
          description: >-
            Request content array. Currently only single-turn conversations are
            supported, so the array must contain exactly one object with `role`
            and `content` properties.
          minItems: 1
          maxItems: 1
          items:
            $ref: '#/components/schemas/QwenImageMessage'
    ImageData:
      type: object
      properties:
        url:
          type: string
          description: Image download link. Valid for 24 hours.
        b64_json:
          type: string
          description: Base64-encoded image data.
        revised_prompt:
          type: string
          description: Optimized prompt.
    QwenImageMessage:
      type: object
      required:
        - role
        - content
      properties:
        role:
          type: string
          enum:
            - user
          description: Message sender role. Must be set to `user`.
        content:
          type: array
          description: >-
            Message content. Includes 1-3 images in `{"image":"..."}` format and
            a single edit instruction in `{"text":"..."}` format.
          minItems: 2
          maxItems: 4
          items:
            $ref: '#/components/schemas/QwenImageContent'
    QwenImageContent:
      type: object
      required:
        - image
        - text
      properties:
        image:
          type: string
          description: >-
            Input image URL or Base64 data. Supports 1-3 images. For multi-image
            input, images are ordered by array position, and the output image
            aspect ratio follows the last image. Supported formats: JPG, JPEG,
            PNG, BMP, TIFF, WEBP, GIF (only first frame is processed).
            Recommended resolution: width and height between 384 and 3072
            pixels. Image size: no more than 10 MB. Supports public HTTP/HTTPS
            URLs, OSS temporary URLs (`oss://...`), or Base64 data
            (`data:image/jpeg;base64,...`).
        text:
          type: string
          description: >-
            Edit instruction. Supports both Chinese and English. The
            `qwen-image-2.0` series supports up to 1300 tokens; extra content is
            automatically truncated. Note: only one `text` item is supported;
            omitting it or passing multiple text items causes an error.
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: 'Pass `Authorization: Bearer <token>` in the request header.'

````