The Wan text-to-image model generates images from text, supporting various art styles and photorealistic effects to meet diverse creative needs.
Model overview
| Model | Model description | Output image format |
|---|---|---|
wan2.6-t2i Recommend | Wan2.6Supports freely selecting dimensions within the total pixel area and aspect ratio constraints (same as wan2.5) | Image resolution: total pixels between [12801280, 14401440]Image aspect ratio: [1:4, 4:1] Image format: png |
wan2.5-t2i-preview Recommend | Wan2.5 previewSupports freely selecting dimensions within the total pixel area and aspect ratio constraintsFor example, 768*2700 is supported, while versions 2.2 and earlier have a per-side limit of 1400 | |
| wan2.2-t2i-flash | Wan2.2 Turbo50% faster than the 2.1 models | Image resolution: width and height both between [512, 1440] pixelsImage format: png |
| wan2.2-t2i-plus | Wan2.2 PlusSignificantly improved stability and success rate compared to the 2.1 models | |
| wanx2.1-t2i-turbo | Wan2.1 Turbo | |
| wanx2.1-t2i-plus | Wan2.1 Plus | |
| wanx2.0-t2i-turbo | Wan2.0 Turbo |
- Before calling, please check the list of models supported in each region.
- wan2.6 models: Support HTTP synchronous calls, HTTP asynchronous calls, Dashscope Python SDK calls, and Dashscope Java SDK calls.
- wan2.5 and earlier models: Support HTTP asynchronous calls, Dashscope Python SDK calls, and Dashscope Java SDK calls, but do not support HTTP synchronous calls.
Prerequisites
Before calling, first obtain and configure an API Key, then configure the API Key in environment variables. To make calls through an SDK, please install the DashScope SDK.
HTTP synchronous calls (wan2.6)
Results are returned in a single request with a simple workflow, recommended for most scenarios.
- China (Beijing)
- Singapore
- US (Virginia)
POST https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generationWhen calling, replace {WorkspaceId} with your actual workspace ID.Request parametersRequest headersContent-Typestring(Required)The request content type. This parameter must be set to application/json.Authorizationstring(Required)Request authentication. The API uses an Alibaba Cloud Model Studio API key for authentication. Example: Bearer sk-xxxx.Request bodymodelstring (Required)The model name. Example: wan2.6-t2i.For wan2.5 and earlier models, see HTTP asynchronous calls for HTTP calls. object (Required)Basic input information.
Properties messages array (Required)The request content array. Currently, only single-turn conversations are supported, that is, passing one set of role and content parameters. Multi-turn conversations are not supported.
Properties role string (Required)The role of the message. This parameter must be set to user.contentarray (Required)The message content array.
Properties text string(Required)The positive prompt, describing the desired image content, style, and composition.Supports Chinese and English, with a maximum length of 2,100 characters. Each Chinese character, letter, digit, or symbol counts as one character, and excess parts are automatically truncated.Example: A seated orange cat, with a happy expression, lively and cute, realistic and accurate.Note: Only one text can be passed. Passing none or multiple will cause an error.object (Optional)Image processing parameters.
Properties negative_prompt string (Optional)The negative prompt, describing content you do not want in the image, to constrain the image.Supports Chinese and English, with a maximum length of 500 characters, and excess parts are automatically truncated.Example: Low resolution, low quality, deformed limbs, deformed fingers, oversaturated image, waxy look, faces without details, overly smooth, AI-generated look. Chaotic composition. Blurry, distorted text.size string (Optional)The resolution of the output image, in the format width*height.
Recommended resolutions for common aspect ratios
integer (Optional)The number of images to generate. The value range is 1 to 4, and the default is 4.Note: Billing is per image. For testing, we recommend setting it to 1.prompt_extend bool (Optional)Whether to enable intelligent prompt rewriting. When enabled, a large model is used to optimize the positive prompt, which significantly improves short prompts but adds 3 to 4 seconds of latency.
After intelligent rewriting is enabled, the rewritten prompt may introduce copyrighted content, triggering content moderation and returning an IPInfringementSuspect or DataInspectionFailed error.If you encounter the above errors, you can set prompt_extend to false and retry. If the prompt itself directly contains copyrighted character or work names, disabling intelligent rewriting will still cause an error, and you need to modify the prompt itself.bool (Optional)Whether to add a watermark. The watermark is located in the lower-right corner of the image, with the fixed text "AI Generated".
integer (Optional)The random number seed, with a value range of [0,2147483647].Using the same seed parameter value keeps the generated content relatively stable. If not provided, the algorithm automatically uses a random seed.Note: The model generation process is probabilistic. Even with the same seed, identical results cannot be guaranteed. |
|
Response parametersoutputobjectThe task output information.
Properties choices arrayThe output content generated by the model.
Properties finish_reason stringThe reason the task stopped. It is stop when the task stops naturally.message objectThe message returned by the model.
Properties role stringThe role of the message, fixed as assistant.contentarray
Properties image stringThe URL of the generated image, in PNG format. The link is valid for 24 hours. Download and save the image in a timely manner.type stringThe output type, fixed as image.booleanWhether the task has ended.
objectOutput statistics. Only successful results are counted.
Properties image_count integerThe number of generated images.size stringThe resolution of the generated image. Example: 1280*1280.input_tokens integerInput tokens. Text-to-image is billed by the number of images, and this is currently fixed at 0.output_tokens integerOutput tokens. Text-to-image is billed by the number of images, and this is currently fixed at 0.total_tokensintegerTotal tokens. Text-to-image is billed by the number of images, and this is currently fixed at 0.stringThe unique identifier of the request. It can be used for request tracing and troubleshooting.codestringThe error code returned when the request fails. This parameter is not returned when the request succeeds. For more information, see Error codes.messagestringThe detailed error information returned when the request fails. This parameter is not returned when the request succeeds. For more information, see Error codes. |
Task data (such as task status and image URLs) is retained for only 24 hours and is automatically cleared after it expires. Be sure to save the generated images in a timely manner. |
HTTP asynchronous call (wan2.6)
The task workflow consists of two core steps: "Create task -> Poll for results", as follows:
Step 1: Create a task to obtain a task ID
- China (Beijing)
- Singapore
- US (Virginia)
- Germany (Frankfurt)
POST https://{WorkspaceId}.cn-beijing.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
task_idreturned by the API to query the result. The task_id is valid for 24 hours. Do not create the task repeatedly; just poll for the result. - For a beginner's guide, see Postman.
Request parametersRequest headersContent-Typestring(Required)The request content type. This parameter must be set to application/json.Authorizationstring(Required)Request authentication. The API uses an Alibaba Cloud Model Studio API key for authentication. Example: Bearer sk-xxxx.X-DashScope-Asyncstring(Required)The asynchronous processing configuration parameter. HTTP requests support only asynchronous mode, and it must be set to enable.Request bodymodelstring (Required)The model name. Example: wan2.6-t2i.For HTTP calls to wan2.5 and earlier models, see HTTP asynchronous call. object (Required)Basic input information.
Properties messages array (Required)The request content array. Currently, only single-turn conversations are supported, that is, passing one set of role and content parameters. Multi-turn conversations are not supported.
Properties role string (Required)The role of the message. This parameter must be set to user.contentarray (Required)The message content array.
Properties text string(Required)The positive prompt, describing the desired image content, style, and composition.Supports Chinese and English, with a maximum length of 2,100 characters. Each Chinese character, letter, digit, or symbol counts as one character, and excess parts are automatically truncated.Example: A flower shop with exquisite windows, a beautiful wooden door, and flowers on display.Note: Only one text can be passed. Passing none or multiple will cause an error.object (Optional)Image processing parameters.
Properties negative_prompt string (Optional)The negative prompt, describing content you do not want in the image, to constrain the image.Supports Chinese and English, with a maximum length of 500 characters, and excess parts are automatically truncated.Example: Low resolution, low quality, deformed limbs, deformed fingers, oversaturated image, waxy look, faces without details, overly smooth, AI-generated look. Chaotic composition. Blurry, distorted text.size string (Optional)The resolution of the output image, in the format width*height.
Recommended resolutions for common aspect ratios
integer (Optional)The number of images to generate. The value range is 1 to 4, and the default is 4.Note: Billing is per image. For testing, we recommend setting it to 1.prompt_extend bool (Optional)Whether to enable intelligent prompt rewriting. When enabled, a large model is used to optimize the positive prompt, which significantly improves results for short prompts, but adds 3-4 seconds of processing time.
After intelligent rewriting is enabled, the rewritten prompt may introduce copyrighted content, triggering content moderation and returning an IPInfringementSuspect or DataInspectionFailed error.If you encounter the above errors, you can set prompt_extend to false and retry. If the prompt itself directly contains copyrighted character or work names, disabling intelligent rewriting will still cause an error, and you need to modify the prompt itself.bool (Optional)Whether to add a watermark. The watermark is located in the lower-right corner of the image, with the fixed text "AI Generated".
integer (Optional)The random number seed, with a value range of [0,2147483647].Using the same seed parameter value keeps the generated content relatively stable. If not provided, the algorithm automatically uses a random seed.Note: The model generation process is probabilistic. Even with the same seed, identical results cannot be guaranteed. |
|
Response parametersoutputobjectThe task output information.
Properties task_id stringThe task ID. The query validity period is 24 hours.task_status stringThe task status.
Enumerated values
stringThe unique identifier of the request. It can be used for request tracing and troubleshooting.codestringThe error code returned when the request fails. This parameter is not returned when the request succeeds. For more information, see Error codes.messagestringThe detailed error information returned when the request fails. This parameter is not returned when the request succeeds. For more information, see Error codes. |
Save the task_id for querying the task status and results. |
Step 2: Query results by task ID
- China (Beijing)
- Singapore
- US (Virginia)
- Germany (Frankfurt)
GET https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/tasks/{task_id}When calling, replace {WorkspaceId} with your actual workspace ID.- Polling recommendations: Image generation is time-consuming. We recommend using a polling mechanism with a reasonable query interval (for example, 10 seconds) to obtain results.
- Task status transitions: PENDING (Queuing) → RUNNING (Processing) → SUCCEEDED (Success) / FAILED (Failed).
- Result links: The image URL is returned after the task succeeds and is valid for 24 hours. We recommend downloading the image immediately after obtaining the URL and storing it in permanent storage (such as Alibaba Cloud OSS).
- RPS limits: The default RPS of the query API is 20. For higher-frequency queries or event notifications, we recommend configuring asynchronous task callbacks.
- More operations: For operations such as batch queries and task cancellation, see Manage asynchronous tasks.
Request parametersRequest headersAuthorizationstring(Required)Request authentication. The API uses an Alibaba Cloud Model Studio API key for authentication. Example: Bearer sk-xxxx.URL path parameterstask_idstring(Required)The task ID. |
Replace {task_id} entirely with the task_id value returned by the API in the previous step. The task_id query validity period is 24 hours. Also replace {WorkspaceId} with your actual workspace ID. |
Response parametersoutputobjectThe task output information.
Properties task_id stringThe task ID. The query validity period is 24 hours.task_status stringThe task status.
Enumerated values
stringThe task submission time. Format: YYYY-MM-DD HH:mm:ss.SSS.scheduled_time stringThe task execution time. Format: YYYY-MM-DD HH:mm:ss.SSS.end_time stringThe task completion time. Format: YYYY-MM-DD HH:mm:ss.SSS.finished booleanWhether the task has ended.
arrayThe output content generated by the model.
Properties finish_reason stringThe reason the task stopped. It is stop when the task completes normally.message objectThe message returned by the model.
Properties role stringThe role of the message, fixed as assistant.contentarray
Properties image stringThe URL of the generated image, in PNG format.The link is valid for 24 hours. Download and save the image in a timely manner.type stringThe output type, fixed as image.objectOutput statistics. Only successful results are counted.
Properties image_count integerThe number of generated images.size stringThe resolution of the generated image. Example: 1280*1280.input_tokens integerThe number of input tokens. Currently fixed at 0.output_tokens integerThe number of output tokens. Currently fixed at 0.total_tokensintegerThe total number of tokens. Currently fixed at 0.stringThe unique identifier of the request. It can be used for request tracing and troubleshooting.codestringThe error code returned when the request fails. This parameter is not returned when the request succeeds. For more information, see Error codes.messagestringThe detailed error information returned when the request fails. This parameter is not returned when the request succeeds. For more information, see Error codes. |
Task data (such as task status and image URLs) is retained for only 24 hours and is automatically cleared after it expires. Be sure to save the generated images in a timely manner. |
HTTP asynchronous call (wan2.5 and earlier models)
Since text-to-image tasks take a long time (usually 1-2 minutes), the API uses asynchronous calls. The workflow consists of two core steps: "Create task -> Poll for results", as follows:
The actual time depends on the number of queued tasks and service execution. Please wait patiently when obtaining results.
Step 1: Create a task to obtain a task ID
- Beijing
- Singapore
POST https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/aigc/text2image/image-synthesis- After the task is created, use the
task_idreturned by the API to query the result. The task_id is valid for 24 hours. Do not create the task repeatedly; just poll for the result. - For a beginner's guide, see Postman.
Request parametersRequest headersContent-Typestring(Required)The request content type. This parameter must be set to application/json.Authorizationstring(Required)Request authentication. The API uses an Alibaba Cloud Model Studio API key for authentication. Example: Bearer sk-xxxx.X-DashScope-Asyncstring(Required)The asynchronous processing configuration parameter. HTTP requests support only asynchronous mode, and it must be set to enable.Request bodymodelstring (Required)The model name. For text-to-image models, see the model list.Example: wan2.5-t2i-preview.For HTTP calls to the wan2.6 model, see HTTP synchronous call and HTTP asynchronous call. object (Required)Basic input information, such as the prompt.
Properties prompt string (Required)The positive prompt, describing the elements and visual features you want in the generated image.Supports Chinese and English. Each Chinese character/letter/punctuation mark occupies one character, and excess parts are automatically truncated. The length limit varies by model version:
string (Optional)The negative prompt, describing content you do not want in the image, to constrain the image.Supports Chinese and English, with a maximum length of 500 characters, and excess parts are automatically truncated.Example: Low resolution, errors, worst quality, low quality, incomplete, extra fingers, bad proportions, etc.object (Optional)Image processing parameters, such as setting the image resolution, enabling intelligent prompt rewriting, and adding a watermark.
Properties size string (Optional)The resolution of the output image, in the format width*height. The default value and constraints vary by model version:
Recommended resolutions for common aspect ratios The following resolutions apply to wan2.5-t2i-preview
integer (Optional)The number of images to generate. The value range is 1 to 4, and the default is 4. During testing, we recommend setting it to 1 for low-cost verification.prompt_extendboolean (Optional)Whether to enable intelligent prompt rewriting. When enabled, a large model intelligently rewrites the input prompt. It significantly improves generation results for short prompts, but increases processing time.
After intelligent rewriting is enabled, the rewritten prompt may introduce copyrighted content, triggering content moderation and returning an IPInfringementSuspect or DataInspectionFailed error.If you encounter the above errors, you can set prompt_extend to false and retry. If the prompt itself directly contains copyrighted character or work names, disabling intelligent rewriting will still cause an error, and you need to modify the prompt itself.boolean (Optional)Whether to add a watermark. The watermark is located in the lower-right corner of the image, with the fixed text "AI Generated".
integer (Optional)The random number seed, with a value range of [0,2147483647].Using the same seed parameter value keeps the generated content relatively stable. If not provided, the algorithm automatically uses a random seed.Note: The model generation process is probabilistic. Even with the same seed, identical results cannot be guaranteed. |
|
Response parametersoutputobjectThe task output information.
Properties task_id stringThe task ID. The query validity period is 24 hours.task_status stringThe task status.
Enumerated values
stringThe unique identifier of the request. It can be used for request tracing and troubleshooting.codestringThe error code returned when the request fails. This parameter is not returned when the request succeeds. For more information, see Error codes.messagestringThe detailed error information returned when the request fails. This parameter is not returned when the request succeeds. For more information, see Error codes. |
Save the task_id for querying the task status and results. |
Step 2: Query results by task ID
- China (Beijing)
- Singapore
GET https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/tasks/{task_id}When calling, replace {WorkspaceId} with your actual workspace ID.- Polling recommendations: Image generation is time-consuming. We recommend using a polling mechanism with a reasonable query interval (for example, 10 seconds) to obtain results.
- Task status transitions: PENDING (Queuing) → RUNNING (Processing) → SUCCEEDED (Success) / FAILED (Failed).
- Result links: The image URL is returned after the task succeeds and is valid for 24 hours. We recommend downloading the image immediately after obtaining the URL and storing it in permanent storage (such as Alibaba Cloud OSS).
- RPS limits: The default RPS of the query API is 20. For higher-frequency queries or event notifications, we recommend configuring asynchronous task callbacks.
- More operations: For operations such as batch queries and task cancellation, see Manage asynchronous tasks.
Request parametersRequest headersAuthorizationstring(Required)Request authentication. The API uses an Alibaba Cloud Model Studio API key for authentication. Example: Bearer sk-xxxx.URL path parameterstask_idstring(Required)The task ID. |
Replace 86ecf553-d340-4e21-xxxxxxxxx with your actual task_id.If you use a model in the Singapore region, replace the base_url with https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/tasks/86ecf553-d340-4e21-xxxxxxxxx, where {WorkspaceId} must be replaced with your actual workspace ID. |
Response parametersoutputobjectThe task output information.
Properties task_id stringThe task ID. The query validity period is 24 hours.task_status stringThe task status.
Enumerated values
stringThe task submission time. Format: YYYY-MM-DD HH:mm:ss.SSS.scheduled_time stringThe task execution time. Format: YYYY-MM-DD HH:mm:ss.SSS.end_time stringThe task completion time. Format: YYYY-MM-DD HH:mm:ss.SSS.results array of objectThe task result list, including image URLs, the prompt, and error information for partially failed tasks.
Data structure
Properties orig_prompt stringThe original input prompt, corresponding to the request parameter prompt.actual_prompt stringThe optimized prompt actually used, returned when intelligent prompt rewriting is enabled. If this feature is not enabled, this field is not returned.url stringThe image URL address. It is returned only when task_status is SUCCEEDED. The link is valid for 24 hours, and you can download the image through this URL.codestringThe error code returned when the request fails. This parameter is not returned when the request succeeds. For more information, see Error codes.messagestringThe detailed error information returned when the request fails. This parameter is not returned when the request succeeds. For more information, see Error codes.objectThe task result statistics.
Properties TOTAL integerThe total number of tasks.SUCCEEDED integerThe number of tasks with a success status.FAILED integerThe number of tasks with a failure status.stringThe error code returned when the request fails. This parameter is not returned when the request succeeds. For more information, see Error codes.messagestringThe detailed error information returned when the request fails. This parameter is not returned when the request succeeds. For more information, see Error codes.objectOutput statistics. Only successful results are counted.
Properties image_count integerThe number of images successfully generated by the model. Billing formula: Cost = Number of images × Unit price.stringThe unique identifier of the request. It can be used for request tracing and troubleshooting. |
Image URLs are retained for only 24 hours and are automatically cleared after they expire. Save the generated images in a timely manner. |
DashScope Python SDK calls
The SDK parameter naming is basically the same as the HTTP API, and the parameter structure is encapsulated based on language features.
Since text-to-image tasks take a long time, the SDK encapsulates the HTTP asynchronous call process and supports both synchronous and asynchronous calling methods.
The actual time depends on the number of queued tasks and service execution. Please wait patiently when obtaining results.
wan2.6
The region and API key of each region are not interchangeable. The following examples use the Beijing region:
- China (Beijing)
- Singapore
- US (Virginia)
- Germany (Frankfurt)
https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1When calling, replace {WorkspaceId} with your actual workspace ID.The global deployment (Frankfurt region) supports only asynchronous calls.
- Synchronous call
- Asynchronous call
Request example
Response example
The URL is valid for 24 hours. Download the image in a timely manner.
wan2.5 and earlier models
The region and API key of each region are not interchangeable. The following examples use the Beijing region:
- China (Beijing)
- Singapore
https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1When calling, replace {WorkspaceId} with your actual workspace ID.- Synchronous call
- Asynchronous call
Request example
Response example
The URL is valid for 24 hours. Download the image in a timely manner.
DashScope Java SDK calls
The SDK parameter naming is basically the same as the HTTP API, and the parameter structure is encapsulated based on language features.
Since text-to-image tasks take a long time, the SDK encapsulates the HTTP asynchronous call process and supports both synchronous and asynchronous calling methods.
The actual time depends on the number of queued tasks and service execution. Please wait patiently when obtaining results.
wan2.6
The region and API key of each region are not interchangeable. The following examples use the Beijing region:
- China (Beijing)
- Singapore
- US (Virginia)
- Germany (Frankfurt)
https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1When calling, replace {WorkspaceId} with your actual workspace ID.The global deployment (Frankfurt region) supports only asynchronous calls.
- Synchronous call
- Asynchronous call
Request example
Response example
The URL is valid for 24 hours. Download the image in a timely manner.
wan2.5 and earlier models
The region and API key of each region are not interchangeable. The following examples use the Beijing region:
- China (Beijing)
- Singapore
https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1When calling, replace {WorkspaceId} with your actual workspace ID.- Synchronous call
- Asynchronous call
Request example
Response example
The URL is valid for 24 hours. Download the image in a timely manner.
Limitations
- Data retention: The task
task_idand imageurlare retained for only 24 hours and cannot be queried or downloaded after expiration. - Content moderation: Both the input
promptand the output image go through content safety moderation. Requests containing non-compliant content will return the "IPInfringementSuspect" or "DataInspectionFailed" error. For more information, see Error codes.
Billing and rate limiting
- For the model free quota and unit prices, see the Model Studio console.
- For model rate limits, see Wan.
- Billing description: You are billed for the number of images successfully generated. Failed model calls or processing errors incur no fees and do not consume the new user free quota.