Skip to main content

Wan2.7-T2V API Reference

The Wan2.7-T2V model generates a smooth video based on a text prompt.

Related documents: User Guide

Scope

To ensure successful calls, make sure that the model, Endpoint URL, and API Key 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 launched workspace-dedicated domains for the China (Beijing) and Singapore regions, which deliver superior performance and higher stability for inference requests. We recommend that you migrate to the new domains:
  • China (Beijing) region: migrate from https://dashscope.aliyuncs.com to https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com
  • Singapore region: migrate from https://dashscope-intl.aliyuncs.com to https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com
Among them, {WorkspaceId} is your workspace ID, which you can view on the Workspace Details page in the Alibaba Cloud Model Studio console. The existing domain remains available.

HTTP calls

This API uses the new protocol and supports only the wan2.7 model.
T2V tasks take a long time to complete (usually 1 to 5 minutes), so the API uses asynchronous calls. The entire process consists of two core steps: "Create a task -> poll for the result", as follows:

Step 1: Create a task and obtain the task ID

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

Request parameters

Request Headers
Content-Typestring(Required)The request content type. This parameter must be set to application/json.Authorizationstring(Required)Request authentication. The API uses an Alibaba Cloud Model Studio API key for authentication. Example: Bearer sk-xxxx.X-DashScope-Asyncstring(Required)Asynchronous processing configuration parameter. HTTP requests only support asynchronous mode, and it must be set to enable.
If this request header is missing, the following error is returned: "current user api does not support synchronous calls".
Request Body
model string (Required)The model name. For available models, see Models.Example values: wan2.7-t2v, wan2.7-t2v-2026-06-12.input object (required)Basic input information, such as the prompt.

Properties

prompt string (required)The text prompt. It describes the elements and visual features you expect in the generated video.Supports Chinese and English. Each Chinese character or letter counts as one character, and any excess is automatically truncated. The length limit varies by model version:
  • wan2.7-t2v, wan2.7-t2v-2026-06-12: no more than 5000 characters.
Example value: A little cat running in the moonlight.For tips on using prompts, see the T2V/I2V Prompt Guide.negative_prompt string (optional)The negative prompt, which describes content you do not want to see in the video and constrains the video output.Supports Chinese and English, with a maximum length of 500 characters; any excess is automatically truncated.Example values: low resolution, fault, worst quality, low quality, incomplete, extra fingers, poor proportions, etc.audio_url string (optional)The audio file URL. The model uses this audio to generate the video.Supported input formats:
  1. Public URL:
  2. Temporary URL:
Audio limits:
  • Format: WAV, MP3.
  • Duration: 2 to 30 seconds.
  • File size: Up to 15 MB.
  • Over-limit handling: If the audio is longer than the duration value (for example, 5 seconds), only the first 5 seconds are used and the rest is discarded. If the audio is shorter than the video duration, the part beyond the audio length is silent. For example, if the audio is 3 seconds and the video is 5 seconds, the first 3 seconds of the output video have sound and the last 2 seconds are silent.
parameters object (Optional)Video processing parameters, such as setting the video resolution, enabling prompt rewriting, and adding a watermark.

Properties

resolution string (Optional)
resolution directly affects the cost. Check model pricing before calling.
The resolution tier of the generated video, which controls the video clarity (total pixels).
  • wan2.7-t2v, wan2.7-t2v-2026-06-12: Valid values: 720P, 1080P. Default: 1080P.
ratio string (Optional)The aspect ratio of the generated video.
  • 16:9 (default)
  • 9:16
  • 1:1
  • 4:3
  • 3:4
The output video resolutions (width and height in pixels) for each aspect ratio are listed in the table below.

Resolution tier

Aspect ratio

Output video resolution (width*height)

720P

16:9

1280*720

9:16

720*1280

1:1

960*960

4:3

1104*832

3:4

832*1104

1080P

16:9

1920*1080

9:16

1080*1920

1:1

1440*1440

4:3

1648*1248

3:4

1248*1648

duration integer (Optional)
duration directly affects the cost. Billing is per second. Check model pricing before calling.
The duration of the generated video, in seconds.
  • wan2.7-t2v, wan2.7-t2v-2026-06-12: an integer in the range [2, 15]. The default value is 5.
prompt_extendboolean (Optional)Whether to enable prompt rewriting. When enabled, an LLM rewrites the input prompt. This significantly improves generation quality for short prompts but increases processing time.
  • true: Default. Enable prompt rewriting.
  • false: Disable prompt rewriting.
watermark boolean (Optional)Whether to add a watermark. The watermark is in the lower-right corner of the video with the fixed text "AI Generated".
  • false: Default. No watermark.
  • true: Add a watermark.
