Skip to main content

Vidu - Text-to-Video API reference

The Vidu text-to-video model generates a smooth video from a text prompt .

This document applies only to the China (Beijing) region. Use an API key from this region.

Service activation

Go to the Alibaba Cloud Model Studio console, search for Vidu, find the Vidu model card, and click Activate Now. In the dialog box, confirm the activation and authorization.

Prerequisites

To ensure successful calls, make sure the model, endpoint URL, and API key are all in the same region. Cross-region calls will fail.

HTTP calls

Because text-to-video tasks are time-consuming (typically 1–5 minutes), the API uses an asynchronous call. The process consists of two core steps: "Create a task -> Poll for results".

Step 1: Create a task

China (Beijing): POST https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis
  • 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 Call APIs with Postman or cURL.

Request parameters

Request headers
Content-Type string (Required)The content type of the request. Must be application/json.X-DashScope-Async string (Required)Enables asynchronous processing. HTTP requests support only asynchronous calls. Must be 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 model name. Valid values:
  • vidu/viduq3-pro_text2video
  • vidu/viduq3-turbo_text2video
  • vidu/viduq2_text2video
input object (Required)The model's input, such as the prompt.

Properties

prompt string (Required)The text prompt, which describes the desired elements and visual characteristics of the generated video.Both Chinese and English are supported. Each Chinese character or letter is counted as one character. The prompt cannot exceed 5,000 characters; any text beyond this limit is automatically truncated.Example: A kitten running in the moonlight.For more information about how to write prompts, see Vidu Video Generation Prompt Guide.
parameters object (Optional)Parameters for video generation, such as resolution and duration.

Properties

resolution string (Optional)
Resolution directly affects cost. Check Model Pricing before you call the API.
The resolution tier. Valid values:
  • 540P
  • 720P: Default.
  • 1080P
size string (Optional)The resolution of the generated video, in pixels, in the format width*height.The default value depends on resolution:
  • When the resolution is 540P, the size defaults to 1024*576.
  • When resolution=720P, size defaults to 1280*720.
  • When resolution=1080P, size defaults to 1920*1080.

Resolution tier

Aspect ratio

Size (width*height)

540P

16:9

1024*576

9:16

576*1024

1:1

1024*1024

4:3

1024*768

3:4

768*1024

720P

16:9

1280*720

9:16

720*1280

1:1

1280*1280

4:3

1280*960

3:4

960*1280

1080P

16:9

1920*1080

9:16

1080*1920

1:1

1808*1808

4:3

1920*1440

3:4

1440*1920

duration integer (Optional)
Duration directly affects cost, as billing is per second. Check Model Pricing before you call the API.
The duration of the generated video, in seconds.
  • vidu/viduq3-pro_text2video, vidu/viduq3-turbo_text2video: The value is an integer in the range of [1, 16]. The default value is 5.
  • vidu/viduq2_text2video: The value is an integer from 1 to 10. The default value is 5.
audio boolean (Optional)Supported models: vidu/viduq3-pro_text2video, vidu/viduq3-turbo_text2video.Specifies whether to generate a video with audio. If set to true, the model automatically generates matching background music or sound effects based on the video content.
  • false: Default. Outputs a video without audio.
  • true: Outputs a video with audio.
watermark boolean (Optional)Specifies whether to add a watermark. The watermark is placed in the bottom-right corner of the video with the fixed text "Generated by AI".
  • false: Default. No watermark is added.
  • true: Adds a watermark.
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.
  • Text-to-video
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": "vidu/viduq3-turbo_text2video",
    "input": {
        "prompt": "A kitten running in the moonlight"
    },
    "parameters": {
        "size": "1024*576",
        "resolution": "540P",
        "duration": 5,
        "watermark": true
    }
}'

Response parameters

output objectDetails of the task output.

Properties

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

Enumeration values

  • PENDING
  • RUNNING
  • SUCCEEDED
  • FAILED
  • CANCELED
  • UNKNOWN: The task does not exist or its status is unknown.
request_id stringUnique request identifier for tracing and troubleshooting.code stringError code. Returned only for failed requests. See Error codes.message stringDetailed error message. Returned only for failed requests. See Error codes.
  • Successful response
  • Error response
