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": "wan2.7-image-pro",
"input": {
"messages": [
{
"role": "user",
"content": [
{
"text": "A serene mountain lake at sunrise, with mist rising from the water, surrounded by pine trees, photorealistic"
}
]
}
]
},
"parameters": {
"n": 1,
"size": "2K",
"watermark": false,
"thinking_mode": true
}
}'{
"output": {
"choices": [
{
"finish_reason": "stop",
"message": {
"content": [
{
"image": "https://dashscope-result-intl.oss-cn-singapore.aliyuncs.com/xxx.png?Expires=xxx",
"type": "image"
}
],
"role": "assistant"
}
}
],
"finished": true
},
"usage": {
"image_count": 1,
"input_tokens": 18790,
"output_tokens": 2,
"size": "2985*1405",
"total_tokens": 18792
},
"request_id": "a3f4befe-cacd-49c9-8298-xxxxxx"
}Authorizations
DashScope API Key. Create one in the Qwen Cloud console.
Body
application/jsonThe model name. Valid values: wan2.7-image-pro, wan2.7-image.
Input data containing the messages array.
Show child attributes
Show child attributes
An array of request content. Currently, only single-turn conversations are supported. This means you can pass only one set of role and content parameters. Multi-turn conversations are not supported.
Show child attributes
Show child attributes
Message role. Must be user.
Message content array. Must contain exactly one text object and 0 to 9 image objects.
When using multiple images, include multiple image objects in the array. Image order is determined by array position.
Show child attributes
Show child attributes
The user-entered prompt. Supports Chinese and English. The length cannot exceed 5,000 characters. Each Chinese character, letter, number, or symbol counts as one character. Any excess is automatically truncated. The content array must contain exactly one text object.
Input image as a public URL (HTTP/HTTPS) or Base64-encoded string (data:{mime_type};base64,{data}).
Image constraints:
- Formats: JPEG, JPG, PNG (alpha channel not supported), BMP, WEBP.
- Resolution: Width and height each between 240 and 8,000 pixels. Aspect ratio [1:8, 8:1].
- File size: Max 20 MB.
- Quantity: 0 to 9 images per request.
Image processing parameters.
Show child attributes
Show child attributes
Output image resolution. Two specification methods are available; they cannot be used together.
wan2.7-image-pro:
- Method 1 (recommended):
1K,2K(default), or4K.- Scope: Text-to-image (no image input, not generating an image set) supports 1K, 2K, and 4K. Other scenarios support 1K and 2K only.
- Total pixels: 1K = 1024×1024, 2K = 2048×2048, 4K = 4096×4096.
- Aspect ratio: With image input, output matches the aspect ratio of the last input image scaled to the selected resolution. Without image input, output is square.
- Method 2: Specify
width*heightin pixels, aspect ratio [1:8, 8:1].- Text-to-image: total pixels in [768×768, 4096×4096].
- Other scenarios: total pixels in [768×768, 2048×2048].
wan2.7-image:
- Method 1 (recommended):
1Kor2K(default). 4K is not supported. - Method 2: Specify
width*heightin pixels. All scenarios: total pixels in [768×768, 2048×2048], aspect ratio [1:8, 8:1].
The pixel value of the output image may differ slightly from the specified value.
Number of images to generate.
Note: The value of n directly affects the cost. Cost = Unit Price × Number of successfully generated images.
- When image set mode is disabled (
enable_sequential=false): This value represents the number of images to generate. Range: 1–4. Default: 4. - When image set mode is enabled (
enable_sequential=true): This value represents the maximum number of images to generate. Range: 1–12. Default: 12. The actual number is determined by the model and will not exceedn.
Controls the image generation mode.
false: Default value.true: Enables image set output mode.
Specifies whether to enable thinking mode. The default is true (enabled). This parameter is effective only when image set mode is disabled and there is no image input. When enabled, the model enhances its inference capabilities to improve image quality, but this increases generation time.
The selected area for interactive editing.
- Correspondence: The length of the list must match the number of input images. If an image does not require editing, pass an empty list
[]at the corresponding position. - Coordinate format:
[x1, y1, x2, y2](top-left x, top-left y, bottom-right x, bottom-right y). Use absolute pixel coordinates of the original image. The top-left coordinate is (0, 0). - Condition: A single image supports a maximum of 2 bounding boxes.
A custom color theme. An array of objects containing color (hex) and proportion (ratio). It must include 3 to 10 colors. We recommend setting it to 8. Available only when image set mode is disabled (enable_sequential=false).
[
{
"hex": "#C2D1E6",
"ratio": "60.00%"
},
{
"hex": "#636574",
"ratio": "25.00%"
},
{
"hex": "#CBD4E4",
"ratio": "15.00%"
}
]Adds a watermark label in the bottom-right corner of the image with fixed text "AI Generated".
Random number seed. Valid range: [0, 2147483647]. Using the same seed yields similar outputs. If omitted, the algorithm uses a random seed. Note: Image generation is probabilistic. Even with the same seed, results may vary.
Response
Show child attributes
Show child attributes
List of generated results.
Show child attributes
Show child attributes
Reason for generation completion.
Whether the generation has completed.
Unique request identifier.