seedinteger (Optional)The random number seed, in the range [0, 2147483647].If not specified, the system generates a random seed. To improve the reproducibility of generation results, use a fixed seed value.Note that model generation is probabilistic. Even with the same seed, identical results are not guaranteed each time.
  • Multi-shot narrative
  • Provide an audio file
  • Automatic dubbing
  • Use a negative prompt
  • dashscope CLI
Control the shot structure with natural language in prompt. There is no need to set the shot_type parameter, and setting it has no effect.
  • Single shot: Input "Generate a single-shot video".
  • Multi-shot: Input "Generate a multi-shot video" or describe shots with timestamps (for example, "Shot 1 [0-3 seconds] wide shot: A rainy New York street at night").
  • Default: If unspecified, the model interprets the prompt content.
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.7-t2v-2026-06-12",
    "input": {
        "prompt": "一段紧张刺激的侦探追查故事,展现电影级叙事能力。第1个镜头[0-3秒] 全景:雨夜的纽约街头,霓虹灯闪烁,一位身穿黑色风衣的侦探快步行走。 第2个镜头[3-6秒] 中景:侦探进入一栋老旧建筑,雨水打湿了他的外套,门在他身后缓缓关闭。 第3个镜头[6-9秒] 特写:侦探的眼神坚毅专注,远处传来警笛声,他微微皱眉思考。 第4个镜头[9-12秒] 中景:侦探在昏暗走廊中小心前行,手电筒照亮前方。 第5个镜头[12-15秒] 特写:侦探发现关键线索,脸上露出恍然大悟的表情。"
    },
    "parameters": {
        "resolution": "720P",
        "ratio": "16:9",
        "prompt_extend": true,
        "watermark": true,
        "duration": 15
    }
}'

Response parameters

output objectTask output information.

Properties

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

Enumeration values

  • PENDING: Task queued
  • RUNNING: Task processing
  • SUCCEEDED: Task completed successfully
  • FAILED: Task failed
  • CANCELED: Task canceled
  • UNKNOWN: The task does not exist or its status is unknown
request_idstringUnique request identifier. Useful for tracing request details and troubleshooting.codestringThe error code returned for failed requests. This parameter is not returned for successful requests. For details, see Error codes.messagestringDetailed error information returned for failed requests. This parameter is not returned for successful requests. For details, see Error codes.
  • Successful response
  • Error response
Save the task_id for querying 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
GET https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/tasks/{task_id}
Replace {WorkspaceId} with your actual workspace ID when calling.
  • Polling recommendation: Video generation takes several minutes. We recommend using a polling mechanism and setting a reasonable query interval (such as 15 seconds) to obtain the result.
  • Task status flow: PENDING (Queuing) → RUNNING (Processing) → SUCCEEDED (Success) / FAILED (Failed).
  • Result link: A video URL is returned after the task succeeds, valid for 24 hours. We recommend downloading it immediately and transferring it to permanent storage (such as Alibaba Cloud OSS).
  • task_id validity: 24 hours. After it expires, the result can no longer be queried, and the API returns the task status as UNKNOWN.
  • RPS limit: The default RPS of the query API is 20. For higher-frequency queries or event notifications, we recommend configuring asynchronous task callbacks.
  • More operations: For operations such as batch queries and task cancellation, see Manage asynchronous tasks.

Request parameters

Headers
Authorizationstring(Required)Request authentication. The API uses an Alibaba Cloud Model Studio API key for authentication. Example: Bearer sk-xxxx.
URL path parameters
task_id string(Required)The task ID.
  • Query task result
Replace {task_id} with the exact task_id value returned by the previous API call. The task_id is valid for queries for 24 hours. Also 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

outputobjectTask output information.

Properties

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

Enumeration values

  • PENDING: Task queued
  • RUNNING: Task processing
  • SUCCEEDED: Task completed successfully
  • FAILED: Task failed
  • CANCELED: Task canceled
  • UNKNOWN: The task does not exist or its status is unknown
State transitions during polling:
  • PENDING (queued) → RUNNING (processing) → SUCCEEDED (success) / FAILED (failure).
  • The first query usually returns PENDING (queued) or RUNNING (processing).
  • When the status becomes SUCCEEDED, the response contains the generated video URL.
  • If the status is FAILED, check the error message and retry.
  • If the status is CANCELED, the task has been canceled. To continue, submit a new task.
  • If the status is UNKNOWN, the task does not exist or its status is unknown. This may occur when the task_id does not exist or has expired after the 24-hour validity period.
