Skip to content

Wan - text-to-video API reference

The Wan text-to-video model generates smooth videos from text prompts. References : User guide

Availability

Match the region for your model, endpoint URL, and API key. Cross-region calls fail.

  • Select a model: Verify model availability in your target region.

  • Select a URL: Use the endpoint URL for the corresponding region. HTTP and HTTPS are both supported.

  • Configure an API key : Select a region, get an API key, and configure it in environment variables.

  • Install the SDK : To call the API through an SDK, install the DashScope SDK.

Note

Sample code in this topic uses the Singapore region.

HTTP (wan2.7)

Important

This interface uses the new protocol and supports only wan2.7.

Text-to-video tasks take 1--5 minutes. The API uses asynchronous invocation: Create a task → Poll for the result.

Step 1: Create a task

Beijing

POST https://dashscope.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis

Singapore

POST https://dashscope-intl.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis

Singapore

POST https://dashscope-intl.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis

Beijing

POST https://dashscope.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesisNote

  • After the task is created, use the returned task_id to query the result. The task_id is valid for 24 hours. Do not create duplicate tasks. Instead, use polling to retrieve the result.

  • For guidance for beginners, see Postman.

Request parameters

## Multi-shot narrative

Control shot structure with natural language in the prompt. The shot_type parameter has no effect.

  • Single shot: Input "Generate a single-shot video".
  • Multi-shot: Input "Generate a multi-shot video" or describe shots with timestamps (e.g., "Shot 1 [0--3 seconds] wide shot: Rainy New York street at night").
  • Default: If unspecified, the model interprets the prompt content.
curl
curl --location 'https://dashscope-intl.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis' \\
 -H 'X-DashScope-Async: enable' \\
 -H "Authorization: Bearer $DASHSCOPE_API_KEY" \\
 -H 'Content-Type: application/json' \\
 -d '{
 "model": "wan2.7-t2v",
 "input": {
 "prompt": "A tense detective story with cinematic storytelling. Shot 1 \[0--3 seconds\] wide shot: Rainy New York street at night, neon lights flicker, a detective in a black trench coat walks briskly. Shot 2 \[3--6 seconds\] medium shot: The detective enters an old building, rain wets his coat, the door closes slowly behind him. Shot 3 \[6--9 seconds\] close-up: The detective's focused eyes, distant sirens sound, he frowns slightly. Shot 4 \[9--12 seconds\] medium shot: The detective moves carefully down a dim hallway, his flashlight illuminating the way. Shot 5 \[12--15 seconds\] close-up: The detective discovers a key clue, his face shows sudden realization."
 },
 "parameters": {
 "resolution": "720P",
 "ratio": "16:9",
 "prompt_extend": true,
 "watermark": true,
 "duration": 15
 }
 }'

## Provide an audio file

Specify a custom audio file URL in the input.audio_url parameter.

curl
curl --location 'https://dashscope-intl.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis' \\
 -H 'X-DashScope-Async: enable' \\
 -H "Authorization: Bearer $DASHSCOPE_API_KEY" \\
 -H 'Content-Type: application/json' \\
 -d '{
 "model": "wan2.7-t2v",
 "input": {
 "prompt": "An epic and cute scene. A small, adorable cartoon kitten general, wearing exquisitely detailed golden armor and a slightly oversized helmet, stands bravely on a cliff. He rides a small but heroic warhorse and says: 'The long clouds of Qinghai darken the snowy mountains, a lone city gazes at Yumen Pass from afar. Through a hundred battles in the yellow sand, the golden armor is worn, but we will not return until we have broken Loulan'. Below the cliff, a vast and endless army of mice with makeshift weapons is charging forward. This is a dramatic, large-scale battle scene inspired by ancient Chinese war epics. In the distance, dark clouds gather in the sky over the snowy mountains. The overall atmosphere is a comical and epic fusion of 'cute' and 'domineering'.",
 "audio_url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250923/hbiayh/%E4%BB%8E%E5%86%9B%E8%A1%8C.mp3"
 },
 "parameters": {
 "resolution": "1080P",
 "ratio": "16:9",
 "prompt_extend": true,
 "duration": 10
 }
 }'

## Automatic dubbing

Without input.audio_url, the model generates background music or sound effects that match the video content.

curl
curl --location 'https://dashscope-intl.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis' \\
 -H 'X-DashScope-Async: enable' \\
 -H "Authorization: Bearer $DASHSCOPE_API_KEY" \\
 -H 'Content-Type: application/json' \\
 -d '{
 "model": "wan2.7-t2v",
 "input": {
 "prompt": "An epic and cute scene. A small, adorable cartoon kitten general, wearing exquisitely detailed golden armor and a slightly oversized helmet, stands bravely on a cliff. He rides a small but heroic warhorse and says: 'The long clouds of Qinghai darken the snowy mountains, a lone city gazes at Yumen Pass from afar. Through a hundred battles in the yellow sand, the golden armor is worn, but we will not return until we have broken Loulan'. Below the cliff, a vast and endless army of mice with makeshift weapons is charging forward. This is a dramatic, large-scale battle scene inspired by ancient Chinese war epics. In the distance, dark clouds gather in the sky over the snowy mountains. The overall atmosphere is a comical and epic fusion of 'cute' and 'domineering'."
 },
 "parameters": {
 "resolution": "720P",
 "ratio": "16:9",
 "prompt_extend": true,
 "duration": 10
 }
 }'

## Use a negative prompt

Use negative_prompt to exclude the "flower" element and prevent it from appearing in the video.

curl
curl --location 'https://dashscope-intl.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis' \\
 -H 'X-DashScope-Async: enable' \\
 -H "Authorization: Bearer $DASHSCOPE_API_KEY" \\
 -H 'Content-Type: application/json' \\
 -d '{
 "model": "wan2.7-t2v",
 "input": {
 "prompt": "A kitten running in the moonlight",
 "negative_prompt": "flower"
 },
 "parameters": {
 "resolution": "720P",
 "ratio": "16:9"
 }
 }'
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.

**

**Important ** If this request header is missing, the error "current user api does not support synchronous calls" is returned.

Request body

model *string* (Required) Model name. For models and pricing, see Model pricing. Example: wan2.7-t2v.

input *object* (Required) Input data, including the prompt. Properties

prompt *string* (Required) Text prompt describing the video content and visual style. Supports Chinese and English. Each character or letter counts as one. Text beyond the limit is auto-truncated. Maximum length by model:

  • wan2.7-t2v: Up to 5,000 characters. Example: A kitten running in the moonlight. For tips, see Text-to-video/image-to-video prompt guide.

negative_prompt *string* (Optional) Elements to exclude from the generated video. Supports Chinese and English. Maximum 500 characters; longer text is auto-truncated. Example: low resolution, error, worst quality, low quality, deformed, extra fingers, bad proportions.

audio_url *string* (Optional) URL of the audio file for video generation. Supported formats:

  • Public URL: <li> HTTP and HTTPS protocols.

  • Example: https://help-static-aliyun-doc.aliyuncs.com/xxx.mp3. </li> Audio limits:

  • Format: WAV, MP3.

  • Duration: 2--30 seconds.

  • File size: Up to 15 MB.

  • Duration handling: If the audio exceeds the duration value (for example, 5 seconds), only the first 5 seconds are used. If the audio is shorter than the video, the remaining video is silent. For example, 3-second audio with a 5-second video produces 3 seconds of audio followed by 2 seconds of silence.

