Skip to main content
Wan - legacy video models

Wan - video editing (2.1)

The Wan 2.1 unified video editing model supports multiple input modalities, including text, images, and videos, for a wide range of video generation and editing tasks.

Related Documentation: user guide

Scope

To ensure successful calls, the model, endpoint URL, and API key must be in the same region. Cross-region calls will fail.
The sample code in this topic is for the Singapore region.
Alibaba Cloud Model Studio has released workspace-specific domains for the China (Beijing) and Singapore regions. The new dedicated domains deliver superior performance and higher stability for inference requests. We recommend migrating to the new domains:
  • China (Beijing): from https://dashscope.aliyuncs.com to https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com
  • Singapore: from https://dashscope-intl.aliyuncs.com to https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com
{WorkspaceId} is your workspace ID, which can be found on the Workspace Details page in the Alibaba Cloud Model Studio console. The existing domain remains fully functional.

HTTP call

The unified video editing model takes 5-10 minutes to process, so the API uses an asynchronous process with two core steps: "create task -> poll result".

Step 1: Create a task

  • Singapore
  • Beijing
POST https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesisReplace {WorkspaceId} with your actual workspace ID.

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-Async string (Required)Enables asynchronous processing. HTTP requests support only asynchronous calls. Must be enable.
If this request header is missing, the error "current user api does not support synchronous calls" is returned.
Request body
  • Multi-image reference
  • Video repainting
  • Local editing
  • Video extension
  • Video outpainting
model string (Required)The model name. Example: wan2.1-vace-plus.
input object (Required)The basic input, such as the prompt.

Properties

promptstring(Required)Describes the elements and visual features to include in the generated video.Supports both Chinese and English. The maximum length is 800 characters, where each Chinese character or letter counts as a single character. Text exceeding this limit is automatically truncated.For prompt techniques, see Text-to-Video/Image-to-Video Prompt Guide.functionstring(Required)Feature name. The multi-image reference is set to image_reference.Multi-image reference supports up to 3 reference images. The images can contain entities and backgrounds, such as people, animals, clothing, and scenes. Use a prompt to describe the desired video content, and the model can combine the multiple images to generate coherent video content.ref_images_urlarray[string] (Required)An array of reference image URLs.
  1. Public URL:
You can provide 1 to 3 reference images. If you provide more than 3, only the first 3 are used.Image requirements:
  • Format: JPG, JPEG, PNG, BMP, TIFF, or WEBP.
  • Resolution: The width and height must be within the range of [360, 2000] pixels.
  • Size: Up to 10 MB.
  • The URL must not contain Chinese characters.
Recommendations:
  • When using a reference image for an entity, we recommend that each image contain only one entity. The background should be a solid color (for example, white) to better highlight the entity.
  • If using a background from a reference image, you can provide at most one background image, which must not contain any entity objects.
parameters object (Optional)Parameters for video processing, such as watermark settings.

Properties

obj_or_bg array[string] (Optional)This parameter is used to identify the purpose of each reference image and corresponds one-to-one with the ref_images_url parameter. Each element in the array specifies whether the image at the corresponding position is a 'subject' or a 'background':
  • obj: Indicates that the image is the reference entity.
  • bg: Specifies the image as a background reference (a maximum of one is allowed).
Usage notes:
  • We recommend that you pass this parameter, and its length must be the same as that of ref_images_url or an error is reported.
  • This parameter can be omitted and defaults to ["obj"] only if ref_images_url is a single-element array.
Example: ["obj", "obj", "bg"].size string (Optional)The resolution of the generated video (width*height). The model supports generating 720p videos. Valid values:
  • 1280*720 (Default): The video aspect ratio is 16:9, where 1280 is the width and 720 is the height.
  • 720*1280: The video aspect ratio is 9:16.
  • 960*960: The video aspect ratio is 1:1.
  • 832*1088: The video aspect ratio is 3:4.
  • 1088*832: The video aspect ratio is 4:3.
duration integer (Optional)The duration of the generated video in seconds. This value is fixed at 5.prompt_extendbool (Optional)Specifies whether to enable prompt rewriting. If enabled, a large language model (LLM) rewrites the input prompt. This can significantly improve results for short prompts but increases processing time.
  • true (default): Enables prompt rewriting.
  • false: Disable prompt rewriting.
seedinteger(Optional)The random number seed controls the randomness of the content generated by the model. The value range for the seed parameter is [0, 2147483647].If you do not specify a seed, one is generated automatically. For reproducible results, use the same seed value across multiple requests.watermark bool(Optional)Specifies whether to add an 'AI-generated' watermark to the bottom-right corner of the image.
  • false (default): Does not add a watermark.
  • true: Adds a watermark.
  • Multi-image reference
  • Video repainting
  • Local editing
  • Video extension
  • Video outpainting