Save the task_id 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 task result

China (Beijing): GET https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/tasks/{task_id}
  • Polling recommendation: Video generation can take several minutes. We recommend using a polling mechanism with a reasonable query interval (e.g., 15 seconds) to retrieve the result.
  • Task status flow: PENDING (queued) → RUNNING (in progress) → SUCCEEDED (succeeded) / FAILED (failed).
  • task_id validity: 24 hours. After this period, you can no longer query the result, and the API returns a task status of UNKNOWN.
  • RPS limit: The query endpoint has a default RPS (Requests Per Second) limit of 20. For higher-frequency queries or event notifications, we recommend that you configure an asynchronous task callback.
  • More operations: For operations such as bulk queries or canceling tasks, see Manage Asynchronous Tasks.

Request parameters

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

Response parameters

outputobjectInformation about the task output.

Properties

task_id stringThe task ID. Valid for queries for 24 hours.task_status stringThe 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 stringThe time when the task was submitted. format is YYYY-MM-DD HH:mm:ss.SSS.scheduled_time stringThe time when the task was executed. format is YYYY-MM-DD HH:mm:ss.SSS.end_time stringThe time when the task was completed. format is YYYY-MM-DD HH:mm:ss.SSS.video_urlstringThe URL of the generated video. This is returned only when the task_status is SUCCEEDED.The video is in MP4 format (H.264 encoded). The video URL is valid for 24 hours. Please download it promptly.orig_prompt stringThe original input prompt, corresponding to the request parameter prompt.code stringError code. Returned only for failed requests. See Error codes.message stringDetailed error message. Returned only for failed requests. See Error codes.
usage objectStatistics for the output, counted only for successful tasks.

Properties

duration integerTotal billable video duration, in seconds. Example: 5.output_video_durationintegerThe duration of the output video, in seconds. Example: 5.size stringThe resolution of the output video. Example: 960*528.fps integerThe frame rate of the output video. Example: 24.SR stringThe resolution tier of the generated video. Example: 540.audio booleanIndicates whether the generated video includes audio. Example: false.video_count integerThe number of generated videos. This value is always 1.
request_id stringUnique request identifier for tracing and troubleshooting.
  • Task succeeded
  • Task failed
  • Task query expired
Video URLs are valid for only 24 hours and then automatically purged. Save generated videos promptly.
{
    "request_id": "eda50dad-a6d3-4e62-a70b-26bbb797ae81",
    "output": {
        "task_id": "d9254244-1f9b-4b4c-be82-d9560ba25708",
        "task_status": "SUCCEEDED",
        "submit_time": "2026-03-27 13:32:13.962",
        "scheduled_time": "2026-03-27 13:32:14.008",
        "end_time": "2026-03-27 13:32:43.375",
        "orig_prompt": "A kitten running in the moonlight",
        "video_url": "https://prod-ss-vidu.s3.cn-northwest-1.amazonaws.com.cn/xxx.mp4?xxx"
    },
    "usage": {
        "duration": 5,
        "size": "960*528",
        "output_video_duration": 5,
        "fps": 24,
        "video_count": 1,
        "audio": false,
        "SR": "540"
    }
}

SDK calls

The parameter names in the SDK are largely consistent with the HTTP interface, and the parameter structure is adapted to the features of each programming language. Because text-to-video tasks are time-consuming (typically 1-5 minutes), the SDK encapsulates the asynchronous HTTP call process and supports both synchronous and asynchronous calls.
The actual processing time depends on the number of tasks in the queue and the service's operational status. Be patient when retrieving the results.

Python

Ensure the DashScope Python SDK version isat least1.25.8 before running the following code.
China (Beijing): dashscope.base_http_api_url = 'https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1'
  • Synchronous call
  • Asynchronous call
Request example
from http import HTTPStatus
from dashscope import VideoSynthesis
import dashscope
import os

# The following is the URL for the China (Beijing) region. Replace {WorkspaceId} with your actual workspace ID.
dashscope.base_http_api_url = 'https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1'

# If you have not configured an environment variable, replace the following line with your Model Studio API key: api_key="sk-xxx"
api_key = os.getenv("DASHSCOPE_API_KEY")