parameters *object* (Optional) Video generation parameters: resolution, prompt rewriting, and watermark. Properties

resolution *string* (Optional)

**

**Important ** Resolution affects cost. Check Model pricing before calling.

Resolution tier of the generated video. Controls the output clarity (total pixel count).

  • wan2.7-t2v: Valid values: 720P, 1080P. Default: 1080P.

ratio *string* (Optional) Aspect ratio of the output video.

  • 16:9 (default)
  • 9:16
  • 1:1
  • 4:3
  • 3:4 Output resolutions (width*height) by aspect ratio:
Resolution tierAspect ratioOutput video resolution (width*height)
720P16:91280*720
9:16720*1280
1:1960*960
4:31104*832
3:4832*1104
1080P16:91920*1080
9:161080*1920
1:11440*1440
4:31648*1248
3:41248*1648

duration *integer* (Optional)

**

**Important ** Duration affects cost. Billing is per second. Check Model pricing before calling.

Duration of the output video, in seconds.

  • wan2.7-t2v: An integer from 2 to 15. Default: 5.

**prompt_extend ***boolean* (Optional) Enables prompt rewriting. When enabled, an LLM rewrites the input prompt to improve generation quality. Best for short prompts but adds latency.

  • true (default)
  • false

watermark *boolean* (Optional) Adds a watermark in the lower-right corner with the text "AI Generated".

  • false (default)
  • true

seed *integer* (Optional) The random number seed must be an integer in the range \[0, 2147483647\]. If not specified, a random seed is generated. A fixed seed improves reproducibility. Because model generation is probabilistic, the same seed does not guarantee identical results.

Response parameters

Successful response

Save the task_id to query the task status and result.

json
{
 "output": {
 "task_status": "PENDING",
 "task_id": "0385dc79-5ff8-4d82-bcb6-xxxxxx"
 },
 "request_id": "4909100c-7b5a-9f92-bfe5-xxxxxx"
}

Error response

Task creation failed. See Error messages.

json
{
 "code": "InvalidApiKey",
 "message": "No API-key provided.",
 "request_id": "7438d53d-6eb8-4596-8835-xxxxxx"
}
     **output** `*object*` Task output.

Properties

task_id *string* The task ID. Valid for queries for 24 hours.

task_status *string* The status of the task. Enumeration values

  • PENDING
  • RUNNING
  • SUCCEEDED
  • FAILED
  • CANCELED
  • UNKNOWN: The task does not exist or its status is unknown.

request_id *string* Unique request identifier for tracing and troubleshooting.

code *string* Error code. Returned only for failed requests. See Error messages.

message *string* Detailed error message. Returned only for failed requests. See Error messages.

Step 2: Query the result

Beijing

GET https://dashscope.aliyuncs.com/api/v1/tasks/{task_id}

Singapore

GET https://dashscope-intl.aliyuncs.com/api/v1/tasks/{task_id}

Singapore

GET https://dashscope-intl.aliyuncs.com/api/v1/tasks/{task_id}

Beijing

GET https://dashscope.aliyuncs.com/api/v1/tasks/{task_id}Note

  • Polling recommendation: Video generation takes several minutes. Use a polling mechanism with a reasonable interval, such as 15 seconds.

  • Task state transition: PENDING → RUNNING → SUCCEEDED or FAILED.

  • Result link : After a task succeeds, a video URL valid for 24 hours is returned. Download and save the video to permanent storage, such as OSS.

  • task_id****validity : 24 hours . After this period, queries return the task status as UNKNOWN.

Request parameters

## 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.

curl
curl -X GET https://dashscope-intl.aliyuncs.com/api/v1/tasks/{task_id} \\
--header "Authorization: Bearer $DASHSCOPE_API_KEY"
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 executed successfully

Video URLs are valid for only 24 hours and then automatically purged. Save generated videos promptly.

json
{
 "request_id": "caa62a12-8841-41a6-8af2-xxxxxx",
 "output": {
 "task_id": "eff1443c-ccab-4676-aad3-xxxxxx",
 "task_status": "SUCCEEDED",
 "submit_time": "2025-09-29 14:18:52.331",
 "scheduled_time": "2025-09-29 14:18:59.290",
 "end_time": "2025-09-29 14:23:39.407",
 "orig_prompt": "An epic and cute scene. A small, adorable cartoon kitten general, wearing exquisitely detailed golden armor and a slightly oversized helmet, stands bravely on a cliff. He rides a small but heroic warhorse and says: 'The long clouds of Qinghai darken the snowy mountains, a lone city gazes at Yumen Pass from afar. Through a hundred battles in the yellow sand, the golden armor is worn, but we will not return until we have broken Loulan'. Below the cliff, a vast and endless army of mice with makeshift weapons is charging forward. This is a dramatic, large-scale battle scene inspired by ancient Chinese war epics. In the distance, dark clouds gather in the sky over the snowy mountains. The overall atmosphere is a comical and epic fusion of 'cute' and 'domineering'.",
 "video_url": "https://dashscope-result-sh.oss-accelerate.aliyuncs.com/xxx.mp4?Expires=xxx"
 },
 "usage": {
 "duration": 10,
 "input_video_duration": 0,
 "output_video_duration": 10,
 "video_count": 1,
 "ratio": "16:9",
 "SR": 720
 }
}

## Task execution failed

When a task fails, task_status is FAILED with an error code and message. See Error messages.

json
{
 "request_id": "e5d70b02-ebd3-98ce-9fe8-759d7d7b107d",
 "output": {
 "task_id": "86ecf553-d340-4e21-af6e-a0c6a421c010",
 "task_status": "FAILED",
 "code": "InvalidParameter",
 "message": "The size does not match xxxxxx"
 }
}

## Task query expired

The task_id is valid for 24 hours. After this period, queries return the following error.

json
{
 "request_id": "a4de7c32-7057-9f82-8581-xxxxxx",
 "output": {
 "task_id": "502a00b1-19d9-4839-a82f-xxxxxx",
 "task_status": "UNKNOWN"
 }
}
     **output **`*object*`* * Task output.

Properties

task_id *string* The task ID. Valid for queries for 24 hours.

task_status *string* The status of the task. Enumeration values

  • PENDING
  • RUNNING
  • SUCCEEDED
  • FAILED
  • CANCELED
  • UNKNOWN: The task does not exist or its status is unknown.

State transitions during polling:

  • PENDING → RUNNING → SUCCEEDED or FAILED.
  • The initial query status is usually PENDING or RUNNING.
  • When the status changes to SUCCEEDED, the response contains the generated video URL.
  • If the status is FAILED, check the error message and retry the task.

submit_time *string* The 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 *string* The 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 *string* The time when the task was completed. The time is in UTC+8 and the format is YYYY-MM-DD HH:mm:ss.SSS.

video_url *string* URL of the generated video. Returned only when task_status is SUCCEEDED. Valid for 24 hours. The video is in MP4 format with H.264 encoding.

orig_prompt *string* The original input prompt, corresponding to the request parameter prompt.

code *string* Error code. Returned only for failed requests. See Error messages.

message *string* Detailed error message. Returned only for failed requests. See Error messages.

usage *object* Output statistics. Returned only for successful tasks. Properties

duration *float* Total video duration, used for billing. Equal to output_video_duration.

input_video_duration *integer* Fixed value: 0.