submit_time stringThe task submission time. The format is YYYY-MM-DD HH:mm:ss.SSS.scheduled_time stringThe task execution time. The format is YYYY-MM-DD HH:mm:ss.SSS.end_time stringThe task completion time. The format is YYYY-MM-DD HH:mm:ss.SSS.video_urlstringThe video URL. Returned only when task_status is SUCCEEDED.The link is valid for 24 hours and can be used to download the video. The video format is MP4 (H.264 encoding).orig_prompt stringThe original input prompt, corresponding to the request parameter prompt.codestringThe error code returned for failed requests. This parameter is not returned for successful requests. For details, see Error codes.messagestringDetailed error information returned for failed requests. This parameter is not returned for successful requests. For details, see Error codes.
usage objectOutput statistics. Only successful results are counted.

Properties

duration floatThe total duration of the output video, used for billing.Specifically, duration=output_video_duration.input_video_duration integerFixed at 0.output_video_duration integerThe duration of the output video, in seconds. Equal to the value of input.duration.SR integerThe resolution tier of the generated video. Example: 720.ratio stringThe aspect ratio of the generated video. Example: 16:9.video_count integerThe number of videos generated. Fixed at 1.
request_idstringUnique request identifier. Useful for tracing request details and troubleshooting.
  • Task executed successfully
  • Task execution failed
  • Task query expired
The video URL is retained for only 24 hours and is automatically deleted after that. Save the generated video 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,
        "input_video_duration": 0,
        "output_video_duration": 10,
        "video_count": 1,
        "ratio": "16:9",
        "SR": 720
    }
}

DashScope SDK invocation

SDK parameter names are basically the same as those of the HTTP API, with parameter structures encapsulated according to the conventions of each language. Because text-to-video tasks are time-consuming (usually 1 to 5 minutes), the SDK encapsulates the asynchronous HTTP call flow at the underlying layer and supports both synchronous and asynchronous invocation.
The actual processing time depends on the number of queued tasks and service execution. Be patient while waiting for the result.

Python SDK invocation

Make sure the DashScope Python SDK version is no earlier than 2.0.1 before running the following code.
Set region based on the region of the model (pass it in when constructing the Client; the region value varies by region):
  • Beijing
  • Singapore
region="cn-beijing"
Replace {WorkspaceId} with your actual workspace ID when calling.
  • Synchronous invocation
  • Asynchronous invocation
Request example
import dashscope
import os
from dashscope import DashScopeError

# 以下为华北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...')
    try:
        # audio_url / negative_prompt 为 input 段字段,不在具名签名内,经 extra_input 透传
        job = client.videos.generate(model='wan2.7-t2v-2026-06-12',
                                     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': ""},
                                     resolution='720P',
                                     ratio='16:9',
                                     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 the video promptly.
{
    "request_id": "72082605-4559-9bb7-aa5c-xxxxxx",
    "task_id": "43b954a2-3e86-4681-9443-xxxxxx",
    "status": "SUCCEEDED",
    "results": [
        {
            "video_url": "https://dashscope-a717.oss-accelerate.aliyuncs.com/xxx.mp4?Expires=xxxx"
        }
    ],
    "task_metrics": {
        "TOTAL": 1,
        "SUCCEEDED": 1,
        "FAILED": 0
    },
    "usage": {
        "video_count": 1,
        "video_duration": 0,
        "video_ratio": "",
        "duration": 10,
        "input_video_duration": 0,
        "output_video_duration": 10,
        "SR": 720,
        "ratio": "16:9"
    }
}

Java SDK invocation

Make sure the DashScope Java SDK version is no earlier than 2.22.14 before running the following code.
Set Constants.baseHttpApiUrl based on the region of the model:
  • Beijing
  • Singapore
Constants.baseHttpApiUrl = "https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1";
Replace {WorkspaceId} with your actual workspace ID when calling.
  • 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 {
        // 以下为北京地域url,各地域的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();

        VideoSynthesisParam param =
                VideoSynthesisParam.builder()
                        .apiKey(apiKey)
                        .model("wan2.7-t2v-2026-06-12")
                        .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("")
                        .resolution("720P")
                        .ratio("16:9")
                        .duration(10)
                        .promptExtend(true)
                        .watermark(false)
                        .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 the video 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-04-16 23:13:40.553",
        "scheduled_time": "2026-04-16 23:13:49.415",
        "end_time": "2026-04-16 23:17:56.380"
    },
    "usage": {
        "video_count": 1,
        "duration": 10.0,
        "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 troubleshooting.

FAQ

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

A: There are two main changes. Adjust these parameters during migration:
  • Change how the output video resolution is controlled: wan2.7 no longer uses the size field. Instead, the output video resolution is defined by combining resolution (resolution tier) and ratio (aspect ratio). Earlier models used the size field directly.
  • Shot type field removed: wan2.7 no longer supports the shot_type field, which is deprecated. Describe the shot type directly in the prompt. Earlier models supported controlling the shot type through this field.