Skip to main content

Wan - text-to-video API reference (2.1-2.6)

The Wan text-to-video model generates smooth videos from text prompts .

References: User guide

Availability

To ensure successful calls, the model, Endpoint URL, and API Key must all belong to the same region. Cross-region calls will fail.
The sample code in this topic applies to the Beijing 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

This API uses the legacy protocol and supports wan2.6 and earlier models (wan2.5/wan2.2/wanx2.1).
Because text-to-video tasks take a long time (typically 1 to 5 minutes), the API uses asynchronous invocation. The entire process involves two core steps: Create a task -> Poll for the result. The process is as follows:

Step 1: Create a task and get the task ID

  • Beijing
  • Singapore
  • Virginia
  • Frankfurt
POST https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesisReplace {WorkspaceId} with your actual workspace ID.
  • After the task is created successfully, use the task_id returned by the API to query the result. task_id is valid for 24 hours. Do not create duplicate tasks; just poll to obtain the result.
  • For a beginner's guide, see Postman.

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)Asynchronous processing configuration parameter. HTTP requests only support asynchronous mode; it must be set to enable.
If this request header is missing, the error "current user api does not support synchronous calls" is returned.
Request body
model string (Required)The name of the model to use. For a list of available models, see the model list.Example: wan2.6-t2v.input object (Required)Contains basic input information, such as the prompt.

Properties

prompt string (Required)The text prompt. It describes the desired elements and visual characteristics of the generated video.The prompt can be in Chinese or English. The length is measured in characters, where each Chinese character or letter is counted as one character. Text that exceeds the character limit is automatically truncated. The length limit varies by model version:
  • wan2.6 and wan2.5 series models: Up to 1,500 characters.
  • wan2.2 and wanx2.1 series models: Up to 800 characters.
Example: A kitten running in the moonlight.For more information, see the Text-to-video/image-to-video prompt guide.negative_prompt string (Optional)A prompt that describes the content to exclude from the video. This helps refine the generated content.The prompt can be in Chinese or English. The maximum length is 500 characters. Text that exceeds this limit is automatically truncated.Example: low resolution, error, worst quality, low quality, deformed, extra fingers, bad proportions.audio_url string (Optional)Supported models: wan2.6 and wan2.5 series models.The URL of the audio file. The model will use this audio to generate the video.Supported input formats:
  1. Public URL:
  2. Temporary URL:
Audio limits:
  • Format: wav, mp3.
  • Duration: 3 to 30 s.
  • File size: Up to 15 MB.
  • Handling audio that exceeds the specified duration: If the audio is longer than the value specified for the duration parameter (for example, 5 seconds), the audio is truncated to the specified duration. If the audio is shorter than the video duration, the remaining part of the video is silent. For example, if the audio is 3 seconds long and the video is 5 seconds long, the first 3 seconds of the video will have audio and the last 2 seconds will be silent.
parameters object (Optional)Video processing parameters, such as setting the video resolution, enabling prompt rewriting, and adding a watermark.

Properties

size string (Optional)
  • The size directly affects the cost. Before making a call, review the model pricing.
  • The size must be set to a specific value, such as 1280*720, not an aspect ratio such as 1:1 or a resolution tier such as 480P.
Specifies the resolution of the generated video, in the format of width*height. The default value and available enumeration values of this parameter depend on the model parameter, as follows:
  • wan2.6-t2v: The default value is 1920*1080 (1080P). Valid resolutions include all resolutions in the 720P and 1080P tiers.
  • wan2.5-t2v-preview: The default value is 1920*1080 (1080P). Valid resolutions include all resolutions in the 480P, 720P, and 1080P tiers.
  • wan2.2-t2v-plus: The default value is 1920*1080 (1080P). Valid resolutions include all resolutions in the 480P and 1080P tiers.
  • wanx2.1-t2v-turbo: The default value is 1280*720 (720P). Valid resolutions include all resolutions in the 480P and 720P tiers.
  • wanx2.1-t2v-plus: The default value is 1280*720 (720P). Valid resolutions include all resolutions in the 720P tier.