output_video_duration *integer* Output video duration in seconds. Matches the input.duration value.

SR *integer* Resolution tier of the output video. Example: 720.

ratio *string* Aspect ratio of the output video. Example: 16:9.

video_count *integer* Number of videos generated. Always 1.

request_id *string* Unique request identifier for tracing and troubleshooting.

HTTP (wan2.6 and earlier)

Important

This interface uses the legacy protocol and supports wan2.6 and earlier (wan2.5/wan2.2/ wan2.1**)**.

Text-to-video tasks take 1--5 minutes, so the API uses asynchronous invocation: Create a task → Poll for the result.

Step 1: Create a task

Beijing

POST https://dashscope.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis

Singapore

POST https://dashscope-intl.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis

Virginia

POST https://dashscope-us.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis

Singapore

POST https://dashscope-intl.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis

Virginia

POST https://dashscope-us.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis

Beijing

POST https://dashscope.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis

Frankfurt

POST https://++.eu-central-1.maas.aliyuncs.com/++api/v1/services/aigc/video-generation/video-synthesis

When calling the API, replace WorkspaceId with your actual Workspace ID. Note

  • After the task is created, use the returned task_id to query the result. The task_id is valid for 24 hours. Do not create duplicate tasks. Instead, use polling to retrieve the result.

  • For guidance for beginners, see Postman.

Request parameters

## Multi-shot narrative

  • To create a multi-shot narrative, set shot_type to "multi".
  • Set prompt_extend to true to enable prompt rewriting for storyboard optimization.
curl
curl --location 'https://dashscope-intl.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis' \\
 -H 'X-DashScope-Async: enable' \\
 -H "Authorization: Bearer $DASHSCOPE_API_KEY" \\
 -H 'Content-Type: application/json' \\
 -d '{
 "model": "wan2.6-t2v",
 "input": {
 "prompt": "Shot from a low angle, in a medium close-up, with warm tones, mixed lighting (the practical light from the desk lamp blends with the overcast light from the window), side lighting, and a central composition. In a classic detective office, wooden bookshelves are filled with old case files and ashtrays. A green desk lamp illuminates a case file spread out in the center of the desk. A fox, wearing a dark brown trench coat and a light gray fedora, sits in a leather chair, its fur crimson, its tail resting lightly on the edge, its fingers slowly turning yellowed pages. Outside, a steady drizzle falls beneath a blue sky, streaking the glass with meandering streaks. It slowly raises its head, its ears twitching slightly, its amber eyes gazing directly at the camera, its mouth clearly moving as it speaks in a smooth, cynical voice: \\"The case was cold, colder than a fish in winter. But every chicken has its secrets, and I, for one, intended to find them \\".",
 "audio_url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250929/stjqnq/%E7%8B%90%E7%8B%B8.mp3"
 },
 "parameters": {
 "size": "1280*720",
 "prompt_extend": true,
 "duration": 10,
 "shot_type":"multi"
 }
 }'

## Pass an audio file

Supported models: wan2.6 and wan2.5 series. Set the input.audio_url parameter to a custom audio file URL.

curl
curl --location 'https://dashscope-intl.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis' \\
 -H 'X-DashScope-Async: enable' \\
 -H "Authorization: Bearer $DASHSCOPE_API_KEY" \\
 -H 'Content-Type: application/json' \\
 -d '{
 "model": "wan2.5-t2v-preview",
 "input": {
 "prompt": "Shot from a low angle, in a medium close-up, with warm tones, mixed lighting (the practical light from the desk lamp blends with the overcast light from the window), side lighting, and a central composition. In a classic detective office, wooden bookshelves are filled with old case files and ashtrays. A green desk lamp illuminates a case file spread out in the center of the desk. A fox, wearing a dark brown trench coat and a light gray fedora, sits in a leather chair, its fur crimson, its tail resting lightly on the edge, its fingers slowly turning yellowed pages. Outside, a steady drizzle falls beneath a blue sky, streaking the glass with meandering streaks. It slowly raises its head, its ears twitching slightly, its amber eyes gazing directly at the camera, its mouth clearly moving as it speaks in a smooth, cynical voice: \\"The case was cold, colder than a fish in winter. But every chicken has its secrets, and I, for one, intended to find them \\".",
 "audio_url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250929/stjqnq/%E7%8B%90%E7%8B%B8.mp3"
 },
 "parameters": {
 "size": "832*480",
 "prompt_extend": true,
 "duration": 10
 }
 }'

## Automatic dubbing

Supported models: wan2.6 and wan2.5 series. Without the input.audio_url parameter, the model generates background music or sound effects that match the video content.

curl
curl --location 'https://dashscope-intl.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis' \\
 -H 'X-DashScope-Async: enable' \\
 -H "Authorization: Bearer $DASHSCOPE_API_KEY" \\
 -H 'Content-Type: application/json' \\
 -d '{
 "model": "wan2.5-t2v-preview",
 "input": {
 "prompt": "Shot from a low angle, in a medium close-up, with warm tones, mixed lighting (the practical light from the desk lamp blends with the overcast light from the window), side lighting, and a central composition. In a classic detective office, wooden bookshelves are filled with old case files and ashtrays. A green desk lamp illuminates a case file spread out in the center of the desk. A fox, wearing a dark brown trench coat and a light gray fedora, sits in a leather chair, its fur crimson, its tail resting lightly on the edge, its fingers slowly turning yellowed pages. Outside, a steady drizzle falls beneath a blue sky, streaking the glass with meandering streaks. It slowly raises its head, its ears twitching slightly, its amber eyes gazing directly at the camera, its mouth clearly moving as it speaks in a smooth, cynical voice: \\"The case was cold, colder than a fish in winter. But every chicken has its secrets, and I, for one, intended to find them \\""
 },
 "parameters": {
 "size": "832*480",
 "prompt_extend": true,
 "duration": 10
 }
 }'

## Generate a silent video

Only wan2.2 and wan2.1 series models support silent video generation. These models produce silent videos by default without additional configuration. ** The wan2.6 and wan2.5 series models generate videos with audio by default.

curl
curl --location 'https://dashscope-intl.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis' \\
 -H 'X-DashScope-Async: enable' \\
 -H "Authorization: Bearer $DASHSCOPE_API_KEY" \\
 -H 'Content-Type: application/json' \\
 -d '{
 "model": "wan2.2-t2v-plus",
 "input": {
 "prompt": "Low contrast. In a retro 1970s-style subway station, a street musician plays amidst dim colors and rough textures. He wears an old-fashioned jacket and holds a guitar, playing with concentration. Commuters hurry past, and a small crowd gradually gathers to listen. The camera slowly pans to the right, capturing a scene where the sound of the instrument mixes with the city's noise, with old-fashioned subway signs and mottled walls in the background."
 },
 "parameters": {
 "size": "832*480",
 "prompt_extend": true
 }
 }'

## Use a negative prompt

Supported models: All models. Use negative_prompt to exclude specific elements (such as "flowers") from the generated video.

curl
curl --location 'https://dashscope-intl.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis' \\
 -H 'X-DashScope-Async: enable' \\
 -H "Authorization: Bearer $DASHSCOPE_API_KEY" \\
 -H 'Content-Type: application/json' \\
 -d '{
 "model": "wan2.2-t2v-plus",
 "input": {
 "prompt": "A kitten running in the moonlight",
 "negative_prompt": "flowers"
 },
 "parameters": {
 "size": "832*480"
 }
 }'
