Skip to main content

Wan2.7-T2V API Reference

The Wan2.7 text-to-video 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 belong to the same region. Cross-region calls will fail.
The sample code in this document applies to the Singapore region.
Alibaba Cloud Model Studio provides workspace-specific domain names 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 domain names:
  • 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
Where {WorkspaceId} is your workspace ID, which you can view on the Workspace Details page in the Alibaba Cloud Model Studio console. The existing domain names remain available.

HTTP invocation

This API uses the new protocol and supports only wan2.7 models.
Because text-to-video tasks take a long time to complete (typically 1 to 5 minutes), the API uses asynchronous calls. The overall 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

  • Singapore
  • Beijing
  • dashscope CLI
POST https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis
When making calls, replace {WorkspaceId} with your actual workspace ID.
  • After the task is created successfully, use the task_id returned by the API to query the result. The task_id is valid for 24 hours. Do not create the task repeatedly; just poll for the result.
  • For a beginner's guide, see Postman.

Request parameters

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

Property

prompt string (Required)The text prompt. It describes the elements and visual features that you want to include in the generated video.Both Chinese and English are supported. 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 prompt usage tips, see the T2V/I2V Prompt Guide.negative_prompt string (Optional)The negative prompt, which describes content that you do not want to see in the video, and can be used to constrain the video visuals.Both Chinese and English are supported. The length must not exceed 500 characters, and any excess is automatically truncated.Example values: low resolution, fault, worst quality, low quality, incomplete, extra fingers, bad 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:
Audio restrictions:
  • Format: wav, mp3.
  • Duration: 2 to 30 s.
  • File size: no more than 15 MB.
  • Exceeding the limit: If the audio length exceeds the duration value (for example, 5 seconds), the first 5 seconds are automatically captured and the rest is discarded. If the audio is shorter than the video duration, the part beyond the audio length is silent video. For example, if the audio is 3 seconds and the video duration 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 smart rewriting, and adding a watermark.

Property

resolution string (Optional)
The resolution directly affects the fee. Please confirm the Model Price before calling.
The resolution tier of the generated video, which is used to control the video clarity (total pixels).
  • wan2.7-t2v, wan2.7-t2v-2026-06-12: Available values: 720P, 1080P. Default value is 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 resolution (width and height in pixels) corresponding to each aspect ratio is shown 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)
The duration directly affects the fee, which is billed per second. Please confirm the Model Price before calling.
The duration of the generated video, in seconds.
  • wan2.7-t2v, wan2.7-t2v-2026-06-12: An integer between [2, 15]. Default value is 5.
prompt_extendboolean (Optional)Whether to enable intelligent prompt rewriting. When enabled, a large model is used to intelligently rewrite the input prompt. It significantly improves the generation result for short prompts, but increases the processing time.
  • true: Default value, intelligent rewriting enabled.
  • false: Intelligent rewriting disabled.
watermark boolean (Optional)Whether to add a watermark. The watermark is located in the lower-right corner of the video, with the fixed text "AI-generated".
  • false: Default value, no watermark added.
  • true: Add a watermark.
seedinteger (Optional)The random seed, with a value range of [0, 2147483647].If not specified, the system automatically generates a random seed. To improve the reproducibility of the generation result, it is recommended to use a fixed seed value.Note that model generation is probabilistic: even with the same seed, the generation result is not guaranteed to be exactly the same each time.
  • Multi-shot narrative
  • Pass in an audio file
  • Automatic dubbing
  • Use negative prompts
The shot structure is controlled through natural language in the prompt. The shot_type parameter is not required, and it has no effect even if configured.
  • Single shot: Enter "Generate a single-shot video".
  • Multiple shots: Enter "Generate a multi-shot video", or use timestamps to describe the shots (for example, "Shot 1 [0-3 seconds] Wide shot: a rainy night street in New York")
  • Default: If not specified, the model interprets on its own based on the prompt content.
curl --location 'https://{WorkspaceId}.ap-southeast-1.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 objectnode output information.

Property

task_id stringnode ID. The validity period for queries is 24 hours.task_status stringnode status.

Enum values

  • PENDING: node queuing
  • RUNNING: node processing
  • SUCCEEDED: node execution succeeded
  • FAILED: node execution failed
  • CANCELED: node canceled
  • UNKNOWN: node does not exist or its status is unknown