480P tier: The valid video resolutions and their corresponding aspect ratios are:
  • 832*480:16:9。
  • 480*832:9:16。
  • 624*624:1:1。
720P tier: The valid video resolutions and their corresponding aspect ratios are:
  • 1280*720:16:9。
  • 720*1280:9:16。
  • 960*960:1:1。
  • 1088*832:4:3。
  • 832*1088:3:4。
1080P tier: The valid video resolutions and their corresponding aspect ratios are:
  • 1920*1080: 16:9。
  • 1080*1920: 9:16。
  • 1440*1440: 1:1。
  • 1632*1248: 4:3。
  • 1248*1632: 3:4。
duration integer (Optional)
The duration directly affects the cost. Cost = Unit price (based on resolution) × Duration (in seconds). Before making a call, review the model pricing.
The duration of the generated video, in seconds. The value of this parameter depends on the model parameter:
  • wan2.6-t2v: an integer between [2, 15]. The default value is 5.
  • wan2.5-t2v-preview: the optional values are 5 and 10. The default value is 5.
  • wan2.2-t2v-plus: fixed at 5 seconds, and cannot be modified.
  • wanx2.1-t2v-plus: fixed at 5 seconds, and cannot be modified.
  • wanx2.1-t2v-turbo: fixed at 5 seconds, and cannot be modified.
prompt_extendboolean (Optional)Specifies whether to enable prompt rewriting. When enabled, a model intelligently rewrites the input prompt. This significantly improves the quality of the generated video for shorter prompts but increases the running time.
  • true (default)
  • false
shot_type string (Optional)Supported models: wan2.6 models.Specifies the shot type of the generated video, that is, whether the video consists of a single continuous shot or multiple changing shots.Valid values:
  • single: Default value. Outputs a single-shot video.
  • multi: Outputs a multi-shot video.
Condition: This parameter takes effect only when "prompt_extend": true is set.Parameter priority: shot_type > prompt. For example, if shot_type is set to "single", the model outputs a single-shot video even if the prompt contains "generate a multi-shot video".watermark boolean (Optional)Specifies whether to add a watermark. The watermark is placed in the lower-right corner of the video with the fixed 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.
  • Multi-shot narrative
  • Provide an audio file
  • Automatic dubbing
  • Generate a silent video
  • Use a negative prompt
  • For a multi-shot video, shot_type must be set to "multi".
  • For a multi-shot video, prompt_extend must be set to true to enable prompt rewriting for shot description optimization.

# 以下为华北2(北京)地域的URL,调用时请将 {WorkspaceId} 替换为真实的业务空间ID,各地域的URL不同。
curl --location 'https://{WorkspaceId}.cn-beijing.maas.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": "一幅史诗级可爱的场景。一只小巧可爱的卡通小猫将军,身穿细节精致的金色盔甲,头戴一个稍大的头盔,勇敢地站在悬崖上。他骑着一匹虽小但英勇的战马,说:”青海长云暗雪山,孤城遥望玉门关。黄沙百战穿金甲,不破楼兰终不还。“。悬崖下方,一支由老鼠组成的、数量庞大、无穷无尽的军队正带着临时制作的武器向前冲锋。这是一个戏剧性的、大规模的战斗场景,灵感来自中国古代的战争史诗。远处的雪山上空,天空乌云密布。整体氛围是“可爱”与“霸气”的搞笑和史诗般的融合。",
        "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": {
        "size": "1280*720",
        "prompt_extend": true,
        "duration": 10,
        "shot_type":"multi"
    }
}'

Response parameters

output objectContains the task output information.

Properties

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

Enumeration values

  • PENDING: The task is queued.
  • RUNNING: The task is being processed.
  • SUCCEEDED: The task completed successfully.
  • FAILED: The task failed.
  • CANCELED: The task was canceled.
  • UNKNOWN: The task does not exist or its status is unknown.
request_idstringUnique 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.
  • Successful response
  • Error response
Please save the task_id, which is used 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 the result by task ID

  • Beijing
  • Singapore
  • Virginia
  • Frankfurt