Request headers

<b>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.

**

**Important ** If this request header is missing, the error "current user api does not support synchronous calls" is returned.

Request body

model *string* (Required) Model name. For models and pricing, see Model pricing. Example: wan2.6-t2v.

input *object* (Required) Input data, including the prompt. Properties

prompt *string* (Required) Text prompt describing the video content and visual style. Supports Chinese and English. Each character or letter counts as one. Text beyond the limit is auto-truncated. Maximum length by model:

  • wan2.6 and wan2.5 series models: Up to 1,500 characters.
  • wan2.2 and wan2.1 series models: Up to 800 characters. Example: A kitten running in the moonlight. For tips, see Text-to-Video/Image-to-Video Prompt Guide.

negative_prompt *string* (Optional) Elements to exclude from the generated video. Supports Chinese and English. Maximum 500 characters; longer text is auto-truncated. Example: low resolution, error, worst quality, low quality, disfigured, extra fingers, bad proportions.

audio_url *string* (Optional) Supported models: wan2.6 and wan2.5 series. URL of the audio file for video generation. Supported formats:

  • Public URL: <li> HTTP and HTTPS protocols.

  • Example: https://help-static-aliyun-doc.aliyuncs.com/xxx.mp3. </li> Audio limits:

  • Format: WAV, MP3.

  • Duration: 3 s to 30 s.

  • File size: Up to 15 MB.

  • Duration handling: If the audio exceeds the duration value (for example, 5 s), only the first 5 s are used. If the audio is shorter than the video, the remaining video is silent. For example, 3 s audio with a 5 s video produces 3 s of audio followed by 2 s of silence.

parameters *object* (Optional) Video generation parameters: resolution, prompt rewriting, and watermark. Properties

size *string* (Optional)

**

**Important **

  • The size parameter affects cost: Cost = Unit price (resolution-based) x Duration (seconds). For the same model: 1080p > 720p > 480p. Check model pricing.
  • Set size to a specific resolution (such as 1280*720), not an aspect ratio (1:1) or tier label (480p).

Output video resolution in **width*height** format. Defaults and valid values depend on the model:

  • wan2.6-t2v: The default value is 1920*1080 (1080p). Valid resolutions: all in the 720p and 1080p tiers.

  • wan2.6-t2v-us: The default value is 1920*1080 (1080p). Valid resolutions: all in the 720p and 1080p tiers.

  • wan2.5-t2v-preview: The default value is 1920*1080 (1080p). Valid resolutions: all in the 480p, 720p, and 1080p tiers.

  • wan2.2-t2v-plus: The default value is 1920*1080 (1080p). Valid resolutions: all in the 480p and 1080p tiers.

  • wan2.1-t2v-turbo: The default value is 1280*720 (720p). Valid resolutions: all in the 480p and 720p tiers.

  • wan2.1-t2v-plus: The default value is 1280*720 (720p). Valid resolutions: all those in the 720p tier. 480p tier resolutions and aspect ratios:

  • 832*480: 16:9.

  • 480*832: 9:16.

  • 624*624: 1:1. 720p tier resolutions and aspect ratios:

  • 1280*720: 16:9.

  • 720*1280: 9:16.

  • 960*960: 1:1.

  • 1088*832: 4:3.

  • 832*1088: 3:4. 1080p tier resolutions and aspect ratios:

  • 1920*1080: 16:9.

  • 1080*1920: 9:16.

  • 1440*1440: 1:1.

  • 1632*1248: 4:3.

  • 1248*1632: 3:4.

duration *integer* (Optional)

**

**Important ** Duration affects cost: Cost = Unit price (resolution-based) x Duration (seconds). Check model pricing.

Output video duration in seconds. Valid values depend on the model:

  • wan2.6-t2v: An integer from 2 to 15. The default value is 5.
  • wan2.6-t2v-us: Valid values are 5 and 10. The default value is 5.
  • wan2.5-t2v-preview: Valid values are 5 and 10. The default value is 5.
  • wan2.2-t2v-plus: Fixed at 5 seconds and cannot be changed.
  • wan2.1-t2v-plus: Fixed at 5 seconds and cannot be changed.
  • wan2.1-t2v-turbo: Fixed at 5 seconds and cannot be changed.

**prompt_extend ***boolean* (Optional) Enables prompt rewriting. When enabled, an LLM rewrites the input prompt to improve quality. Best for short prompts but adds latency.

  • true (default)
  • false

shot_type *string* (Optional) Supported models: wan2.6 models. Shot structure for the output video: one continuous shot or multiple shots with transitions. Valid values:

  • single (default)
  • multi This parameter takes effect only when "prompt_extend": true is set. Priority: shot_type overrides the prompt. Setting shot_type to single produces a single-shot video even if the prompt requests multi-shot.

watermark *boolean* (Optional) Adds a watermark in the lower-right corner with the text "AI Generated".

  • false (default)
  • true

seed *integer* (Optional) The random number seed must be an integer in the range \[0, 2147483647\]. If not specified, a random seed is generated. A fixed seed improves reproducibility. Because model generation is probabilistic, the same seed does not guarantee identical results.

Response parameters

Successful response

Save the task_id to query the task status and result.

json
{
 "output": {
 "task_status": "PENDING",
 "task_id": "0385dc79-5ff8-4d82-bcb6-xxxxxx"
 },
 "request_id": "4909100c-7b5a-9f92-bfe5-xxxxxx"
}

Error response

Task creation failed. See Error messages.

json
{
 "code": "InvalidApiKey",
 "message": "No API-key provided.",
 "request_id": "7438d53d-6eb8-4596-8835-xxxxxx"
}
     **output** `*object*`  Task output.

Properties

task_id *string* The task ID. Valid for queries for 24 hours.

task_status *string* The status of the task. Enumeration values

  • PENDING
  • RUNNING
  • SUCCEEDED
  • FAILED
  • CANCELED
  • UNKNOWN: The task does not exist or its status is unknown.

request_id *string* Unique request identifier for tracing and troubleshooting.

code *string* Error code. Returned only for failed requests. See Error messages.

message *string* Detailed error message. Returned only for failed requests. See Error messages.

Step 2: Query the result

Beijing

GET https://dashscope.aliyuncs.com/api/v1/tasks/{task_id}

Singapore

GET https://dashscope-intl.aliyuncs.com/api/v1/tasks/{task_id}

Virginia

GET https://dashscope-us.aliyuncs.com/api/v1/tasks/{task_id}

Singapore

GET https://dashscope-intl.aliyuncs.com/api/v1/tasks/{task_id}

Virginia

GET https://dashscope-us.aliyuncs.com/api/v1/tasks/{task_id}

Beijing

GET https://dashscope.aliyuncs.com/api/v1/tasks/{task_id}

Frankfurt

GET https://++.eu-central-1.maas.aliyuncs.com++/api/v1/tasks/

When calling the API, replace WorkspaceId with your actual Workspace ID. Note

  • Polling recommendation: Video generation takes several minutes. Use a polling mechanism with a reasonable interval, such as 15 seconds.

  • Task state transition: PENDING → RUNNING → SUCCEEDED or FAILED.

  • Result link : After a task succeeds, a video URL valid for 24 hours is returned. Download and save the video to permanent storage, such as OSS.

  • task_id****validity : 24 hours . After this period, queries return the task status as UNKNOWN.

Request parameters

## 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.