request_idstringThe unique request identifier. It can be used for request detail tracing and troubleshooting.codestringThe error code returned when the request fails. This parameter is not returned when the request succeeds. For details, see Error codes.messagestringDetailed error information returned when the request fails. This parameter is not returned when the request succeeds. For details, see Error codes.
  • Successful response
  • Error response
Please save the task_id to query the node status and results.
{
    "output": {
        "task_status": "PENDING",
        "task_id": "0385dc79-5ff8-4d82-bcb6-xxxxxx"
    },
    "request_id": "4909100c-7b5a-9f92-bfe5-xxxxxx"
}

Step 2: Query results by node ID

  • Singapore
  • Beijing
GET https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/tasks/{task_id}
When making calls, replace {WorkspaceId} with your actual workspace ID.
  • Polling recommendations: Video generation takes several minutes. We recommend using the polling mechanism and setting a reasonable query interval (for example, 15 seconds) to obtain the results.
  • Node status transitions: PENDING (queuing) → RUNNING (processing) → SUCCEEDED (success) / FAILED (failed).
  • Result link: After the node succeeds, the video URL is returned and is valid for 24 hours. We recommend that you download the video immediately after obtaining the link and save it to permanent storage (such as Alibaba Cloud OSS).
  • task_id validity: 24 hours. After the timeout, results can no longer be queried, and the API returns the node status as UNKNOWN.

Request parameters

Headers
Authorizationstring(Required)Request authentication. The API uses the Alibaba Cloud Model Studio API Key for authentication. Example value: Bearer sk-xxxx.
URL path parameters
task_id string (required)node ID.
  • Query node results
Replace {task_id} entirely with the value of task_id returned by the API in the previous step. The validity period for task_id queries is 24 hours. Also replace {WorkspaceId} with the actual workspace ID.
curl -X GET https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/tasks/{task_id} \
--header "Authorization: Bearer $DASHSCOPE_API_KEY"

Response parameters

outputobjectnode output information.

Property

task_id stringnode ID. The validity period for queries is 24 hours.task_status stringnode status.

Enum values

  • PENDING: node queuing
  • RUNNING: node processing
  • SUCCEEDED: node execution succeeded
  • FAILED: node execution failed
  • CANCELED: node canceled
  • UNKNOWN: node does not exist or its status is unknown
Status 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 contains the URL of the generated video.
  • If the status is FAILED, check the error information and retry.
  • If the status is CANCELED, the node has been canceled. To continue, submit a new node.
  • If the status is UNKNOWN, the node does not exist or its status is unknown. This may occur when the task_id does not exist or has exceeded the 24-hour validity period.
submit_time stringThe time when the node was submitted. The time zone is UTC+8, in the format YYYY-MM-DD HH:mm:ss.SSS.scheduled_time stringTask execution time. The time zone is UTC+8, and the format is YYYY-MM-DD HH:mm:ss.SSS.end_time stringTask completion time. The time zone is UTC+8, and 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 you can download the video from this URL. The video format is MP4 (H.264 encoding).orig_prompt stringThe original input prompt, corresponding to the request parameter prompt.codestringThe error code returned when the request fails. This parameter is not returned when the request succeeds. For details, see Error codes.messagestringDetailed error information returned when the request fails. This parameter is not returned when the request succeeds. For details, see Error codes.
usage objectOutput information statistics. Only successful results are counted.

Property

duration floatThe total video duration of the output video, used for billing.Among them, duration=output_video_duration.input_video_duration integerFixed to 0.output_video_duration integerThe duration of the output video, in seconds. Its value is equal to the value of input.duration.SR integerThe resolution tier of the generated video. Example value: 720.ratio stringThe aspect ratio of the generated video. Example value: 16:9.video_count integerThe number of generated videos. Fixed to 1.
request_idstringThe unique request identifier. It can be used for request detail tracing and troubleshooting.
  • Task execution succeeded
  • Task execution failed
  • Task query expired