GET https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/tasks/{task_id}Replace {WorkspaceId} with your actual workspace ID.
  • Polling recommendation: Video generation takes several minutes. It is recommended to use a polling mechanism and set a reasonable query interval (such as 15 seconds) to obtain the result.
  • Task status transition: PENDING (Queuing) → RUNNING (Processing) → SUCCEEDED (Success) / FAILED (Failed).
  • Result link: After the task succeeds, a video link is returned, valid for 24 hours. It is recommended that you download the video immediately after obtaining the link and transfer it to permanent storage (such as Alibaba Cloud OSS).
  • task_id validity: 24 hours. Once it expires, the result can no longer be queried, and the API will return the task status as UNKNOWN.
  • RPS limit: The default RPS of the query API is 20. If you need higher-frequency queries or event notifications, see Configure asynchronous task callbacks.
  • More operations: For batch queries, task cancellation, and other operations, see Manage asynchronous tasks.

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}.cn-beijing.maas.aliyuncs.com/api/v1/tasks/{task_id} \
--header "Authorization: Bearer $DASHSCOPE_API_KEY"

Response parameters

outputobjectContains the task output information.

Properties

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

Enumeration values

  • PENDING: The task is queued.
  • RUNNING: The task is being processed.
  • SUCCEEDED: The task completed successfully.
  • FAILED: The task failed.
  • CANCELED: The task was canceled.
  • UNKNOWN: The task does not exist or its status is unknown.
State transitions during polling:
  • PENDING (Queuing) → RUNNING (Processing) → SUCCEEDED (Success) / FAILED (Failed).
  • The status on the first query is usually PENDING (Queuing) or RUNNING (Processing).
  • When the status changes to SUCCEEDED, the response will contain the URL of the generated video.
  • If the status is FAILED, check the error message and retry.
  • If the status is CANCELED, the task has been canceled; to continue, resubmit the task.
  • If the status is UNKNOWN, the task does not exist or its status is unknown, which may occur when the task_id does not exist or the 24-hour validity period has expired.
submit_time stringThe time when the task was submitted. Format: YYYY-MM-DD HH:mm:ss.SSS.scheduled_time stringThe time when the task was executed. Format: YYYY-MM-DD HH:mm:ss.SSS.end_time stringThe time when the task was completed. Format: YYYY-MM-DD HH:mm:ss.SSS.video_urlstringThe video URL. Returned only when task_status is SUCCEEDED.Valid for 24 hours. The video is in MP4 format with H.264 encoding.orig_prompt stringThe original input prompt, corresponding to the request parameter prompt.actual_prompt stringWhen prompt_extend=true, the system rewrites the input prompt. This field returns the optimized prompt used for generation.
  • If prompt_extend=false, this field is not returned.
  • Note: The wan2.6 model does not return this field, regardless of the value of prompt_extend.
codestringError code. Returned only for failed requests. See Error codes.messagestringDetailed error message. Returned only for failed requests. See Error codes.
usage objectContains statistics about the output. This information is provided only for successful tasks.

Properties

video_duration integerReturned only when using wan2.5 and earlier models. Used for billing.The duration of the generated video in seconds. Valid values are 5 and 10.duration floatReturned only when using the wan2.6 model. Used for billing.Indicates the total video duration, where duration=input_video_duration+output_video_duration.input_video_duration integerReturned only when using the wan2.6 model. Fixed at 0.output_video_duration integerReturned only when using the wan2.6 model.The duration of the output video in seconds. Its value is the same as the value of input.duration.SR integerReturned only when using the wan2.6 model. The resolution tier of the generated video. Example: 720.size stringReturned only when using the wan2.6 model. The resolution of the generated video. The format is "widthheight". Example: 19201080.video_ratio stringReturned only when using wan2.5 and earlier models. The resolution of the generated video. The format is "widthheight". Example: 832480.video_count integerThe number of generated videos. Fixed at 1.
request_idstringUnique request identifier for tracing and troubleshooting.
  • Task successful
  • Task failed
  • Task query expired
