Wan2.7-Image supports 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 | Wan 2.7 image Pro. Supports 4K output for text-to-image generation (not for image sets). | Image format: PNG. For image resolution and dimensions, see the size parameter. |
wan2.7-image | Wan 2.7 image. Faster generation. |
Prerequisites
Obtain an API key and export the API key as an environment variable.
HTTP synchronous
Returns the result in a single request. Recommended for most use cases.
- Singapore
- Beijing
POST https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generationReplace {WorkspaceId} with your actual workspace ID.Request parameters |
The wan2.7-image-pro model supports 4K resolution for text-to-image generation only. Image editing and image set generation support up to 2K resolution. |
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. | |
Request body | |
model string (Required)The model name. Valid values: wan2.7-image-pro, wan2.7-image. | |
input object (Required)The input object.
Properties messages array (Required)An array of request content. Only single-turn conversations are supported.
Properties role string (Required)The message role. Must be user.content array (Required)An array of message content.
Properties text stringThe text prompt. Supports Chinese and English. Maximum 5,000 characters. Each character, letter, number, or symbol counts as one. Excess characters are truncated.image stringThe URL or Base64-encoded string of the input image.Image limits:
| |
parameters object (Optional)Model parameter settings.
Properties bbox_list List[List[List[int]]] (Optional)The bounding box area for interactive editing.
boolean (Optional)Controls the image generation mode:
string (Optional)The output image resolution. Supports two mutually exclusive methods:Model: wan2.7-image-pro
The pixel values of the output image may have minor differences from the specified values.n int (Optional)
boolean (Optional)Enables thinking mode. Defaults to true. This parameter is effective only when image set mode is disabled and no image is input. When enabled, the model enhances its inference capabilities to improve output quality, but this increases generation time.color_palette array (Optional)A custom color theme. An array of objects, each with a hexadecimal color and a ratio. Must include 3 to 10 colors. 8 colors recommended.This is available only when image set mode is disabled (enable_sequential=false).
Properties hex string (Required)The color value in hexadecimal (HEX) format.ratio string (Required)The percentage of the color. Must be accurate to two decimal places (such as "25.00%"). The sum of all ratio values must be 100.00%.
Click to view an input example 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 information.
Properties choices arrayThe output content generated by the model.
Properties finish_reason stringThe reason the task stopped. stop indicates natural completion.message objectThe message returned by the model.
Properties role stringThe message role. Always assistant.content array
Properties type stringValue: image.image stringThe URL of the generated image. Format: PNG.The link is valid for 24 hours. Download the image promptly.booleanIndicates whether the task is finished. Default: false. | |
usage objectUsage statistics for the request. Only successful results are counted.
Properties image_count integerThe number of generated images.size stringThe resolution of the generated image. Example: 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_tokens integerThe total number of tokens (not billed). Billing is based on the number of images. | |
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
Best for long-running tasks. Submit a task, then poll for status and results.
Step 1: Create a task to get the task ID
- Singapore
- Beijing
POST https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/aigc/image-generation/generationReplace {WorkspaceId} with your actual workspace ID.Request parameters |
The wan2.7-image-pro model supports 4K resolution for text-to-image generation only. Image editing and image set generation support up to 2K resolution. |
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-Async string (Required)Enables asynchronous processing. HTTP requests support only asynchronous calls. Must be enable. | |
Request body | |
model string (Required)The model name. Valid values: wan2.7-image-pro, wan2.7-image. | |
input object (Required)The input object.
Properties messages array (Required)An array of request content. Only single-turn conversations are supported.
Properties role string (Required)The message role. Must be user.content array (Required)An array of message content.
Properties text stringThe text prompt. Supports Chinese and English. Maximum 5,000 characters. Each character, letter, number, or symbol counts as one. Excess characters are truncated.image stringThe URL or Base64-encoded string of the input image.Image limits:
| |
parameters object (Optional)Model parameter settings.
Properties bbox_list List[List[List[int]]] (Optional)The bounding box area for interactive editing.
boolean (Optional)Controls the image generation mode:
string (Optional)The output image resolution. Supports two mutually exclusive methods:Model: wan2.7-image-pro
The pixel values of the output image may have minor differences from the specified values.n int (Optional)
boolean (Optional)Enables thinking mode. Defaults to true. This parameter is effective only when image set mode is disabled and no image is input. When enabled, the model enhances its inference capabilities to improve output quality, but this increases generation time.color_palette array (Optional)A custom color theme. An array of objects, each with a hexadecimal color and a ratio. Must include 3 to 10 colors. 8 colors recommended.This is available only when image set mode is disabled (enable_sequential=false).
Properties hex string (Required)The color value in hexadecimal (HEX) format.ratio string (Required)The percentage of the color. Must be accurate to two decimal places (such as "25.00%"). The sum of all ratio values must be 100.00%.
Click to view an input example 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 information.
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 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 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. |
Headers | |
Authorization string (Required)Authenticates the request with a Model Studio API key. Example: Bearer sk-xxxx. | |
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 booleanIndicates whether the task is finished. Default: false.choices arrayThe output content generated by the model.
Properties finish_reason stringThe reason the task stopped. stop indicates natural completion.message objectThe message returned by the model.
Properties role stringThe message role. Always assistant.content array
Properties type stringValues: text, image.text stringThe generated text.image stringThe URL of the generated image. Format: PNG.The link is valid for 24 hours. Download the image promptly. | |
usage objectUsage statistics for the request. Only successful results are counted.
Properties image_count integerThe number of generated images.size stringThe resolution of the generated image. Example: 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_tokens integerThe total number of tokens (not billed). Billing is based on the number of images. | |
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. |
Python SDK
SDK parameter names are largely consistent with the HTTP API.
Image generation tasks can take time, so the SDK wraps the HTTP asynchronous workflow. Both synchronous and asynchronous calls are supported.
Task duration depends on queue length and service status.Both
base_url and API key are region-specific. The following example uses the Singapore region:
- 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.
Image set generation
- Synchronous call
- Asynchronous call
Request example
Response example
The URL is valid for 24 hours. Download the image promptly.
Java SDK
SDK parameter names are largely consistent with the HTTP API.
Image generation tasks can take time, so the SDK wraps the HTTP asynchronous workflow. Both synchronous and asynchronous calls are supported.
- 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. Save it promptly.
Image set generation
- Synchronous call
- Asynchronous call
Request example
Response example
The URL is valid for 24 hours. Save it promptly.
Billing and rate limiting
- For the model's free quota and unit price, see Model pricing.
- For model rate limiting, see Wanxiang.
- Billing details: You are billed based on the number of images successfully generated. Failed calls and processing errors do not incur charges or consume your free quota for new users.