curl
curl -X GET https://dashscope-intl.aliyuncs.com/api/v1/tasks/{task_id} \\
--header "Authorization: Bearer $DASHSCOPE_API_KEY"
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 executed successfully

Video URLs are valid for only 24 hours and then automatically purged. Save generated videos promptly.

json
{
 "request_id": "abbf7aa3-9652-4785-a622-xxxxxx",
 "output": {
 "task_id": "38513c71-5190-48e1-9f3b-xxxxxx",
 "task_status": "SUCCEEDED",
 "submit_time": "2025-09-29 14:05:22.119",
 "scheduled_time": "2025-09-29 14:05:28.278",
 "end_time": "2025-09-29 14:10:00.437",
 "orig_prompt": "Shot from a low angle, in a medium close-up, with warm tones, mixed lighting (the practical light from the desk lamp blends with the overcast light from the window), side lighting, and a central composition. In a classic detective's office, wooden bookshelves are filled with old case files and ashtrays. A green desk lamp illuminates a case file spread out in the center of the desk. A fox, wearing a dark brown trench coat and a light gray fedora, sits in a leather chair, its fur crimson, its tail resting lightly on the edge, its fingers slowly turning yellowed pages. Outside, a steady drizzle falls beneath a blue sky, streaking the glass with meandering streaks. It slowly raises its head, its ears twitching slightly, its amber eyes gazing directly at the camera, its mouth clearly moving as it speaks in a smooth, cynical voice: 'The case was cold, colder than a fish in winter. But every chicken has its secrets, and I, for one, intended to find them'.",
 "video_url": "https://dashscope-result-sh.oss-accelerate.aliyuncs.com/xxx.mp4?Expires=xxx"
 },
 "usage": {
 "duration": 10,
 "size": "1280*720",
 "input_video_duration": 0,
 "output_video_duration": 10,
 "video_count": 1,
 "SR": 720
 }
 }

## Task execution failed

When a task fails, task_status is FAILED with an error code and message. See Error messages.

json
{
 "request_id": "e5d70b02-ebd3-98ce-9fe8-759d7d7b107d",
 "output": {
 "task_id": "86ecf553-d340-4e21-af6e-a0c6a421c010",
 "task_status": "FAILED",
 "code": "InvalidParameter",
 "message": "The size is not match xxxxxx"
 }
}

## Task query expired

The task_id is valid for 24 hours. After this period, queries return the following error.

json
{
 "request_id": "a4de7c32-7057-9f82-8581-xxxxxx",
 "output": {
 "task_id": "502a00b1-19d9-4839-a82f-xxxxxx",
 "task_status": "UNKNOWN"
 }
}
     **output **`*object*`* * Task output.

Properties

task_id *string* The task ID. Valid for queries for 24 hours.

task_status *string* The status of the task. Enumeration values

  • PENDING
  • RUNNING
  • SUCCEEDED
  • FAILED
  • CANCELED
  • UNKNOWN: The task does not exist or its status is unknown.

State transitions during polling:

  • PENDING → RUNNING → SUCCEEDED or FAILED.
  • The initial query status is usually PENDING or RUNNING.
  • When the status changes to SUCCEEDED, the response contains the generated video URL.
  • If the status is FAILED, check the error message and retry the task.

submit_time *string* The 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 *string* The 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 *string* The time when the task was completed. The time is in UTC+8 and the format is YYYY-MM-DD HH:mm:ss.SSS.

video_url *string* URL of the generated video. Returned only when task_status is SUCCEEDED. Valid for 24 hours. The video is in MP4 format with H.264 encoding.

orig_prompt *string* The original input prompt, corresponding to the request parameter prompt.

actual_prompt *string* When prompt_extend=true, the system rewrites the input prompt. This field contains the rewritten prompt used for generation.

  • Not returned when prompt_extend=false.
  • The wan2.6 model does not return this field, regardless of the prompt_extend value.

code *string* Error code. Returned only for failed requests. See Error messages.

message *string* Detailed error message. Returned only for failed requests. See Error messages.

usage *object* Output statistics. Returned only for successful tasks. Properties

video_duration *integer* Returned only for wan2.5 and earlier (used for billing). Duration of the output video in seconds. Valid values: 5, 10.

duration *float* Returned only for wan2.6 (used for billing). Total video duration. Formula: duration=input_video_duration+output_video_duration.

input_video_duration *integer* Returned only for wan2.6. Fixed value: 0.

output_video_duration *integer* Returned only for wan2.6. Output video duration in seconds. Matches the input.duration value.

SR *integer* Returned only for wan2.6. Resolution tier of the output video. Example: 720.

size *string* Returned only for wan2.6. Output resolution in "widthheight" format. Example: 1920*1080.

video_ratio *string* Returned only for wan2.5 and earlier. Output resolution in "widthheight" format. Example: 832*480.

video_count *integer* Number of videos generated. Always 1.

request_id *string* Unique request identifier for tracing and troubleshooting.

DashScope SDK

SDK parameter names mostly match the HTTP API, with structures following language-specific conventions.

Text-to-video tasks take 1--5 minutes. The SDK wraps the asynchronous HTTP call flow and supports both synchronous and asynchronous invocation.

Actual processing time depends on queue depth and service load.

Python SDK

Important

  • The SDK supports wan2.6 and earlier. wan2.7 is not supported.

  • DashScope Python SDK version 1.25.8 or later is required.

    Older versions may return "url error, please check url!". To update, see Install the SDK.

Set dashscope.base_http_api_url to the region endpoint:

Beijing

dashscope.base_http_api_url = 'https://dashscope.aliyuncs.com/api/v1'

Singapore

dashscope.base_http_api_url = 'https://dashscope-intl.aliyuncs.com/api/v1'

Virginia

dashscope.base_http_api_url = 'https://dashscope-us.aliyuncs.com/api/v1'

Synchronous invocation

Request example
HELPCODEESCAPE-python
from http import HTTPStatus
from dashscope import VideoSynthesis
import dashscope
import os


dashscope.base_http_api_url = 'https://dashscope-intl.aliyuncs.com/api/v1'

# If no environment variable is configured, replace with your Model Studio API key: api_key="sk-xxx".
# API keys vary by region. For more information, see https://www.alibabacloud.com/help/en/model-studio/get-api-key.
api_key = os.getenv("DASHSCOPE_API_KEY")

def sample_sync_call_t2v():
    # Call the sync API and return the result.
    print('Please wait...')
    rsp = VideoSynthesis.call(api_key=api_key,
                              model='wan2.6-t2v',
                              prompt="Shot from a low angle, in a medium close-up, with warm tones, mixed lighting (the practical light from the desk lamp blends with the overcast light from the window), side lighting, and a central composition. In a classic detective office, wooden bookshelves are filled with old case files and ashtrays. A green desk lamp illuminates a case file spread out in the center of the desk. A fox, wearing a dark brown trench coat and a light gray fedora, sits in a leather chair, its fur crimson, its tail resting lightly on the edge, its fingers slowly turning yellowed pages. Outside, a steady drizzle falls beneath a blue sky, streaking the glass with meandering streaks. It slowly raises its head, its ears twitching slightly, its amber eyes gazing directly at the camera, its mouth clearly moving as it speaks in a smooth, cynical voice: 'The case was cold, colder than a fish in winter. But every chicken has its secrets, and I, for one, intended to find them.'",
                              audio_url='https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250929/stjqnq/%E7%8B%90%E7%8B%B8.mp3',
                              size='1280*720',
                              duration=10,
                              negative_prompt="",
                              prompt_extend=True,
                              watermark=False,
                              seed=12345)
    print(rsp)
    if rsp.status_code == HTTPStatus.OK:
        print(rsp.output.video_url)
    else:
        print('Failed. Status code: %s, code: %s, message: %s' %
              (rsp.status_code, rsp.code, rsp.message))

