Wan3.0 is an All-in-One reference-based video generation model that supports Text-to-Video , Image-to-Video (first frame/first-last frame), and Reference-based Video Generation . It can generate videos up to 30 seconds long at 30fps. Currently in preview .
For the usage guide, see Wan3.0 - Video Generation.
To ensure a successful API call, make sure that the model, Endpoint URL and API Key all belong to the same region. Cross-region calls will fail.
Since video generation tasks take a relatively long time (typically 1-5 minutes), the API uses asynchronous calls. The entire process consists of two core steps: "Create a task -> Poll for results", as described below:
Replace
Text-to-Video: Only pass in
Image-to-Video, Reference-based Video Generation, Video Editing, Video Extension, and other modes require passing in materials through the
Wan3.0's first frame/first-last frame mode only supports
Prerequisites
To ensure a successful API call, make sure that the model, Endpoint URL and API Key all belong to the same region. Cross-region calls will fail.
- Select a model: Go to the Model Gallery to select a model and confirm the region it belongs to.
- Select a URL: Select the Endpoint URL for the corresponding region.
- Configure API Key: Select a region and Obtain an API key, then Configure API key as an environment variable.
The sample code in this topic applies to the Singapore region.
HTTP call
Since video generation tasks take a relatively long time (typically 1-5 minutes), the API uses asynchronous calls. The entire process consists of two core steps: "Create a task -> Poll for results", as described below:
Step 1: Create a task and obtain the task ID
- Singapore
- Beijing
- US (Virginia)
- Japan (Tokyo)
- Germany (Frankfurt)
- China (Hong Kong)
POST https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis{WorkspaceId} with your actual workspace ID.
- After the task is created successfully, use the
task_idreturned by the API to query the result. The task_id is valid for 24 hours. Do not create duplicate tasks; polling is sufficient to obtain the result. - For beginner guidance, see Postman.
Request parametersRequest headers (Headers)Content-Typestring (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)Asynchronous processing configuration parameter. HTTP requests only support asynchronous mode, and it must be set to enable.Request body (Request Body)modelstring (Required)Model name. Valid values:
object (Required)Basic input information. Either prompt or media must be provided.
Properties prompt string (Conditionally required)Text prompt used to describe the desired video content. Either this or media must be provided.Supports both Chinese and English. Each Chinese character or letter counts as one character, with a maximum of 20,000 characters. Content exceeding this limit will be automatically truncated.In reference mode, you can use "Image 1", "Video 1", etc. in the prompt to refer to media assets in the corresponding order within the media array.media array (Conditionally required)Media asset array that supports images, videos, audio, files, and web pages as input. Either this or prompt must be provided.
Properties type string (Required)Media asset type. Valid values:
string (Required)Media asset URL or Base64 encoded data.
Input image (type=first_frame / last_frame / reference_image) Image URL or Base64 encoded data.Image limits:
Input video (type=reference_video) Reference video URL.Video limits:
Input audio (type=reference_audio) Reference audio URL.Audio limits:
Input file (type=file) File URL.File limits:
Input web link (type=link) URL of a public web page. Only supports parsing publicly accessible web pages that do not require login (such as news, blogs, public accounts, etc.).Supported input formats:
object (Optional)Video processing parameters.
Properties resolution string (Optional)Resolution tier of the generated video. Default value: 1080P. Valid values:
string (Optional)Aspect ratio of the generated video. Valid values:
integer (Optional)Duration of the generated video, in seconds. Default value: 5.
boolean (Optional)Whether the output video contains audio.
integer (Optional)Random seed. Used to reproduce generation results. Value range: -1 or [0, 2147483647]. When set to -1 or not specified, the system automatically generates a random seed. Even with the same seed value, generation results may not be perfectly identical.prompt_extend boolean (Optional)Whether to enable intelligent prompt rewriting. When enabled, a large language model rewrites the input prompt. This significantly improves generation quality for shorter prompts, but increases latency.
boolean (Optional)Whether to add a watermark.
|
Pass in a file through the file type, and the model automatically understands the file content to generate a video. |
Response parametersoutputobjectTask output information.
Properties task_id stringThe task ID. Valid for queries for 24 hours.task_status stringThe status of the task.
Enumeration values
stringUnique request identifier for tracing and troubleshooting.codestringError code. Returned only for failed requests. See Error codes.messagestringDetailed error message. Returned only for failed requests. See Error codes. |
Save the task_id for querying the task status and results. |
Step 2: Query results by task ID
- Singapore
- Beijing
- US (Virginia)
- Japan (Tokyo)
- Germany (Frankfurt)
- China (Hong Kong)
GET https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/tasks/{task_id}- Polling recommendation: Video generation takes several minutes. We recommend using a polling mechanism with a reasonable query interval (for example, 15 seconds) to obtain the result.
- Task status transitions: PENDING (Queuing) → RUNNING (Processing) → SUCCEEDED (Success) / FAILED (Failed).
- Result link: After the task succeeds, a video link is returned and is valid for 24 hours. We recommend downloading the video immediately after obtaining the link and transferring it to permanent storage (such as Alibaba Cloud OSS).
- task_id validity: 24 hours. After the timeout, the result can no longer be queried, and the API will return the task status
UNKNOWN.
Request parametersRequest headers (Headers)Authorizationstring (Required)Authenticates the request with a Model Studio API key. Example: Bearer sk-xxxx.URL path parameters (Path parameters)task_idstring (Required)The ID of the task. |
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. |
Response parametersoutputobjectTask output information.
Properties task_id string (Required)The ID of the task.task_status stringThe status of the task.
Enumeration values
stringTask submission time. The time zone is UTC+8, in the format YYYY-MM-DD HH:mm:ss.SSS.scheduled_time stringTask execution time. The time zone is UTC+8, in the format YYYY-MM-DD HH:mm:ss.SSS.end_time stringTask completion time. The time zone is UTC+8, in the format YYYY-MM-DD HH:mm:ss.SSS.orig_prompt stringThe original input prompt.video_url stringThe URL of the generated video. Returned when the task succeeds. The video format is MP4 (H.264 encoding).codestringError code. Returned only for failed requests. See Error codes.messagestringDetailed error message. Returned only for failed requests. See Error codes.objectOutput statistics. Only successful results are counted.
Properties served_model stringThe model that actually provides the service, used for metering and billing. Billing is calculated based on the model returned by this field. This field is returned and always has a value when the requested model is a Prime model: wan3.0-video-prime when no downgrade occurs, or wan3.0-video when a downgrade occurs.video_count integerThe number of generated videos. Fixed at 1.duration floatThe total video duration in seconds. When no reference video is input, it equals the output video duration; when a reference video is input, it equals the sum of the input video duration and the output video duration.SR integerThe resolution of the generated video. Example value: 720.output_video_duration floatThe duration of the output video, in seconds.input_video_duration floatThe duration of the input video, in seconds. When no video is input, the value is 0.0.fps integerThe frame rate of the generated video. The default value is 30.ratio stringThe aspect ratio of the generated video. Example value: 16:9.stringUnique request identifier for tracing and troubleshooting. |
The video URL is retained for only 24 hours and will be automatically cleared after the timeout. Save the generated video in a timely manner. |
Material combinations
Only the following specific material combinations are supported. Passing in other combinations will result in an error.
prompt. media is not supported.
media array, with each element specifying type and url. type combination rules:
first_frame/last_frameandreference_image/reference_video/reference_audio/file/linktypes are mutually exclusive and cannot be used together in the same request.fileandlinkare mutually exclusive (choose one), but both can be combined withreference_image/reference_video/reference_audio.reference_image/reference_video/reference_audiocan be freely combined with each other.
FAQ
Why can't I pass in audio or other media assets in first/first-last frame mode?
Wan3.0's first frame/first-last frame mode only supports first_frame and last_frame, and cannot accept other types such as audio at the same time (see Material combinations).
Difference from Wan2.7 Image-to-Video series: Wan2.7's first frame/first-last frame mode supports passing in driving_audio for audio-driven generation; Wan3.0's first frame/first-last frame mode does not. If you need audio-driven generation, use the all-modal reference mode (reference_image + reference_audio combination) instead. For specific usage, see Wan3.0 - Video Generation Guide.