The Wan image generation model supports image editing and mixed text-and-image output to meet diverse generation and integration needs.
Model overview
Model name | Model description | Output image specifications |
wan2.6-image | Wan 2.6 image Supports image editing and mixed text-and-image output | Image format: PNG. For image resolution and dimensions, see the size parameter. |
Before you make a call, see Model List and Prices for supported models and pricing by region.
Prerequisites
Before making a call, obtain an API key and set the API key as an environment variable. To make calls using the SDK, install the DashScope SDK.
The Beijing and Singapore regions have separate API keys and request endpoints. Do not use them interchangeably. Cross-region calls cause authentication failures or service errors.
HTTP invocation
Image generation tasks take a long time (typically 1 to 2 minutes), so the API uses asynchronous invocation. The entire process involves two core steps: Create Task -> Poll for Result. The steps are as follows:
The specific time required depends on the number of tasks in the queue and the service execution status. Please be patient when retrieving the results.
Step 1: Create a task to get a task ID
Singapore region: POST https://dashscope-intl.aliyuncs.com/api/v1/services/aigc/image-generation/generation
Beijing region: POST https://dashscope.aliyuncs.com/api/v1/services/aigc/image-generation/generation
After the task is created, use the returned
task_idto query the result. The task_id is valid for 24 hours. Do not create duplicate tasks. Use polling to retrieve the result.
Request parameters | Image-to-image with a referenceMixed text-and-image output |
Headers | |
Content-Type The content type of the request. Set this parameter to | |
Authorization The identity authentication credentials for the request. This API uses an Model Studio API key for identity authentication. Example: Bearer sk-xxxx. | |
X-DashScope-Async The asynchronous processing configuration parameter. HTTP requests support only asynchronous processing. You must set this parameter to Important If this request header is missing, the error message "current user api does not support synchronous calls" is returned. | |
Request Body | |
model The model name. Example: wan2.6-image. | |
input Basic input information. | |
parameters Image editing parameters. | |
Response parameters | Successful responseSave the task_id to query the task status and result. Error responseThe task creation failed. For more information, see Error messages to resolve the issue. |
output The task output information. | |
request_id The unique request ID. You can use this ID to trace and troubleshoot issues. | |
code The error code for a failed request. This parameter is not returned if the request is successful. For more information, see Error messages. | |
message The detailed information about a failed request. This parameter is not returned if the request is successful. For more information, see Error messages. |
Step 2: Query the result by task ID
Singapore region: GET https://dashscope-intl.aliyuncs.com/api/v1/tasks/{task_id}
Beijing region: GET https://dashscope.aliyuncs.com/api/v1/tasks/{task_id}
Polling suggestion: Image generation takes several minutes. Use a polling mechanism and set a reasonable query interval, such as 10 seconds, to retrieve the result.
Task status transition: PENDING → RUNNING → SUCCEEDED or FAILED.
Result link: After the task is successful, an image link is returned. The link is valid for 24 hours. After you retrieve the link, immediately download and save the image to a permanent storage service, such as Object Storage Service.
Request parameters | Query task resultReplace The API keys for the Singapore and Beijing regions are different. Create an API key. The following `base_url` is for the Singapore region. For models in the Beijing region, replace the `base_url` with `https://dashscope.aliyuncs.com/api/v1/tasks/86ecf553-d340-4e21-xxxxxxxxx`. |
Headers | |
Authorization The identity authentication credentials for the request. This API uses an Model Studio API key for identity authentication. Example: Bearer sk-xxxx. | |
URL path parameters | |
task_id The task ID. |
Response parameters | Task succeededTask data, such as the task status and image URLs, is retained for only 24 hours and is automatically purged after this period. You must save the generated images promptly. Task errorIf task execution fails, the returned information includes code and message fields that specify the cause of the error. See Error messages for solutions. |
output The task output information. | |
usage Statistics for the output. Only successful results are counted. | |
request_id The unique request ID. You can use this ID to trace and troubleshoot issues. | |
code The error code for a failed request. This parameter is not returned if the request is successful. For more information, see Error messages. | |
message The detailed information about a failed request. This parameter is not returned if the request is successful. For more information, see Error messages. |
Limits
Data retention: The task_id and image URL are retained for only 24 hours. After they expire, they cannot be queried or downloaded.
Content moderation: Both the input prompt and the output image undergo content moderation. Requests that contain violating content return an "IPInfringementSuspect" or "DataInspectionFailed" error. For more information, see Error messages.
Network access configuration: Image links are stored in Alibaba Cloud OSS. If your business system cannot access external OSS links due to security policies, add the following OSS domain names to your network access whitelist.
# OSS domain name list dashscope-result-bj.oss-cn-beijing.aliyuncs.com dashscope-result-hz.oss-cn-hangzhou.aliyuncs.com dashscope-result-sh.oss-cn-shanghai.aliyuncs.com dashscope-result-wlcb.oss-cn-wulanchabu.aliyuncs.com dashscope-result-zjk.oss-cn-zhangjiakou.aliyuncs.com dashscope-result-sz.oss-cn-shenzhen.aliyuncs.com dashscope-result-hy.oss-cn-heyuan.aliyuncs.com dashscope-result-cd.oss-cn-chengdu.aliyuncs.com dashscope-result-gz.oss-cn-guangzhou.aliyuncs.com dashscope-result-wlcb-acdr-1.oss-cn-wulanchabu-acdr-1.aliyuncs.com
Billing and throttling
For the model's free quota and billing rate, see Model List.
For more information about model rate limiting, see Wan.
Billing details:
Billing is based on the number of successfully generated images. You are charged only when the query result API returns a
task_statusofSUCCEEDEDand an image is successfully generated.Failed model calls or processing errors do not incur any charges or consume the free quota.
Error codes
If a call fails, see Error messages for troubleshooting.
FAQ
Q: How do I view model usage?
A: One hour after a model is called, you can view metrics such as the number of calls and the success rate on the Model Monitoring (Singapore)Model Monitoring (Beijing) page. How do I view model call records?