if __name__ == '__main__':
    sample_sync_call_t2v()
Response example

The video_url expires after 24 hours. Download promptly.

HELPCODEESCAPE-json
{
    "status_code": 200,
    "request_id": "167f3beb-3dd0-47fe-a83c-xxxxxx",
    "code": null,
    "message": "",
    "output": {
        "task_id": "5b65411f-d946-4e29-859e-xxxxxx",
        "task_status": "SUCCEEDED",
        "video_url": "https://dashscope-result-bj.oss-accelerate.aliyuncs.com/xxx.mp4?Expires=xxx",
        "submit_time": "2025-10-23 11:47:23.879",
        "scheduled_time": "2025-10-23 11:47:34.351",
        "end_time": "2025-10-23 11:52:35.323",
        "orig_prompt": "Shot from a low angle, in a medium close-up, with warm tones, mixed lighting (the practical light from the desk lamp blends with the overcast light from the window), side lighting, and a central composition. In a classic detective's office, wooden bookshelves are filled with old case files and ashtrays. A green desk lamp illuminates a case file spread out in the center of the desk. A fox, wearing a dark brown trench coat and a light gray fedora, sits in a leather chair, its fur crimson, its tail resting lightly on the edge, its fingers slowly turning yellowed pages. Outside, a steady drizzle falls beneath a blue sky, streaking the glass with meandering streaks. It slowly raises its head, its ears twitching slightly, its amber eyes gazing directly at the camera, its mouth clearly moving as it speaks in a smooth, cynical voice: 'The case was cold, colder than a fish in winter. But every chicken has its secrets, and I, for one, intended to find them '."
    },
    "usage": {
        "video_count": 1,
        "video_duration": 0,
        "video_ratio": "",
        "duration": 10,
        "size": "1280*720",
        "input_video_duration": 0,
        "output_video_duration": 10,
        "SR": 720
    }
}

Asynchronous invocation

Request example
HELPCODEESCAPE-python
from http import HTTPStatus
from dashscope import VideoSynthesis
import dashscope
import os

# This is the Singapore region URL. URLs vary by region. For more information, see: https://www.alibabacloud.com/help/en/model-studio/text-to-video-api-reference
dashscope.base_http_api_url = 'https://dashscope-intl.aliyuncs.com/api/v1'

# If an environment variable is not configured, replace this with your Model Studio API key: api_key="sk-xxx"
# API keys vary by region. For more information, see: https://www.alibabacloud.com/help/en/model-studio/get-api-key
api_key = os.getenv("DASHSCOPE_API_KEY")

def sample_async_call_t2v():
    # Call the asynchronous API and return the task information.
    # Use the task ID to check the status.
    rsp = VideoSynthesis.async_call(api_key=api_key,
                                    model='wan2.6-t2v',
                                    prompt="Shot from a low angle, in a medium close-up, with warm tones, mixed lighting (the practical light from the desk lamp blends with the overcast light from the window), side lighting, and a central composition. In a classic detective office, wooden bookshelves are filled with old case files and ashtrays. A green desk lamp illuminates a case file spread out in the center of the desk. A fox, wearing a dark brown trench coat and a light gray fedora, sits in a leather chair, its fur crimson, its tail resting lightly on the edge, its fingers slowly turning yellowed pages. Outside, a steady drizzle falls beneath a blue sky, streaking the glass with meandering streaks. It slowly raises its head, its ears twitching slightly, its amber eyes gazing directly at the camera, its mouth clearly moving as it speaks in a smooth, cynical voice: 'The case was cold, colder than a fish in winter. But every chicken has its secrets, and I, for one, intended to find them '.",
                                    audio_url='https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250929/stjqnq/%E7%8B%90%E7%8B%B8.mp3',
                                    size='1280*720',
                                    duration=10,
                                    negative_prompt="",
                                    prompt_extend=True,
                                    watermark=False,
                                    seed=12345)
    print(rsp)
    if rsp.status_code == HTTPStatus.OK:
        print("task_id: %s" % rsp.output.task_id)
    else:
        print('Failed. Status code: %s, code: %s, message: %s' %
              (rsp.status_code, rsp.code, rsp.message))

    # Retrieve the task information, including the task status.
    status = VideoSynthesis.fetch(task=rsp, api_key=api_key)
    if status.status_code == HTTPStatus.OK:
        print(status.output.task_status)  # Check the task status.
    else:
        print('Failed. Status code: %s, code: %s, message: %s' %
              (status.status_code, status.code, status.message))

    # Wait for the task to complete. This method calls fetch at intervals and checks if the task is in a finished state.
    rsp = VideoSynthesis.wait(task=rsp, api_key=api_key)
    print(rsp)
    if rsp.status_code == HTTPStatus.OK:
        print(rsp.output.video_url)
    else:
        print('Failed. Status code: %s, code: %s, message: %s' %
              (rsp.status_code, rsp.code, rsp.message))

if __name__ == '__main__':
    sample_async_call_t2v()
Response example
  1. Task creation response example

    HELPCODEESCAPE-json
    {
    "status_code": 200,
    "request_id": "c86ff7ba-8377-917a-90ed-xxxxxx",
    "code": "",
    "message": "",
    "output": {
    	"task_id": "721164c6-8619-4a35-a6d9-xxxxxx",
    	"task_status": "PENDING",
    	"video_url": ""
    },
    "usage": null
    }
  2. Task query response example

    The video_url expires after 24 hours. Download promptly.

    {
        "status_code": 200,
        "request_id": "167f3beb-3dd0-47fe-a83c-xxxxxx",
        "code": null,
        "message": "",
        "output": {
            "task_id": "5b65411f-d946-4e29-859e-xxxxxx",
            "task_status": "SUCCEEDED",
            "video_url": "https://dashscope-result-bj.oss-accelerate.aliyuncs.com/xxx.mp4?Expires=xxx",
            "submit_time": "2025-10-23 11:47:23.879",
            "scheduled_time": "2025-10-23 11:47:34.351",
            "end_time": "2025-10-23 11:52:35.323",
            "orig_prompt": "Shot from a low angle, in a medium close-up, with warm tones, mixed lighting (the practical light from the desk lamp blends with the overcast light from the window), side lighting, and a central composition. In a classic detective's office, wooden bookshelves are filled with old case files and ashtrays. A green desk lamp illuminates a case file spread out in the center of the desk. A fox, wearing a dark brown trench coat and a light gray fedora, sits in a leather chair, its fur crimson, its tail resting lightly on the edge, its fingers slowly turning yellowed pages. Outside, a steady drizzle falls beneath a blue sky, streaking the glass with meandering streaks. It slowly raises its head, its ears twitching slightly, its amber eyes gazing directly at the camera, its mouth clearly moving as it speaks in a smooth, cynical voice: 'The case was cold, colder than a fish in winter. But every chicken has its secrets, and I, for one, intended to find them '."
        },
        "usage": {
            "video_count": 1,
            "video_duration": 0,
            "video_ratio": "",
            "duration": 10,
            "size": "1280*720",
            "input_video_duration": 0,
            "output_video_duration": 10,
            "SR": 720
        }
    }

