Wan2.6 supports multi-image input, image editing, and interleaved text-image output.
Model overview
Model | Description | Output image specifications |
|---|---|---|
wan2.6-image | Edits images and generates interleaved text-image output. | Image format: PNG Image resolution and dimensions are configured through the size parameter. |
Before calling the API, check the model list and pricing supported in each region.
Prerequisites
Obtain an API key and export the API key as an environment variable.
HTTP synchronous
Returns results in a single request. Recommended for most scenarios.
- Singapore
- US (Virginia)
- China (Beijing)
POST https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generationWhen calling, replace {WorkspaceId} with your actual workspace ID.The global deployment scope (Frankfurt region) only supports asynchronous calls.
Request parameters |
|
Request headers | |
Content-Type string (Required)The content type of the request. Must be application/json. | |
Authorization string (Required)Authenticates the request with a Model Studio API key. Example: Bearer sk-xxxx. | |
X-DashScope-SSEstring (Optional)Enables streaming output.
| |
Request body | |
model string (Required)Model name. Set to wan2.6-image. | |
input object (Required)Input configuration.
Properties messages array (Required)Request content array. Only single-turn conversations are supported -- provide one role-content pair.
Properties role string (Required)Message role. Set to user.contentarray (Required)Array of message content.
Properties text string(Required)Positive prompt describing the desired image content, style, and composition.Supports Chinese and English. Maximum 2,000 characters (each Chinese character, letter, digit, or symbol counts as one). Auto-truncated if exceeded.Example: Generate a tomato and egg stir-fry based on this image style.Note: The content array must contain exactly one object with a text field.imagestring(Optional)URL or Base64-encoded string of the input image.Image constraints:
| |
parameters object (Optional)Generation parameters.
Properties negative_prompt string (optional)A negative prompt describing what you do not want in the image.Supports Chinese and English. Maximum length is 500 characters. Excess characters are truncated automatically.Example: Low resolution, low quality, distorted limbs, malformed fingers, oversaturated colors, wax-like appearance, no facial details, overly smooth surfaces, AI-generated look. Chaotic composition. Blurry or distorted text.size string (Optional)Output image resolution. Supports two methods: referencing input image proportions or directly specifying dimensions.When enable_interleave=false (image editing mode):
enable_interleave=true (interleaved text-image output mode):
Recommended resolutions for common aspect ratios
bool (Optional)Controls image generation mode:
integer (Optional)Number of images to generate. Behavior depends on enable_interleave:
integer (Optional)Only effective in interleaved text-image mode (enable_interleave=true).
bool (Optional)Only effective in image editing mode (enable_interleave = false).Enables intelligent prompt rewriting. Optimizes positive prompt only; negative prompt remains unchanged.
bool (Optional)Enables streaming output. Required (set to true) when enable_interleave=true.
bool (Optional)Adds a watermark label in the bottom-right corner of the image with fixed text "AI Generated".
integer (optional)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 parameters |
Task data (task status and image URLs) is retained for only 24 hours and then automatically purged. Save generated images promptly. |
output objectTask output.
Properties choices array of objectModel-generated output content.
Properties finish_reason stringReason for task termination.Non-streaming output scenario: Naturally stops with stop.Streaming output scenario: This parameter indicates whether the data stream has finished transmitting.
objectMessage returned by the model.
Properties role stringMessage role, fixed as assistant.contentarray
Properties type stringOutput type. Enumerated values: text, image.text stringGenerated text.image stringURL of the generated image in PNG format.Link expires after 24 hours. Download and save the image promptly.boolRequest completion flag.
| |
usage objectOutput statistics. Only counts successful results.
Properties image_count integerNumber of generated images.size stringResolution of generated images. Example: 1376*768.input_tokens integerBilled per image count.
integerBilled per image count.
integerBilled per image count.
| |
request_id stringUnique request identifier for tracing and troubleshooting. | |
code stringError code. Returned only for failed requests. See Error codes. | |
message stringDetailed error message. Returned only for failed requests. See Error codes. |
HTTP asynchronous
Process: Create task → Poll results
Step 1: Create task and get task ID
- Singapore
- US (Virginia)
- China (Beijing)
- Germany (Frankfurt)
POST https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/aigc/image-generation/generationWhen calling, replace {WorkspaceId} with your actual workspace ID.- After the task is created, use the returned
task_idto query the result. Thetask_idis valid for 24 hours. Do not create duplicate tasks. Instead, use polling to retrieve the result. - For guidance for beginners, see Call APIs with Postman or cURL.
Request parameters | |
Request headers | |
Content-Type string (Required)The content type of the request. Must be application/json. | |
Authorization string (Required)Authenticates the request with a Model Studio API key. Example: Bearer sk-xxxx. | |
X-DashScope-Asyncstring(Required)Asynchronous mode switch. Must be set to enable. | |
Request body | |
model string (Required)Model name.Example: wan2.6-image | |
input object (Required)Input configuration.
Properties messages array (Required)Request content array. Only single-turn conversations are supported — provide one role-content pair. Multi-turn conversations are not supported.
Properties role string (Required)Message role. Set to user.contentarray (Required)Array of message content.
Properties text string(Required)Positive prompt describing the desired image content, style, and composition.Supports Chinese and English. Maximum 2,000 characters (each Chinese character, letter, digit, or symbol counts as one). Auto-truncated if exceeded.Example: Generate a tomato and egg stir-fry based on this image style.Note: The content array must contain exactly one object with a text field.imagestring(Optional)URL or Base64-encoded string of the input image.Image constraints:
| |
parameters object (Optional)Generation parameters.
Properties negative_prompt string (optional)A negative prompt describing what you do not want in the image.Supports Chinese and English. Maximum length is 500 characters. Excess characters are truncated automatically.Example: Low resolution, low quality, distorted limbs, malformed fingers, oversaturated colors, wax-like appearance, no facial details, overly smooth surfaces, AI-generated look. Chaotic composition. Blurry or distorted text.size string (Optional)Output image resolution. Supports two methods: referencing input image proportions or directly specifying dimensions.When enable_interleave=false (image editing mode):
enable_interleave=true (interleaved text-image output mode):
Recommended resolutions for common aspect ratios
bool (Optional)Controls image generation mode:
integer (Optional)Number of images to generate. Behavior depends on enable_interleave:
integer (Optional)Only effective in interleaved text-image mode (enable_interleave=true).
bool (Optional)Only effective in image editing mode (enable_interleave = false).Enables intelligent prompt rewriting. Optimizes positive prompt only; negative prompt remains unchanged.
bool (Optional)Adds a watermark label in the bottom-right corner of the image with fixed text "AI Generated".
integer (optional)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 parameters |
Save the task_id to query the task status and result. |
output objectTask output.
Properties task_id stringThe task ID. Valid for queries for 24 hours.task_status stringThe status of the task.
Enumeration values
| |
request_id stringUnique request identifier for tracing and troubleshooting. | |
code stringError code. Returned only for failed requests. See Error codes. | |
message stringDetailed error message. Returned only for failed requests. See Error codes. |
Step 2: Query results using task ID
- Singapore
- US (Virginia)
- China (Beijing)
- Germany (Frankfurt)
GET https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/tasks/{task_id}When calling, replace {WorkspaceId} with your actual workspace ID.- Polling recommendation: Image generation is time-consuming. Use a polling mechanism with a reasonable interval, such as 10 seconds.
- Task state transition: PENDING → RUNNING → SUCCEEDED or FAILED.
- Result link: After a task succeeds, an image URL valid for 24 hours is returned. Download and save the image to permanent storage, such as OSS.
Request parameters |
Replace {task_id} with the task_id value returned by the previous API call. The task_id is valid for queries for 24 hours, Replace {WorkspaceId} with your actual workspace ID. |
Request headers | |
Authorization string (Required)Authenticates the request with a Model Studio API key. Example: Bearer sk-xxxx. | |
URL path parameters | |
task_id string (Required)The ID of the task. |
Response parameters |
Task data (task status and image URLs) is retained for only 24 hours and then automatically purged. Save generated images promptly. |
output objectTask output information.
Properties task_id stringThe task ID. Valid for queries for 24 hours.task_status stringThe status of the task.
Enumeration values
stringThe time when the task was submitted. The time is in UTC+8 and the format is YYYY-MM-DD HH:mm:ss.SSS.scheduled_time stringThe time when the task was executed. The time is in UTC+8 and the format is YYYY-MM-DD HH:mm:ss.SSS.end_time stringThe time when the task was completed. The time is in UTC+8 and the format is YYYY-MM-DD HH:mm:ss.SSS.finished boolRequest completion flag.
array of objectModel-generated output content.
Properties finish_reason stringReason for task termination. Naturally stops with stop.message objectMessage returned by the model.
Properties role stringMessage role, fixed as assistant.contentarray
Properties type stringOutput type. Enumerated values: text, image.text stringGenerated text.image stringURL of the generated image in PNG format.Link expires after 24 hours. Download and save the image promptly. | |
usage objectOutput statistics. Counts only successful results.
Properties image_count integerNumber of generated images.size stringResolution of generated images. Example: 1376*768.input_tokens integerInput token count. Billed per image count. Currently fixed at 0.output_tokens integerOutput token count. Billed per image count. Currently fixed at 0.total_tokensintegerTotal token count. Billed per image count. Currently fixed at 0. | |
request_id stringUnique request identifier for tracing and troubleshooting. | |
code stringError code. Returned only for failed requests. See Error codes. | |
message stringDetailed error message. Returned only for failed requests. See Error codes. |
DashScope Python SDK
SDK parameters align with the HTTP interface, adapted per language conventions.
The SDK handles asynchronous calls internally and supports both synchronous and asynchronous invocation.
Actual duration varies by queue length and service load.The
base_url and API key are region-specific. Example call from the Singapore region:
- Singapore
- US (Virginia)
- China (Beijing)
- Germany (Frankfurt)
https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1When calling, replace {WorkspaceId} with your actual workspace ID.The global deployment scope (Frankfurt region) only supports asynchronous calls.
Image editing
- Synchronous
- Asynchronous
Request example
Response example
URL expires after 24 hours. Download images promptly.
usage field, at the same level as output. Read them as response.usage["image_count"]. The output object does not carry statistics: response.output.usage is returned as {} and contains no image_count.Interleaved text-image output
- Synchronous (streaming only)
- Asynchronous
Request example
Response example
URL expires after 24 hours. Download images promptly.
DashScope Java SDK
SDK parameters align with the HTTP interface, encapsulated per language conventions.
The SDK handles asynchronous calls internally and supports both synchronous and asynchronous invocation.
Actual duration depends on queue length and service load.The
base_url and API key are not interchangeable across regions. Examples for the Singapore region:
- Singapore
- US (Virginia)
- China (Beijing)
- Germany (Frankfurt)
https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1When calling, replace {WorkspaceId} with your actual workspace ID.The global deployment scope (Frankfurt region) only supports asynchronous calls.
Image editing
- Synchronous
- Asynchronous
Request example
Response example
URL expires after 24 hours. Download images promptly.
Interleaved text-image output
- Synchronous call (streaming only)
- Asynchronous call
Request example
Response example
URL expires after 24 hours. Download images promptly.
Limitations
- Data validity: The task
task_idand imageurlare retained for only 24 hours. After this period, they cannot be queried or downloaded. - Content moderation: Both the input
promptand output image undergo content moderation. Non-compliant content returns anIPInfringementSuspectorDataInspectionFailederror. See Error codes.
Billing and rate limiting
- Free quotas and pricing: Model pricing.
- For model rate limits, see Wanxiang.
- You are charged per successfully generated image. Failed calls incur no charge and do not consume free quota.