Video URLs are valid for only 24 hours and then automatically purged. Save generated videos promptly.
{
    "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": "一幅史诗级可爱的场景。一只小巧可爱的卡通小猫将军,身穿细节精致的金色盔甲,头戴一个稍大的头盔,勇敢地站在悬崖上。他骑着一匹虽小但英勇的战马,说:”青海长云暗雪山,孤城遥望玉门关。黄沙百战穿金甲,不破楼兰终不还。“。悬崖下方,一支由老鼠组成的、数量庞大、无穷无尽的军队正带着临时制作的武器向前冲锋。这是一个戏剧性的、大规模的战斗场景,灵感来自中国古代的战争史诗。远处的雪山上空,天空乌云密布。整体氛围是“可爱”与“霸气”的搞笑和史诗般的融合。",
        "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
    }
}

DashScope SDK

The parameter names in the SDK are mostly consistent with the HTTP API, and the parameter structure is encapsulated to align with the features of the programming language. Because text-to-video tasks can take a long time to complete (typically 1 to 5 minutes), the SDK encapsulates the HTTP asynchronous call process and supports both synchronous and asynchronous invocation methods.
The actual processing time depends on the number of tasks in the queue and the service status. Wait for the result.

Python

Make sure your DashScope Python SDK version is at least2.0.1 before running the following code.If you use an older version, you may encounter errors such as "url error, please check url!". To update the SDK, see Install the SDK.
Set region based on the region where the model is located (passed in when constructing the Client; the region value varies by region):
  • Beijing
  • Singapore
  • Virginia
  • Frankfurt
region="cn-beijing"Replace {WorkspaceId} with your actual workspace ID.
  • Synchronous invocation
  • Asynchronous invocation
Request example
import dashscope
from dashscope import DashScopeError
import os

# 以下为华北2(北京)地域的配置,调用时请将 {WorkspaceId} 替换为真实的业务空间ID,各地域的region取值不同。
client = dashscope.Client(
    # 若没有配置环境变量,请用百炼API Key将下行替换为:api_key="sk-xxx"
    # 各地域的API Key不同。获取API Key:https://help.aliyun.com/zh/model-studio/get-api-key
    api_key=os.getenv("DASHSCOPE_API_KEY"),
    workspace="{WorkspaceId}",
    region="cn-beijing",
)

def sample_sync_call_t2v():
    # generate 为一步式调用(提交任务并等待完成),返回已完成的 Job
    print('please wait...')
    # audio_url / negative_prompt 为 input 段字段,不在具名签名内,经 extra_input 透传
    try:
        job = client.videos.generate(model='wan2.6-t2v',
                                     prompt='一幅史诗级可爱的场景。一只小巧可爱的卡通小猫将军,身穿细节精致的金色盔甲,头戴一个稍大的头盔,勇敢地站在悬崖上。他骑着一匹虽小但英勇的战马,说:”青海长云暗雪山,孤城遥望玉门关。黄沙百战穿金甲,不破楼兰终不还。“。悬崖下方,一支由老鼠组成的、数量庞大、无穷无尽的军队正带着临时制作的武器向前冲锋。这是一个戏剧性的、大规模的战斗场景,灵感来自中国古代的战争史诗。远处的雪山上空,天空乌云密布。整体氛围是“可爱”与“霸气”的搞笑和史诗般的融合。',
                                     extra_input={'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',
                                                  'negative_prompt': ""},
                                     size='1280*720',
                                     duration=10,
                                     prompt_extend=True,
                                     watermark=False,
                                     seed=12345)
        print(job)
        print(job.video_url)
    except DashScopeError as e:
        print(f"HTTP返回码:{e.status_code}")
        print(f"错误码:{e.code}")
        print(f"错误信息:{e.message}")
        print("请参考文档:https://help.aliyun.com/zh/model-studio/developer-reference/error-code")

if __name__ == '__main__':
    sample_sync_call_t2v()
Response example
The video_url is valid for 24 hours. Download promptly.
{
    "request_id": "167f3beb-3dd0-47fe-a83c-xxxxxx",
    "task_id": "5b65411f-d946-4e29-859e-xxxxxx",
    "status": "SUCCEEDED",
    "video_url": "https://dashscope-result-bj.oss-accelerate.aliyuncs.com/xxx.mp4?Expires=xxx",
    "task_metrics": {
        "TOTAL": 1,
        "SUCCEEDED": 1,
        "FAILED": 0
    },
    "usage": {
        "video_count": 1,
        "duration": 10,
        "size": "1280*720",
        "input_video_duration": 0,
        "output_video_duration": 10,
        "SR": 720
    }
}