Java SDK

Important

  • The SDK supports wan2.6 and earlier. wan2.7 is not supported.

  • DashScope Java SDK version 2.22.6 or later is required.

    Older versions may return "url error, please check url!". To update, see Install the SDK.

Set Constants.baseHttpApiUrl to the region endpoint:

Beijing

Constants.baseHttpApiUrl = "https://dashscope.aliyuncs.com/api/v1";

Singapore

Constants.baseHttpApiUrl = "https://dashscope-intl.aliyuncs.com/api/v1";

Virginia

Constants.baseHttpApiUrl = "https://dashscope-us.aliyuncs.com/api/v1";

Singapore

Constants.baseHttpApiUrl = "https://dashscope-intl.aliyuncs.com/api/v1";

Virginia

Constants.baseHttpApiUrl = "https://dashscope-us.aliyuncs.com/api/v1";

Beijing

Constants.baseHttpApiUrl = "https://dashscope.aliyuncs.com/api/v1";

Synchronous invocation

Request example
HELPCODEESCAPE-java
// Copyright (c) Alibaba, Inc. and its affiliates.

// dashscope SDK version 2.18.2 or later
import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesis;
import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesisParam;
import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesisResult;
import com.alibaba.dashscope.exception.ApiException;
import com.alibaba.dashscope.exception.InputRequiredException;
import com.alibaba.dashscope.exception.NoApiKeyException;
import com.alibaba.dashscope.utils.JsonUtils;
import com.alibaba.dashscope.utils.Constants;

import java.util.HashMap;
import java.util.Map;

public class Text2Video {

    static {
        // Singapore region URL. URLs vary by region. For more information, see https://www.alibabacloud.com/help/en/model-studio/text-to-video-api-reference.
        Constants.baseHttpApiUrl = "https://dashscope-intl.aliyuncs.com/api/v1";
    }

    // If no environment variable is configured, replace the value with your Model Studio API key: apiKey = "sk-xxx".
    // API keys vary by region. For more information, see https://www.alibabacloud.com/help/en/model-studio/get-api-key.
    public static String apiKey = System.getenv("DASHSCOPE_API_KEY");

    public static void text2Video() throws ApiException, NoApiKeyException, InputRequiredException {
        VideoSynthesis vs = new VideoSynthesis();
        Map&lt;String, Object&gt; parameters = new HashMap<>();
        parameters.put("prompt_extend", true);
        parameters.put("watermark", false);
        parameters.put("seed", 12345);

        VideoSynthesisParam param =
                VideoSynthesisParam.builder()
                        .apiKey(apiKey)
                        .model("wan2.6-t2v")
                        .prompt("Shot from a low angle, in a medium close-up, with warm tones, mixed lighting (the practical light from the desk lamp blends with the overcast light from the window), side lighting, and a central composition. In a classic detective office, wooden bookshelves are filled with old case files and ashtrays. A green desk lamp illuminates a case file spread out in the center of the desk. A fox, wearing a dark brown trench coat and a light gray fedora, sits in a leather chair, its fur crimson, its tail resting lightly on the edge, its fingers slowly turning yellowed pages. Outside, a steady drizzle falls beneath a blue sky, streaking the glass with meandering streaks. It slowly raises its head, its ears twitching slightly, its amber eyes gazing directly at the camera, its mouth clearly moving as it speaks in a smooth, cynical voice: 'The case was cold, colder than a fish in winter. But every chicken has its secrets, and I, for one, intended to find them'.")
                        .audioUrl("https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250929/stjqnq/%E7%8B%90%E7%8B%B8.mp3")
                        .negativePrompt("")
                        .size("1280*720")
                        .duration(10)
                        .parameters(parameters)
                        .build();
        System.out.println("Please wait...");
        VideoSynthesisResult result = vs.call(param);
        System.out.println(JsonUtils.toJson(result));
    }

    public static void main(String[] args) {
        try {
            text2Video();
        } catch (ApiException | NoApiKeyException | InputRequiredException e) {
            System.out.println(e.getMessage());
        }
        System.exit(0);
    }
}
Response example

The video_url expires after 24 hours. Download promptly.

HELPCODEESCAPE-json
{
    "request_id": "c1209113-8437-424f-a386-xxxxxx",
    "output": {
        "task_id": "966cebcd-dedc-4962-af88-xxxxxx",
        "task_status": "SUCCEEDED",
        "video_url": "https://dashscope-result-sh.oss-accelerate.aliyuncs.com/xxx.mp4?Expires=xxx",
        "orig_prompt": "Shot from a low angle, in a medium close-up, with warm tones, mixed lighting (the practical light from the desk lamp blends with the overcast light from the window), side lighting, and a central composition. In a classic detective office, wooden bookshelves are filled with old case files and ashtrays. A green desk lamp illuminates a case file spread out in the center of the desk. A fox, wearing a dark brown trench coat and a light gray fedora, sits in a leather chair, its fur crimson, its tail resting lightly on the edge, its fingers slowly turning yellowed pages. Outside, a steady drizzle falls beneath a blue sky, streaking the glass with meandering streaks. It slowly raises its head, its ears twitching slightly, its amber eyes gazing directly at the camera, its mouth clearly moving as it speaks in a smooth, cynical voice: 'The case was cold, colder than a fish in winter. But every chicken has its secrets, and I, for one, intended to find them '",
        "submit_time": "2026-01-22 23:13:40.553",
        "scheduled_time": "2026-01-22 23:13:49.415",
        "end_time": "2026-01-22 23:17:56.380"
    },
    "usage": {
        "video_count": 1,
        "duration": 10.0,
        "size": "1280*720",
        "input_video_duration": 0.0,
        "output_video_duration": 10.0,
        "SR": "720"
    },
    "status_code": 200,
    "code": "",
    "message": ""
}

Asynchronous invocation

Request example
HELPCODEESCAPE-java
// Copyright (c) Alibaba, Inc. and its affiliates.

import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesis;
import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesisListResult;
import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesisParam;
import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesisResult;
import com.alibaba.dashscope.exception.ApiException;
import com.alibaba.dashscope.exception.InputRequiredException;
import com.alibaba.dashscope.exception.NoApiKeyException;
import com.alibaba.dashscope.task.AsyncTaskListParam;
import com.alibaba.dashscope.utils.JsonUtils;
import com.alibaba.dashscope.utils.Constants;

import java.util.HashMap;
import java.util.Map;

public class Text2Video {
    static {
        // The URL for the Singapore region. URLs vary by region. For more information, see https://www.alibabacloud.com/help/en/model-studio/text-to-video-api-reference
        Constants.baseHttpApiUrl="https://dashscope-intl.aliyuncs.com/api/v1";
    }

     // If an environment variable is not set, replace the placeholder with your Model Studio API key, for example: apiKey="sk-xxx"
    // API keys vary by region. For more information, see https://www.alibabacloud.com/help/en/model-studio/get-api-key
    public static String apiKey = System.getenv("DASHSCOPE_API_KEY");