API keys for the Singapore and China (Beijing) regions are different. Obtain an API key
The following URL is for the Singapore region. For the China (Beijing) region, use this URL instead: https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis
# The following URL is for the Singapore region. When calling, replace {WorkspaceId} with your actual workspace ID. URLs vary by region.
curl --location 'https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis' \
--header 'X-DashScope-Async: enable' \
--header "Authorization: Bearer $DASHSCOPE_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
    "model": "wan2.1-vace-plus",
    "input": {
        "function": "image_reference",
        "prompt": "In the video, a girl gracefully emerges from a misty, ancient forest. Her steps are light, and the camera captures her every nimble moment. When she stops to look at the lush woods around her, a smile of surprise and joy blossoms on her face. This scene, frozen in an interplay of light and shadow, records her wonderful encounter with nature.",
        "ref_images_url": [
            "http://wanx.alicdn.com/material/20250318/image_reference_2_5_16.png",
            "http://wanx.alicdn.com/material/20250318/image_reference_1_5_16.png"
        ]
    },
    "parameters": {
        "prompt_extend": true,
        "obj_or_bg": ["obj","bg"],
        "size": "1280*720"
    }
}'

Response parameters

output objectThe output of the asynchronous task.

Properties

task_id stringThe task ID. Valid for queries for 24 hours.task_status stringThe status of the task.

Enumeration values

  • PENDING
  • RUNNING
  • SUCCEEDED
  • FAILED
  • CANCELED
  • UNKNOWN: The task does not exist or its status is unknown.
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.
  • Successful response
  • Error response
Save the task_id to query the task status and result.
{
    "output": {
        "task_status": "PENDING",
        "task_id": "0385dc79-5ff8-4d82-bcb6-xxxxxx"
    },
    "request_id": "4909100c-7b5a-9f92-bfe5-xxxxxx"
}

Step 2: Query result by task ID

  • Singapore
  • China (Beijing)
GET https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/tasks/{task_id}Replace {WorkspaceId} with your actual workspace ID.

Request parameters

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.
  • Query task result
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.
curl -X GET https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/tasks/{task_id} \
--header "Authorization: Bearer $DASHSCOPE_API_KEY"

Response parameters

outputobjectInformation about the task output.

Properties

task_id stringThe task ID. Valid for queries for 24 hours.task_status stringThe status of the task.

Enumeration values

  • PENDING
  • RUNNING
  • SUCCEEDED
  • FAILED
  • CANCELED
  • UNKNOWN: The task does not exist or its status is unknown.
submit_time 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.video_urlstringThe URL of the generated MP4 (H.264) video. This link is valid for 24 hours.orig_prompt stringThe original input prompt.actual_prompt stringThe prompt used for generation after prompt rewriting. This field is returned only if prompt rewriting is enabled.code stringError code. Returned only for failed requests. See Error codes.message stringDetailed error message. Returned only for failed requests. See Error codes.
usage objectStatistics for the task output. This is provided only for successful tasks.

Properties

video_duration integerThe duration of the generated video in seconds.video_ratio stringThe aspect ratio of the generated video. The value is always standard.video_count integerThe number of generated videos.
request_id stringUnique request identifier for tracing and troubleshooting.
  • Task succeeded
  • Task failed
Task data, including the task status and video URL, is available for 24 hours and is then automatically deleted. Save the generated video promptly.
{
    "request_id": "851985d0-fbba-9d8d-a17a-xxxxxx",
    "output": {
        "task_id": "208e2fd1-fcb4-4adf-9fcc-xxxxxx",
        "task_status": "SUCCEEDED",
        "submit_time": "2025-05-15 16:14:44.723",
        "scheduled_time": "2025-05-15 16:14:44.750",
        "end_time": "2025-05-15 16:20:09.389",
        "video_url": "https://dashscope-result-wlcb.oss-cn-wulanchabu.aliyuncs.com/xxx.mp4?xxxxxx",
        "orig_prompt": "In the video, a girl gracefully walks out from a misty, ancient forest. Her steps are light, and the camera captures her every nimble moment. When the girl stops and looks around at the lush woods, a smile of surprise and joy blossoms on her face. This scene, frozen in a moment of interplay between light and shadow, records her wonderful encounter with nature.",
        "actual_prompt": "A girl in a light-colored long dress slowly walks out from a misty, ancient forest, her steps as light as a dance. She has slightly curly long hair, a delicate face, and bright eyes. The camera follows her movements, capturing every nimble moment. When she stops, turns, and looks around at the lush woods, a smile of surprise and joy blossoms on her face. Sunlight filters through the leaves, casting mottled shadows and freezing this beautiful moment of harmony between human and nature. The style is a fresh and natural portrait, combining medium and full shots with a level perspective and slight camera movement."
    },
    "usage": {
        "video_duration": 5,
        "video_ratio": "standard",
        "video_count": 1
    }
}

Limitations

  • Data retention period: The task ID task_id and video URL video_url are retained for only 24 hours. After they expire, you can no longer query or download them.
  • Audio support: This feature currently generates only silent videos. To generate audio, use Speech Synthesis.

Error codes

If a model call fails with an error message, see Error codes for troubleshooting.

FAQ

Q: How to whitelist video storage domains?

A: Videos generated by models are stored in OSS. The API returns a temporary public URL. To configure a firewall whitelist for this download URL, note the following: The underlying storage may change dynamically. This topic does not provide a fixed OSS domain name whitelist to prevent access issues caused by outdated information. If you have security control requirements, contact your account manager to obtain the latest OSS domain name list.
Text Generation
Image Generation
  • FAQ
Audio
Realtime API
Text Embedding
Model Production