Java

Ensure your DashScope Java software development kit (SDK) version is at least2.22.14 before you run the following code.If you use an older version, you may encounter errors such as "url error, please check url!". To update the SDK, see Install the SDK.
Set Constants.baseHttpApiUrl based on the region where the model is located:
  • Beijing
  • Singapore
  • Virginia
  • Frankfurt
Constants.baseHttpApiUrl = "https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1";Replace {WorkspaceId} with your actual workspace ID.
  • Synchronous invocation
  • Asynchronous invocation
Request example
// Copyright (c) Alibaba, Inc. and its affiliates.

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 {
        // 以下为华北2(北京)地域的URL,调用时请将 {WorkspaceId} 替换为真实的业务空间ID,各地域的URL不同。获取URL:https://help.aliyun.com/zh/model-studio/text-to-video-api-reference
        Constants.baseHttpApiUrl = "https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1";
    }

    // 若没有配置环境变量,请用百炼API Key将下行替换为:api_key="sk-xxx"
    // 各地域的API Key不同。获取API Key:https://help.aliyun.com/zh/model-studio/get-api-key
    public static String apiKey = System.getenv("DASHSCOPE_API_KEY");

    /**
     * Create a video compositing task and wait for the task to complete.
     */
    public static void text2Video() throws ApiException, NoApiKeyException, InputRequiredException {
        VideoSynthesis vs = new VideoSynthesis();
        Map<String, Object> 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("一幅史诗级可爱的场景。一只小巧可爱的卡通小猫将军,身穿细节精致的金色盔甲,头戴一个稍大的头盔,勇敢地站在悬崖上。他骑着一匹虽小但英勇的战马,说:”青海长云暗雪山,孤城遥望玉门关。黄沙百战穿金甲,不破楼兰终不还。“。悬崖下方,一支由老鼠组成的、数量庞大、无穷无尽的军队正带着临时制作的武器向前冲锋。这是一个戏剧性的、大规模的战斗场景,灵感来自中国古代的战争史诗。远处的雪山上空,天空乌云密布。整体氛围是“可爱”与“霸气”的搞笑和史诗般的融合。")
                        .audioUrl("https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250923/hbiayh/%E4%BB%8E%E5%86%9B%E8%A1%8C.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 is valid for 24 hours. Download promptly.
{
    "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": "一幅史诗级可爱的场景。一只小巧可爱的卡通小猫将军,身穿细节精致的金色盔甲,头戴一个稍大的头盔,勇敢地站在悬崖上。他骑着一匹虽小但英勇的战马,说:”青海长云暗雪山,孤城遥望玉门关。黄沙百战穿金甲,不破楼兰终不还。“。悬崖下方,一支由老鼠组成的、数量庞大、无穷无尽的军队正带着临时制作的武器向前冲锋。这是一个戏剧性的、大规模的战斗场景,灵感来自中国古代的战争史诗。远处的雪山上空,天空乌云密布。整体氛围是“可爱”与“霸气”的搞笑和史诗般的融合。",
        "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": ""
}

Error codes

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

FAQ

A: You cannot convert the link directly. The correct procedure is to have your backend service retrieve the URL, download the video file, and then upload it to a permanent object storage service, such as Alibaba Cloud Object Storage Service (OSS), to generate a new, permanent access link.
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() # 如果HTTP状态码不是200,则引发异常
        with open(save_path, 'wb') as f:
            for chunk in response.iter_content(chunk_size=8192):
                f.write(chunk)
        print(f"视频已成功下载到: {save_path}")
        # 此处可以接上传到永久存储的逻辑
    except requests.exceptions.RequestException as e:
        print(f"下载视频失败: {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: It is not recommended because the link expires after 24 hours. The best practice is to have the backend download and store the video, and then use a permanent link for playback.