The Wan2.7 image generation and editing models support text-to-image, text-to-image-set, image-to-image-set, image editing, and multi-image reference generation.
Model Overview
Model | Description | Output Image Specifications |
|---|---|---|
wan2.7-image-pro | Wan2.7 image Pro supports 4K high-definition output for text-to-image (excluding image set generation) | Image format: PNG. For image resolution and dimensions, see the size parameter. |
wan2.7-image | Wan2.7 image, with faster generation speed |
Prerequisites
You must have obtained and configured an API Key and configured the API Key in environment variables. Replace DASHSCOPE_API_HOST in the sample code with the obtained API Host.
HTTP synchronous call
Results are returned in a single request, with a simple workflow. It is recommended for most scenarios.
- Singapore
- 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.Request parameters |
wan2.7-image-pro supports 4K resolution only in text-to-image scenarios; image editing and image set generation support up to 2K resolution |
Request Headers | |
Content-Typestring(Required)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 value: Bearer sk-xxxx. | |
Request Body | |
model string (Required)Model. Valid values: wan2.7-image-pro, wan2.7-image. | |
input object (Required)Basic input information.
property messages array (Required)Request content array. Currently, only single-round conversations are supported, that is, one set of role and content parameters is passed in; multi-round conversations are not supported.
property role string (Required)The role of the message. This parameter is fixed to user.content array (Required)Message content array.
property text stringThe prompt entered by the user. Both Chinese and English are supported, with a maximum length of 5,000 characters. Each Chinese character, letter, digit, or symbol counts as one character, and any part exceeding the limit is automatically truncated.image stringThe URL or Base64-encoded string of the input image.Image limits:
| |
parameters object (Optional)Model parameter configuration.
property bbox_list array[array[array[integer]]] (Optional)Bounding box regions for interactive editing.
boolean (Optional)Controls the image generation mode:
string (Optional)Parameter for the output image resolution. Two methods are supported and cannot be mixed:Model: wan2.7-image-pro
The pixel values of the output image may differ slightly from the specified pixel values.n integer (Optional)
boolean (Optional)Whether to enable thinking mode. The default is true (enabled). Only effective when group image mode is disabled and no image is input. When enabled, the model enhances its reasoning capability to improve image quality, but generation takes longer.color_palette array (Optional)Custom color theme. An array of objects containing color (hex) and ratio, which must include 3 to 10 colors, with 8 recommended.Only available when group image mode is disabled (enable_sequential=false).
property hex string (Required)Color value in hexadecimal (HEX) format.ratio string (required)The percentage occupied by the color, accurate to two decimal places (for example, "25.00%"). The sum of all ratio values must equal 100.00%.
Click to view input examples bool (optional)Whether to add a watermark identifier. The watermark appears in the lower-right corner of the image, with the fixed text "AI-generated".
integer (optional)Random number seed. Value range: [0,2147483647].Using the same seed parameter value keeps the generated content relatively stable. If not provided, the algorithm automatically uses a random number seed.Note: The model generation process is probabilistic. Even with the same seed, identical results are not guaranteed for each generation. |
Response parameters |
Task data (such as task status and image URLs) is retained for only 24 hours and is automatically deleted after it expires. Be sure to save the generated images in a timely manner. |
output objectTask output information.
property choices arrayThe output content generated by the model.
property finish_reason stringThe reason the task stopped. It is stop when the task stops naturally.message objectThe message returned by the model.
property role stringThe role of the message, fixed as assistant.contentarray
property type stringThe type of the output, fixed as image.image stringThe URL of the generated image. The image format is PNG.The link is valid for 24 hours. Download and save the image in a timely manner.booleanWhether the task has ended.
| |
usage objectOutput information statistics. Only successful results are counted.
property image_count integerThe number of generated images.size stringThe resolution of the generated image. Example value: 1376*768.input_tokens integerThe number of input tokens (not billed). Billing is based on the number of images.output_tokens integerThe number of output tokens (not billed). Billing is based on the number of images.total_tokensintegerThe total number of tokens (not billed). Billing is based on the number of images. | |
request_idstringThe unique identifier of the request. It can be used for tracing request details 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. |
HTTP asynchronous call
Suitable for time-consuming tasks. It supports querying task status and results.
Step 1: Create a task to obtain the task ID
- Singapore
- Beijing
POST https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/aigc/image-generation/generationWhen calling, replace {WorkspaceId} with your actual workspace ID.Request parameters |
wan2.7-image-pro supports 4K resolution only in text-to-image scenarios; image editing and image set generation support up to 2K resolution |
Request Headers | |
Content-Typestring(Required)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 value: Bearer sk-xxxx. | |
X-DashScope-Asyncstring(Required)Asynchronous processing configuration parameter. HTTP requests only support asynchronous processing, so this parameter must be set to enable. | |
Request Body | |
model string (Required)Model. Valid values: wan2.7-image-pro, wan2.7-image. | |
input object (Required)Basic input information.
property messages array (Required)Request content array. Currently, only single-round conversations are supported, that is, one set of role and content parameters is passed in; multi-round conversations are not supported.
property role string (Required)The role of the message. This parameter is fixed to user.content array (Required)Message content array.
property text stringThe prompt entered by the user. Both Chinese and English are supported, with a maximum length of 5,000 characters. Each Chinese character, letter, digit, or symbol counts as one character, and any part exceeding the limit is automatically truncated.image stringThe URL or Base64-encoded string of the input image.Image limits:
| |
parameters object (Optional)Model parameter configuration.
property bbox_list array[array[array[integer]]] (Optional)Bounding box regions for interactive editing.
boolean (Optional)Controls the image generation mode:
string (Optional)Parameter for the output image resolution. Two methods are supported and cannot be mixed:Model: wan2.7-image-pro
The pixel values of the output image may differ slightly from the specified pixel values.n integer (Optional)
boolean (Optional)Whether to enable thinking mode. The default is true (enabled). Only effective when group image mode is disabled and no image is input. When enabled, the model enhances its reasoning capability to improve image quality, but generation takes longer.color_palette array (Optional)Custom color theme. An array of objects containing color (hex) and ratio, which must include 3 to 10 colors, with 8 recommended.Only available when group image mode is disabled (enable_sequential=false).
property hex string (Required)Color value in hexadecimal (HEX) format.ratio string (required)The percentage occupied by the color, accurate to two decimal places (for example, "25.00%"). The sum of all ratio values must equal 100.00%.
Click to view input examples bool (optional)Whether to add a watermark identifier. The watermark appears in the lower-right corner of the image, with the fixed text "AI-generated".
integer (optional)Random number seed. Value range: [0,2147483647].Using the same seed parameter value keeps the generated content relatively stable. If not provided, the algorithm automatically uses a random number seed.Note: The model generation process is probabilistic. Even with the same seed, identical results are not guaranteed for each generation. |
Response parameters |
Save the task_id, which is used to query the task status and results. |
output objectTask output information.
property task_id stringThe task ID. The validity period for queries is 24 hours.task_status stringThe task status.
Enumerated values
| |
request_idstringThe unique identifier of the request. It can be used for tracing request details 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. |
Step 2: Query the result by task ID
- Singapore
- Beijing
GET https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/tasks/{task_id}Request parameters |
Replace {task_id} with the value of task_id returned by the API in the previous step. task_id is valid for queries for 24 hours. Replace {WorkspaceId} with the actual Workspace ID. |
Request Headers | |
Authorizationstring(Required)Request authentication. The API uses an Alibaba Cloud Model Studio API Key for authentication. Example value: Bearer sk-xxxx. | |
URL Path Parameters | |
task_id string(Required)The node ID. |
Response parameters |
Task data (such as task status and image URLs) is retained for only 24 hours and is automatically deleted after it expires. Be sure to save the generated images in a timely manner. |
output objectTask output information.
property task_id stringThe task ID. The validity period for queries is 24 hours.task_status stringThe task status.
Enumerated values
stringThe time when the node was submitted. The time zone is UTC+8, in the format YYYY-MM-DD HH:mm:ss.SSS.scheduled_time stringThe node execution time. The time zone is UTC+8, in the format YYYY-MM-DD HH:mm:ss.SSS.end_time stringThe time when the node was completed. The time zone is UTC+8, in the format YYYY-MM-DD HH:mm:ss.SSS.finished booleanWhether the task has ended.
arrayThe output content generated by the model.
property finish_reason stringThe reason the node stopped; stop when it stops naturally.message objectThe message returned by the model.
property role stringThe role of the message, fixed as assistant.contentarray
property type stringThe type of the output. Enumerated values: text and image.text stringThe generated text.image stringThe URL of the generated image. The image format is PNG.The link is valid for 24 hours. Download and save the image in a timely manner. | |
usage objectOutput information statistics. Only successful results are counted.
property image_count integerThe number of generated images.size stringThe resolution of the generated image. Example value: 1376*768.input_tokens integerThe number of input tokens (not billed). Billing is based on the number of images.output_tokens integerThe number of output tokens (not billed). Billing is based on the number of images.total_tokensintegerThe total number of tokens (not billed). Billing is based on the number of images. | |
request_idstringThe unique identifier of the request. It can be used for tracing request details 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. |
Python SDK calls
SDK parameter naming is basically the same as that of the HTTP API.
Nodes may take a long time. The SDK has encapsulated the HTTP asynchronous call process and supports both synchronous and asynchronous calls.
The actual duration depends on the number of queued nodes and service execution. Please wait patiently when obtaining the results.The
base_url and API Key of each region are not interchangeable. The following examples use the Singapore region as an example:
- Singapore
- China (Beijing)
https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1When calling, replace {WorkspaceId} with your actual Workspace ID.Image editing
- Synchronous call
- Asynchronous call
Request example
Response example
The URL is valid for 24 hours. Download the image promptly.
Sequential image generation
- Synchronous call
- Asynchronous call
Request example
Response example
The URL is valid for 24 hours. Download the image promptly.
Java SDK calls
SDK parameter naming is basically the same as that of the HTTP API.
Nodes may take a long time. The SDK has encapsulated the HTTP asynchronous call process and supports both synchronous and asynchronous calls.
- Singapore
- China (Beijing)
https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1When calling, replace {WorkspaceId} with your actual Workspace ID.Image editing
- Synchronous call
- Asynchronous call
Request example
Response example
The URL is valid for 24 hours. Download and save the images in a timely manner.
Sequential image generation
- Synchronous call
- Asynchronous call
Request example
Response example
The URL is valid for 24 hours. Download and save the images in a timely manner.
Billing and rate limits
- For the free quota and unit prices of the model, see Model price.
- For model rate limits, see Wan.
- Billing: You are billed based on the number of images successfully generated. Failed model calls or processing errors incur no fees and do not consume the free quota for new users.