ModelSite
Image GenerationQwen

Qwen Image Generation & Editing

POST /api/v1/services/aigc/multimodal-generation/generation — synchronous qwen-image

The Qwen image model covers both text-to-image (T2I) and image-to-image / editing (I2I): no image in the request means T2I; reference images plus an editing instruction mean I2I. Synchronous — one request returns the result.

Models

ModelNotes
qwen-image-2.0-proQwen image generation & editing

Create

POST/api/v1/services/aigc/multimodal-generation/generation
curl https://api.modelsite.ai/api/v1/services/aigc/multimodal-generation/generation \
  -H "Authorization: Bearer $MODELSITE_API_KEY" -H "Content-Type: application/json" \
  -d '{
    "model": "qwen-image-2.0-pro",
    "input": {
      "messages": [
        { "role": "user",
          "content": [{ "text": "A vertical portrait photo: a young woman in front of a newsstand on a warm afternoon, film grade" }] }
      ]
    },
    "parameters": { "size": "1024*1024", "n": 1 }
  }'

Request body

FieldTypeNotes
modelstring (required)qwen-image-2.0-pro
input.messagesarray (required)Exactly one entry: {"role": "user", "content": [...]} (single turn only)
input.messages[].contentarray (required)T2I: one {"text": "..."}. I2I: {"image": "..."} entries (URL or data: Base64) + exactly one {"text": "..."} instruction
parametersobject (optional)Below

parameters

ParameterTypeNotes
sizestringOutput resolution W*H (asterisk-separated, e.g. "1024*1024"), or "auto" (model-recommended). Pixel area 512512 – 20482048, aspect 1:8 – 8:1
nintegerImages to output, 1-6, default 1. Must be a JSON integer — the string "1" is a 400
prompt_extendbooleanPrompt rewriting, default true (recommended)
negative_promptstringNegative prompt (model-version dependent; subject to the model you call)
seedinteger[0, 2147483647]
watermarkbooleanWatermark, default false

Some versions also accept prompt_extend_mode (direct/agent) and enable_thinking (reasoning mode for quality) — whether they apply depends on the model you call; verify against the model detail from GET /v1/models.

Response

{
  "output": {
    "choices": [
      {
        "finish_reason": "stop",
        "message": {
          "role": "assistant",
          "content": [{ "image": "https://.../generated.png" }]
        }
      }
    ]
  },
  "usage": {
    "output_width": 1024,
    "output_height": 1024,
    "input_image_count": 0,
    "output_image_count": 1
  },
  "request_id": "571ae02f-5c9d-436c-83c2-f221e6df0xxx"
}
FieldNotes
output.choices[].message.content[].imageGenerated image URL (PNG). Expires after 24 hours — download immediately
usage.output_image_countImages actually returned — this is the billed count
usage.output_width / output_heightFinal output pixels

Billing

Billed by successfully generated image (usage.output_image_count); the resolution tier affects the rate; failed requests are not billed. Rates on the Models page.

Error handling

Parameter errors return 4xx + {"code": "...", "message": "..."} (e.g. InvalidParameter). General error codes: Errors.

On this page