Qwen-Image-Edit API

Qwen's standard image editor supports inpainting, outpainting, and local changes.

POST /v1/images/generations

qwen-image-edit: Image generation, required fields, nested response schema and a fictional example.

Basic request

Required parameters: model, input

Available parameters: model, input, parameters

Request parameters

ParameterTypeRequiredDescription
modelstringYesExact model identifier shown on this page. Options: qwen-image-edit
inputobjectYesInput messages object.
parametersobjectNoOptional image settings.
## Usage and response conventions - Follow required fields and the nested schema. Optional settings without a documented numeric default use the current model default. - Context, output budgets and media constraints differ by model. Unverified limits are not universal guarantees. - An absent value differs from a reported zero. Read status, content and usage as actually returned. - Replace example.invalid addresses with readable media you are authorized to use. - Save generated files promptly; result links need not remain available indefinitely. ## Reference Terminology: [Qwen Image](https://docs.modelstudio.console.alibabacloud.com/en/model-studio/qwen-image-api-reference). Use this page's platform base URL and exact model identifier for requests. Reviewed: 2026-11-07. ## Complete nested field reference Array elements use []. Required flags apply only when the enclosing object or content-block variant is used. Response fields can be absent or null as described; false does not imply a fabricated zero. ### Request headers | Field path | Type | Required in its object | Meaning | |---|---|---|---| | `Content-Type` | string | Yes | JSON request-body content type. | ### Request body | Field path | Type | Required in its object | Meaning | |---|---|---|---| | `model` | string | Yes | Exact model identifier shown on this page. Values: qwen-image-edit | | `input` | object | Yes | Input messages object. | | `input.messages` | array[object] | Yes | One user message. | | `input.messages[].role` | string | Yes | Use user. Values: user | | `input.messages[].content` | array[object] | Yes | Text and reference-image blocks. | | `input.messages[].content[].text` | string | No | Generation prompt or editing instruction; include a text block. | | `input.messages[].content[].image` | string | No | Readable reference image URL for editing, one per block. | | `parameters` | object | No | Optional image settings. | | `parameters.n` | integer | No | Image count; the example requests one. Default: 1; Minimum: 1 | | `parameters.size` | string | No | Width*height, for example 1024*1024; supported sizes depend on the model. | | `parameters.seed` | integer | No | Optional seed; it does not guarantee identical pixels. | | `parameters.watermark` | boolean | No | Request a watermark. | ### Response 200 | Field path | Type | Required in its object | Meaning | |---|---|---|---| | `request_id` | string | No | Opaque request identifier. | | `output` | object | No | Image output; read the choices or results actually returned. | | `output.choices` | array[object] | No | Image choices returned by some models. | | `output.choices[].message` | object | No | Image output message. | | `output.choices[].message.role` | string | No | Use user. | | `output.choices[].message.content` | array[object] | No | Text and reference-image blocks. | | `output.choices[].message.content[].image` | string | No | Readable reference image URL for editing, one per block. | | `output.choices[].message.content[].text` | string | No | Generation prompt or editing instruction; include a text block. | | `output.results` | array[object] | No | Image list returned by some models. | | `output.results[].url` | string | No | Generated image URL. | | `output.task_status` | string | No | Task status when provided. | | `usage` | object | No | Reported image usage. | | `usage.image_count` | integer | No | Returned image count. | ### Error response structure | Field path | Type | Required in its object | Meaning | |---|---|---|---| | `error` | object | No | Error details for this request. | | `error.message` | string | No | Image output message. | | `error.type` | string | No | Type discriminator; use the values documented for the enclosing object. | | `error.code` | string | No | Error code; it may be empty. |

Request example

curl --request POST https://api.router.ai/v1/images/generations \
  --header "Authorization: Bearer $API_KEY" \
  --header "Content-Type: application/json" \
  --data-raw '{
  "model": "qwen-image-edit",
  "input": {
    "messages": [
      {
        "role": "user",
        "content": [
          {
            "image": "https://example.invalid/reference.png"
          },
          {
            "text": "A fictional blue paper boat on a plain white background."
          }
        ]
      }
    ]
  },
  "parameters": {
    "n": 1
  }
}'

Endpoint reference: Aliyun Qwen-Image text-to-image