def sample_sync_call_t2v():
    # Make a synchronous call, which waits for and returns the result.
    print('please wait...')
    rsp = VideoSynthesis.call(api_key=api_key,
                              model='vidu/viduq3-turbo_text2video',
                              prompt='A kitten running under moonlight',
                              size='1024*576',
                              duration=5,
                              resolution='540P',
                              watermark=True)
    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 is valid for 24 hours. Download the video promptly.
{
    "status_code": 200,
    "request_id": "15bd86e5-28b1-40ad-a427-xxxxxx",
    "code": null,
    "message": "",
    "output": {
        "task_id": "a876c6ee-1c63-4d17-b6c0-xxxxxx",
        "task_status": "SUCCEEDED",
        "video_url": "https://prod-ss-vidu.s3.cn-northwest-1.amazonaws.com.cn/xxx.mp4?xxx",
        "submit_time": "2026-03-27 13:35:49.508",
        "scheduled_time": "2026-03-27 13:35:49.540",
        "end_time": "2026-03-27 13:36:45.848",
        "orig_prompt": "A kitten running under moonlight"
    },
    "usage": {
        "video_count": 1,
        "video_duration": 0,
        "video_ratio": "",
        "duration": 5,
        "size": "960*528",
        "output_video_duration": 5,
        "fps": 24,
        "audio": false,
        "SR": "540"
    }
}

Java

Ensure the DashScope Java SDK version isat least2.22.6 before running the following code.
China (Beijing): Constants.baseHttpApiUrl = "https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1";
  • 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;

public class Text2Video {

    static {
        // The following is the URL for the China (Beijing) region. Replace {WorkspaceId} with your actual workspace ID.
        Constants.baseHttpApiUrl = "https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1";
    }

    // If you have not configured an environment variable, replace the following line with your Model Studio API key: apiKey="sk-xxx"
    public static String apiKey = System.getenv("DASHSCOPE_API_KEY");

    /**
     * Create a video synthesis task and wait for it to complete.
     */
    public static void text2Video() throws ApiException, NoApiKeyException, InputRequiredException {
        VideoSynthesis vs = new VideoSynthesis();
        VideoSynthesisParam param =
                VideoSynthesisParam.builder()
                        .apiKey(apiKey)
                        .model("vidu/viduq3-turbo_text2video")
                        .prompt("A kitten running under moonlight")
                        .size("1024*576")
                        .resolution("540P")
                        .duration(5)
                        .watermark(true)
                        .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": "bebc5f6b-a081-4b02-ad29-xxxxxx",
    "output": {
        "task_id": "2b0e287f-ebdc-49af-82aa-xxxxxx",
        "task_status": "SUCCEEDED",
        "video_url": "https://prod-ss-vidu.s3.cn-northwest-1.amazonaws.com.cn/infer_92/xxx.mp4?xxx",
        "orig_prompt": "A kitten running under moonlight",
        "submit_time": "2026-03-30 10:19:00.827",
        "scheduled_time": "2026-03-30 10:19:00.879",
        "end_time": "2026-03-30 10:19:28.172"
    },
    "usage": {
        "video_count": 1,
        "duration": 5.0,
        "size": "960*528",
        "input_video_duration": 0.0,
        "output_video_duration": 5.0,
        "SR": "540"
    },
    "status_code": 200,
    "code": "",
    "message": ""
}

Error codes

If a model call fails, see error message for troubleshooting.

FAQ

Q: Must size and resolution be passed together?

A: No. Both are optional parameters, but passing both is recommended to precisely control the aspect ratio of the generated video. For details, see size values. If you do not pass both parameters, the system handles the request in one of the following two ways:
  • Pass only size: The size parameter is ignored, and the system defaults to resolution=720P and uses the corresponding size of 1280*720.
    Example: The API response is size="1280*720", SR=720.
  • Pass only resolution: The system generates a video at the specified resolution tier with a corresponding 16:9 aspect ratio.
    Example: When resolution=540P, the API response is size="960540", SR=540; when resolution=1080P, the API response is size="19201080", SR=1080.
Text Generation
Image Generation
World models
3D Model Generation
Audio
  • Audio generation
Realtime API
Text Embedding
Decision Model
TokenPlan
Model Production