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
| Model | Notes |
|---|---|
qwen-image-2.0-pro | Qwen image generation & editing |
Create
/api/v1/services/aigc/multimodal-generation/generationcurl 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
| Field | Type | Notes |
|---|---|---|
model | string (required) | qwen-image-2.0-pro |
input.messages | array (required) | Exactly one entry: {"role": "user", "content": [...]} (single turn only) |
input.messages[].content | array (required) | T2I: one {"text": "..."}. I2I: {"image": "..."} entries (URL or data: Base64) + exactly one {"text": "..."} instruction |
parameters | object (optional) | Below |
parameters
| Parameter | Type | Notes |
|---|---|---|
size | string | Output resolution W*H (asterisk-separated, e.g. "1024*1024"), or "auto" (model-recommended). Pixel area 512512 – 20482048, aspect 1:8 – 8:1 |
n | integer | Images to output, 1-6, default 1. Must be a JSON integer — the string "1" is a 400 |
prompt_extend | boolean | Prompt rewriting, default true (recommended) |
negative_prompt | string | Negative prompt (model-version dependent; subject to the model you call) |
seed | integer | [0, 2147483647] |
watermark | boolean | Watermark, 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"
}| Field | Notes |
|---|---|
output.choices[].message.content[].image | Generated image URL (PNG). Expires after 24 hours — download immediately |
usage.output_image_count | Images actually returned — this is the billed count |
usage.output_width / output_height | Final 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.