The video URL is retained for only 24 hours and will be automatically cleared after the timeout. Please save the generated video in a timely manner.
{
    "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 calls

The parameter naming of the SDK is basically the same as that of the HTTP interface, and the parameter structure is encapsulated according to the characteristics of each language. Since T2V tasks take a long time (usually 1-5 minutes), the SDK encapsulates the HTTP asynchronous call process at the underlying layer and supports both synchronous and asynchronous calling methods.
The specific time consumption depends on the number of queued tasks and service execution conditions. Please wait patiently when obtaining the results.

Python SDK calls

Please 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 where the model is located (pass it in when constructing the Client; the region value varies by region):
  • Singapore
  • Beijing
region="ap-southeast-1"
When making calls, replace {WorkspaceId} with your actual workspace ID.
  • Synchronous Call
  • Asynchronous Call
Request example
import dashscope
import os
from dashscope import DashScopeError

# The following configuration is for the Singapore (ap-southeast-1) region. Replace {WorkspaceId} with your actual workspace ID. The region value varies by region.
client = dashscope.Client(
    # If you have not set an environment variable, replace the following line with your Model Studio API key: api_key="sk-xxx"
    # API keys are region-specific. To get an API key, see https://www.alibabacloud.com/help/model-studio/get-api-key
    api_key=os.getenv("DASHSCOPE_API_KEY"),
    workspace="{WorkspaceId}",
    region="ap-southeast-1",
)

def sample_sync_call_t2v():
    # generate is a one-step call (submits the task and waits for completion) that returns a completed Job.
    print('please wait...')
    try:
        # audio_url and negative_prompt are input-section fields, not in the named signature; pass them through extra_input.
        job = client.videos.generate(model='wan2.7-t2v-2026-06-12',
                                     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 '.",
                                     extra_input={'audio_url': 'https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250929/stjqnq/%E7%8B%90%E7%8B%B8.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 status code: {e.status_code}")
        print(f"Error code: {e.code}")
        print(f"Error message: {e.message}")
        print("See the documentation: https://www.alibabacloud.com/help/model-studio/developer-reference/error-code")

if __name__ == '__main__':
    sample_sync_call_t2v()
Response example
The video_url is valid for 24 hours. Please download the video in a timely manner.
{
    "request_id": "167f3beb-3dd0-47fe-a83c-xxxxxx",
    "task_id": "5b65411f-d946-4e29-859e-xxxxxx",
    "status": "SUCCEEDED",
    "results": [
        {
            "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,
        "video_duration": 0,
        "video_ratio": "",
        "duration": 10,
        "input_video_duration": 0,
        "output_video_duration": 10,
        "SR": 720,
        "ratio": "16:9"
    }
}

Java SDK invocation

Ensure that the DashScope Java SDK version is no earlier than 2.22.14 before running the following code.If the version is too old, errors such as "url error, please check url!" may occur. See Install SDK to update it.
Set Constants.baseHttpApiUrl based on the region where the model is located:
  • Singapore
  • Beijing
Constants.baseHttpApiUrl = "https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1";
When making calls, replace {WorkspaceId} with your actual workspace ID.
  • Synchronous Call
  • Asynchronous Call
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 {
        // Singapore region URL. URLs vary by region. For more information, see https://www.alibabacloud.com/help/model-studio/text-to-video-api-reference.
        Constants.baseHttpApiUrl = "https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1";
    }

    // If the environment variable is not configured, replace the following line with your Model Studio API key: api_key="sk-xxx"
    // API keys differ by region. Get an API key: https://www.alibabacloud.com/help/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();

        VideoSynthesisParam param =
                VideoSynthesisParam.builder()
                        .apiKey(apiKey)
                        .model("wan2.7-t2v-2026-06-12")
                        .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("")
                        .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. Please download the video in a timely manner.
{
    "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-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: When upgrading from wan2.6 to wan2.7, what changes do I need to make in the code?

A: There are mainly two changes, and you need to adjust the parameters during migration:
  • Change in how the output video resolution is controlled: wan2.7 no longer uses the size field; instead, it defines the output video resolution by combining the resolution (resolution tier) and ratio (aspect ratio) fields, while earlier models use the size field directly.
  • Removal of the shot type field: wan2.7 no longer supports the shot_type field. This parameter is deprecated, and you can describe the shot type directly in the prompt; earlier models support controlling the shot type through this field.