    public static void text2Video() throws ApiException, NoApiKeyException, InputRequiredException {
        VideoSynthesis vs = new VideoSynthesis();
        Map&lt;String, Object&gt; parameters = new HashMap<>();
        parameters.put("prompt_extend", true);
        parameters.put("watermark", false);
        parameters.put("seed", 12345);

        VideoSynthesisParam param =
                VideoSynthesisParam.builder()
                        .apiKey(apiKey)
                        .model("wan2.6-t2v")
                        .prompt("Shot from a low angle, in a medium close-up, with warm tones, mixed lighting (the practical light from the desk lamp blends with the overcast light from the window), side lighting, and a central composition. In a classic detective office, wooden bookshelves are filled with old case files and ashtrays. A green desk lamp illuminates a case file spread out in the center of the desk. A fox, wearing a dark brown trench coat and a light gray fedora, sits in a leather chair, its fur crimson, its tail resting lightly on the edge, its fingers slowly turning yellowed pages. Outside, a steady drizzle falls beneath a blue sky, streaking the glass with meandering streaks. It slowly raises its head, its ears twitching slightly, its amber eyes gazing directly at the camera, its mouth clearly moving as it speaks in a smooth, cynical voice: 'The case was cold, colder than a fish in winter. But every chicken has its secrets, and I, for one, intended to find them '.")
                        .audioUrl("https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250929/stjqnq/%E7%8B%90%E7%8B%B8.mp3")
                        .negativePrompt("")
                        .size("1280*720")
                        .duration(10)
                        .parameters(parameters)
                        .build();

        // Make an asynchronous call.
        VideoSynthesisResult task = vs.asyncCall(param);
        System.out.println(JsonUtils.toJson(task));
        System.out.println("please wait...");

        // Retrieve the result.
        VideoSynthesisResult result = vs.wait(task, apiKey);
        System.out.println(JsonUtils.toJson(result));
    }

     // Retrieve the task list.
    public static void listTask() throws ApiException, NoApiKeyException {
        VideoSynthesis is = new VideoSynthesis();
        AsyncTaskListParam param = AsyncTaskListParam.builder().build();
        param.setApiKey(apiKey);
        VideoSynthesisListResult result = is.list(param);
        System.out.println(result);
    }

    // Retrieve the result of a single task.
    public static void fetchTask(String taskId) throws ApiException, NoApiKeyException {
        VideoSynthesis is = new VideoSynthesis();
        // If you set the DASHSCOPE_API_KEY environment variable, you can set apiKey to null.
        VideoSynthesisResult result = is.fetch(taskId, apiKey);
        System.out.println(result.getOutput());
        System.out.println(result.getUsage());
    }

    public static void main(String[] args) {
        try {
            text2Video();
        } catch (ApiException | NoApiKeyException | InputRequiredException e) {
            System.out.println(e.getMessage());
        }
        System.exit(0);
    }
}
Response example
  1. Task creation response example.

    HELPCODEESCAPE-json
    {
            "request_id": "5dbf9dc5-4f4c-9605-85ea-xxxxxxxx",
    "output": {
    	"task_id": "7277e20e-aa01-4709-xxxxxxxx",
    	"task_status": "PENDING"
    }
    }
  2. Task query response example

    The video_url expires after 24 hours. Download promptly.

    HELPCODEESCAPE-json
    {
        "request_id": "c1209113-8437-424f-a386-xxxxxx",
        "output": {
            "task_id": "966cebcd-dedc-4962-af88-xxxxxx",
            "task_status": "SUCCEEDED",
            "video_url": "https://dashscope-result-sh.oss-accelerate.aliyuncs.com/xxx.mp4?Expires=xxx",
            "orig_prompt": "Shot from a low angle, in a medium close-up, with warm tones, mixed lighting (the practical light from the desk lamp blends with the overcast light from the window), side lighting, and a central composition. In a classic detective office, wooden bookshelves are filled with old case files and ashtrays. A green desk lamp illuminates a case file spread out in the center of the desk. A fox, wearing a dark brown trench coat and a light gray fedora, sits in a leather chair, its fur crimson, its tail resting lightly on the edge, its fingers slowly turning yellowed pages. Outside, a steady drizzle falls beneath a blue sky, streaking the glass with meandering streaks. It slowly raises its head, its ears twitching slightly, its amber eyes gazing directly at the camera, its mouth clearly moving as it speaks in a smooth, cynical voice: 'The case was cold, colder than a fish in winter. But every chicken has its secrets, and I, for one, intended to find them '",
            "submit_time": "2026-01-22 23:13:40.553",
            "scheduled_time": "2026-01-22 23:13:49.415",
            "end_time": "2026-01-22 23:17:56.380"
        },
        "usage": {
            "video_count": 1,
            "duration": 10.0,
            "size": "1280*720",
            "input_video_duration": 0.0,
            "output_video_duration": 10.0,
            "SR": "720"
        },
        "status_code": 200,
        "code": "",
        "message": ""
    }

Limitations

  • Data retention : The task ID (task_id) and video URL (video_url) expire after 24 hours. After expiry, they cannot be queried or downloaded.

  • Content moderation : Input and output undergo content moderation. Prohibited content triggers "IPInfringementSuspect" or "DataInspectionFailed" errors. See Error messages.

Error codes

If the model call fails and returns an error message, see Error messages for resolution.

FAQ

Q: What code changes are needed to upgrade from wan2.6 to wan2.7?

A: Two changes are required:

  • Resolution control : wan2.7 replaces the size field. Instead, it uses a combination of resolution (resolution tier) and ratio (aspect ratio) to define output resolution. Earlier models used the size field.

  • Shot type removal : wan2.7 drops the shot_type field. Describe shot structure directly in the prompt instead.

A: Direct conversion is not possible. Download the video from the URL, then upload it to persistent storage (such as Alibaba Cloud OSS) to generate a permanent link. Example code: Download a video to a local device

HELPCODEESCAPE-python
import requests

def download_and_save_video(video_url, save_path):
    try:
        response = requests.get(video_url, stream=True, timeout=300)
        response.raise_for_status()
        with open(save_path, 'wb') as f:
            for chunk in response.iter_content(chunk_size=8192):
                f.write(chunk)
        print(f"Video successfully downloaded to: {save_path}")
        # You can add logic to upload the video to permanent storage here
    except requests.exceptions.RequestException as e:
        print(f"Failed to download video: {e}")

if __name__ == '__main__':
    video_url = "http://dashscope-result-sh.oss-cn-shanghai.aliyuncs.com/xxxx"
    save_path = "video.mp4"
    download_and_save_video(video_url, save_path)

A: No. The link expires after 24 hours. Download the video, store it persistently, and use a permanent link for playback.

/Display the table as a column card, similar to DingTalk documents/

table.help-table-card td {

border: 10px solid #FFF !important;

background: #F4F6F9;

padding: 16px !important;

vertical-align: top;

}

/Reduce the margin of code blocks in the table to make content more compact/

.unionContainer .markdown-body table .help-code-block {

margin: 0 !important;

}

/Reduce the font size of code blocks in the table to make content more compact/

.unionContainer .markdown-body .help-code-block pre {

font-size: 12px !important;

}

/Reduce the font size of code blocks in the table to make content more compact/

.unionContainer .markdown-body .help-code-block pre code {

font-size: 12px !important;

}

/Reduce the top and bottom spacing of blockquotes in the table to avoid sparse content/

.unionContainer .markdown-body table blockquote {

margin: 4px 0 0 0;

}

Mirror of Alibaba Cloud Model Studio docs for reference and RAG. Not affiliated with Alibaba Cloud.