curl --location 'https://dashscope-intl.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation' \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer $DASHSCOPE_API_KEY" \
--data '{
"model": "qwen-image-3.0-pro",
"input": {
"messages": [
{
"role": "user",
"content": [
{
"image": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/fpakfo/image36.webp"
},
{
"text": "Generate an image that matches the depth map, following this description: A dilapidated red bicycle is parked on a muddy path with a dense primeval forest in the background."
}
]
}
]
},
"parameters": {
"n": 2,
"negative_prompt": " ",
"prompt_extend": true,
"watermark": false,
"size": "1536*1024"
}
}'{
"output": {
"rewrite_status": "not_use",
"choices": [
{
"finish_reason": "stop",
"message": {
"content": [
{
"image": "https://dashscope-result-sz.oss-cn-shenzhen.aliyuncs.com/xxx.png?Expires=xxx"
},
{
"image": "https://dashscope-result-sz.oss-cn-shenzhen.aliyuncs.com/xxx.png?Expires=xxx"
}
],
"role": "assistant"
}
}
]
},
"usage": {
"output_height": 1024,
"output_width": 1536,
"input_image_count": 1,
"input_image_type": "qima_input_1k",
"output_image_count": 2,
"output_image_type": "qima_output_1k"
},
"request_id": "bf37ca26-0abe-98e4-8065-xxxxxx"
}Authorizations
DashScope API Key. Create one in the QwenCloud console.
Body
application/jsonModel name.
Input data containing the messages array.
Show child attributes
Show child attributes
Single-turn only. Exactly one message with role user.
Show child attributes
Show child attributes
Must be user.
Message content array. Must contain 1 to 3 image objects and exactly one text object. For multi-image input, images are referenced by position (Image 1, Image 2, Image 3). The output aspect ratio is determined by the last image.
Show child attributes
Show child attributes
Input image as a public URL (HTTP/HTTPS) or Base64-encoded string (data:{mime_type};base64,{data}). Supported formats: JPG, JPEG, PNG, BMP, TIFF, WEBP, GIF (first frame only). For optimal results, width and height should be between 384 and 3072 pixels. Maximum file size: 10 MB.
Image editing instruction describing elements and visual features you want in the output image. Supports Chinese and English. The recommended maximum for the qwen-image-3.0 series is 4,500 tokens. The qwen-image-2.0 series accept up to 1,300 tokens. Other models accept up to 800 tokens. The system truncates excess tokens. Only one text input is supported per request.
Image editing parameters.
Show child attributes
Show child attributes
Number of images to generate. Default: 1.
- qwen-image-3.0 / qwen-image-2.0 / qwen-image-edit-max / qwen-image-edit-plus series: 1-6.
- qwen-image-edit: only 1.
Describes content you do NOT want in the image. Supports Chinese and English, max 500 characters. Excess is auto-truncated.
Output resolution as width*height.
- qwen-image-3.0 series: total pixels between 512*512 and 2048*2048, aspect ratio between 1:8 and 8:1; when omitted, the model auto-recommends a resolution based on the prompt.
- qwen-image-2.0 series: total pixels between 512*512 and 2048*2048. Default: same as input image (or last image in multi-image request).
- qwen-image-edit-max/plus: width and height each in [512, 2048]. Default: ~1024*1024 with aspect ratio similar to input. Automatically adjusted to nearest multiple of 16.
- qwen-image-edit: not supported.
Recommended sizes: 1024*1024 (1:1), 768*1152 / 1024*1536 (2:3), 1152*768 / 1536*1024 (3:2), 720*1280 / 1080*1920 (9:16), 1280*720 / 1920*1080 (16:9).
Enable prompt rewriting. When enabled, the model rewrites the editing instruction, which significantly improves results when prompts lack detail; for the qwen-image-3.0 series the rewriting follows the mode set by prompt_extend_mode. Not supported by qwen-image-edit.
Prompt rewriting mode. Supported by the qwen-image-3.0 series only.
direct(default): direct prompt enhancement (DPE). Suitable for most scenarios.agent: agent prompt enhancement (APE). Text-to-image only; passing it for image editing returns a 400 error.
Add a "Qwen-Image" watermark to the bottom-right corner of the image.
Random number seed. Range: [0, 2147483647]. Same seed produces more consistent (but not identical) results. If omitted, a random seed is used.
Response
Show child attributes
Show child attributes
The prompt rewriting status. The value depends on whether rewriting was enabled in the request and the result of the rewrite.
List of generated results.
Show child attributes
Show child attributes
Usage statistics (successful results only). Fields vary by model series: the qwen-image-3.0 series returns the output_* / input_* fields; other series return image_count / width / height.
Show child attributes
Show child attributes
Width of the final output image, in pixels. Returned by the qwen-image-3.0 series only.
Height of the final output image, in pixels. Returned by the qwen-image-3.0 series only.
Number of input images in the request. 0 for text-to-image; the actual input count for image editing. Returned by the qwen-image-3.0 series only.
Input image billing tier, determined by the output resolution pixel area: qima_input_1k when the area is 2,250,000 or less, qima_input_2k when greater. Returned by the qwen-image-3.0 series only.
Number of output images actually returned. Returned by the qwen-image-3.0 series only.
Output image billing tier, determined by the output resolution pixel area: qima_output_1k when the area is 2,250,000 or less, qima_output_2k when greater. Returned by the qwen-image-3.0 series only.
Number of images generated. Not returned by the qwen-image-3.0 series, which uses output_image_count instead.
Width of the generated image, in pixels. Not returned by the qwen-image-3.0 series, which uses output_width instead.
Height of the generated image, in pixels. Not returned by the qwen-image-3.0 series, which uses output_height instead.
Unique request identifier for tracing and troubleshooting.