PixVerse text-to-video API reference
The PixVerse text-to-video model generates a smooth video based on text prompts .
ImportantThis document applies only to the China (Beijing) region. Use an API key from this region.
Activate the service
- Go to the Alibaba Cloud Model Studio console, search for PixVerse, find the PixVerse model card, and click Activate Now.
- In the pop-up window, confirm the activation and authorization.
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.
- Select a model: Confirm the region where the model belongs.
- Select a URL: Choose the corresponding regional Endpoint URL. HTTP URLs and DashScope SDK URLs are supported.
- Configure an API key: Select a region and obtain an API key. Then, configure the API key as an environment variable (This method is being deprecated and will be merged into the standard API key configuration).
- Install the SDK: To make calls using an SDK, install the DashScope SDK.
NoteThe sample code in this topic applies to the China (Beijing) region.
HTTP calls
Because text-to-video tasks take a long time (typically 1 to 5 minutes), the API uses asynchronous calls. The entire process involves two core steps: Create a task -> Poll for the result. The steps are as follows:
Step 1: Create a task to get a task ID
Beijing region: POST https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis
Replace {WorkspaceId} with your actual workspace ID.
Note
- After the task is created successfully, use the
task_idreturned 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.
Request parametersHeadersContent-Type The content type of the request. Must be Authorization Authenticates the request with a Model Studio API key. Example: Bearer sk-xxxx. X-DashScope-Async Asynchronous processing configuration parameter. HTTP requests support asynchronous mode only, and this parameter must be set to ImportantIf this request header is missing, the error "current user api does not support synchronous calls" is returned. Request Bodymodel The model name. Valid values:
input The basic input information, such as the prompt. parameters The video generation parameters, such as the video resolution, duration, and whether to generate audio. | Text-to-video (v6-max)Supported model: pixverse/pixverse-v6-max-t2v. Text-to-videoSupported models: pixverse/pixverse-c1-t2v, pixverse/pixverse-v6-t2v, pixverse/pixverse-v5.6-t2v. Text-to-video (multi-shot)pixverse-c1Supported model: pixverse/pixverse-c1-t2v. Describe the multi-shot scene in the pixverse-v6Supported model: pixverse/pixverse-v6-t2v. Describe the multi-shot scene in the |
Response parametersoutput The output of the task. request_id Unique request identifier for tracing and troubleshooting. code Error code. Returned only for failed requests. See Error codes. message Detailed error message. Returned only for failed requests. See Error codes. | Successful responseSave the task_id, which is used to query the task status and results. Error responseTask creation failed. See Error codes. |
Step 2: Query the result by task ID
Beijing region: GET https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/tasks/{task_id}
Note
- Polling suggestion: Video generation takes several minutes. We recommend using a polling mechanism with a reasonable query interval (for example, 15 seconds) to obtain the result.
- Task status flow: PENDING (in queue) -> RUNNING (processing) -> SUCCEEDED (successful) / FAILED (failed).
- task_id validity: 24 hours. After this period, you cannot query the result, and the API will return the task status as
UNKNOWN. - RPS limit: The default records per second (RPS) for the query API is 20. For higher frequency queries or event notifications, we recommend configuring an asynchronous task callback.
- More operations: For batch queries, canceling tasks, and other operations, see Manage asynchronous tasks.
Request parametersHeadersAuthorization Authenticates the request with a Model Studio API key. Example: Bearer sk-xxxx. Path parameterstask_id The ID of the task. | Query task resultReplace |
Response parametersoutput The output of the task. usage Statistics for the output information. Only successful results are counted. request_id Unique request identifier for tracing and troubleshooting. | Task successfulTask failedIf the task fails, task_status will be set to FAILED, and an error code and message will be provided. See Error codes for troubleshooting. Task query expiredThe task_id can be queried within 24 hours. Once it expires, it can no longer be queried, and the following error message is returned. |
DashScope SDK calls
The parameter names in the SDK are mostly consistent with the HTTP API. The parameter structure is adapted to the features of each programming language.
Because text-to-video tasks take a long time (typically 1 to 5 minutes), the SDK encapsulates the HTTP asynchronous call process and supports both synchronous and asynchronous call methods.
The specific time required depends on the number of tasks in the queue and the service execution status. Please be patient while waiting for the result.
Python SDK calls
ImportantMake sure that your DashScope Python SDK version is 2.0.1or later before running the following code.
Beijing region: region="cn-beijing"
Replace {WorkspaceId} with your actual workspace ID. The region value varies by region.
Synchronous call
Request example
import os
import dashscope
from dashscope import DashScopeError
# 以下为华北2(北京)地域的配置。请将 {WorkspaceId} 替换为您的百炼业务空间ID,各地域的region取值不同。
# 若没有配置环境变量,请用百炼API Key将下行替换为:api_key="sk-xxx"
# 获取API Key:https://help.aliyun.com/zh/model-studio/get-api-key
client = dashscope.Client(
api_key=os.getenv("DASHSCOPE_API_KEY"),
workspace="{WorkspaceId}",
region="cn-beijing",
)
def sample_sync_call_t2v():
# call sync api, will return the result
print('please wait...')
# generate 为一步式调用(提交任务并等待完成),返回已完成的 Job
try:
job = client.videos.generate(model='pixverse/pixverse-v6-max-t2v',
prompt='下着雨,赛博城市里,一只浣熊在栏杆上行走。突然他眼睛发出蓝光,变身成一架高科技无人机,快速飞离画面。',
resolution='720P',
duration=5,
watermark=False,
parameters={'aspect_ratio': '16:9', 'audio': False})
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
video_urldoes not expire, but it is not intended for long-term storage. We recommend that you download the video promptly.
{
"request_id": "2b68d32e-86c8-4383-8a18-xxxxxx",
"task_id": "ec40bb42-02d4-44d8-bf35-xxxxxx",
"status": "SUCCEEDED",
"results": [
{
"video_url": "https://media.pixverseai.cn/xxx.mp4"
}
],
"task_metrics": {
"TOTAL": 1,
"SUCCEEDED": 1,
"FAILED": 0
},
"usage": {
"video_count": 1,
"video_duration": 0,
"video_ratio": "",
"duration": 10,
"size": "1280*720",
"fps": 24,
"audio": false,
"SR": "720"
}
}
Asynchronous call
Request example
import os
import dashscope
from dashscope import DashScopeError
# 以下为华北2(北京)地域的配置。请将 {WorkspaceId} 替换为您的百炼业务空间ID,各地域的region取值不同。
# 若没有配置环境变量,请用百炼API Key将下行替换为:api_key="sk-xxx"
# 获取API Key:https://help.aliyun.com/zh/model-studio/get-api-key
client = dashscope.Client(
api_key=os.getenv("DASHSCOPE_API_KEY"),
workspace="{WorkspaceId}",
region="cn-beijing",
)
def sample_async_call_t2v():
# call async api, will return the task information
# you can get task status with the returned task id.
try:
job = client.videos.jobs.create(model='pixverse/pixverse-v6-max-t2v',
prompt='下着雨,赛博城市里,一只浣熊在栏杆上行走。突然他眼睛发出蓝光,变身成一架高科技无人机,快速飞离画面。',
resolution='720P',
duration=5,
watermark=True,
parameters={'aspect_ratio': '16:9', 'audio': False})
print(job)
print("task_id: %s" % job.task_id)
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")
return
# get the task information include the task status.
try:
snapshot = client.videos.jobs.fetch(job.task_id)
print(snapshot.status) # check the task status
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")
# wait the task complete, will call fetch interval, and check it's in finished status.
try:
done = client.videos.jobs.wait(job)
print(done)
print(done.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_async_call_t2v()
Response example
- Response example for creating a task
{
"request_id": "c86ff7ba-8377-917a-90ed-xxxxxx",
"task_id": "721164c6-8619-4a35-a6d9-xxxxxx",
"status": "PENDING"
}
- Response example for querying a task result
video_urldoes not expire but is not intended for long-term storage. You should download the video promptly.
{
"request_id": "2b68d32e-86c8-4383-8a18-xxxxxx",
"task_id": "ec40bb42-02d4-44d8-bf35-xxxxxx",
"status": "SUCCEEDED",
"results": [
{
"video_url": "https://media.pixverseai.cn/xxx.mp4"
}
],
"task_metrics": {
"TOTAL": 1,
"SUCCEEDED": 1,
"FAILED": 0
},
"usage": {
"video_count": 1,
"video_duration": 0,
"video_ratio": "",
"duration": 10,
"size": "1280*720",
"fps": 24,
"audio": false,
"SR": "720"
}
}
Java SDK calls
ImportantMake sure that your DashScope Java SDK version is 2.22.6or later before running the following code.
Beijing region: Constants.baseHttpApiUrl = "https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1";
Replace {WorkspaceId} with your actual workspace ID.
Synchronous call
Request example
// 调用时请将 {WorkspaceId} 替换为真实的业务空间ID。
// 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
Constants.baseHttpApiUrl = "https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1";
}
// 若没有配置环境变量,请用百炼API Key将下行替换为:api_key="sk-xxx"
// 获取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("aspect_ratio", "16:9");
VideoSynthesisParam param =
VideoSynthesisParam.builder()
.apiKey(apiKey)
.model("pixverse/pixverse-v6-max-t2v")
.prompt("下着雨,赛博城市里,一只浣熊在栏杆上行走。突然他眼睛发出蓝光,变身成一架高科技无人机,快速飞离画面。")
.resolution("720P")
.duration(5)
.audio(true)
.watermark(true)
.seed(12345)
.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
video_urldoes not expire but is not intended for long-term storage. You should download the video promptly.
{
"request_id": "bd1109bd-6c63-4e62-8bb8-xxxxxx",
"output": {
"task_id": "72af7c13-dad5-4aaa-b85d-xxxxxx",
"task_status": "SUCCEEDED",
"video_url": "https://media.pixverseai.cn/xxx.mp4",
"orig_prompt": "下着雨,赛博城市里,一只浣熊在栏杆上行走。突然他眼睛发出蓝光,变身成一架高科技无人机,快速飞离画面。",
"submit_time": "2026-03-20 11:21:13.227",
"scheduled_time": "2026-03-20 11:21:13.252",
"end_time": "2026-03-20 11:21:43.924"
},
"usage": {
"video_count": 1,
"duration": 5.0,
"size": "1280*720",
"input_video_duration": 0.0,
"output_video_duration": 0.0,
"SR": "720"
},
"status_code": 200,
"code": "",
"message": ""
}
Asynchronous call
Request example
// 调用时请将 {WorkspaceId} 替换为真实的业务空间ID。
// 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 {
// 以下为北京地域url
Constants.baseHttpApiUrl = "https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1";
}
// 若没有配置环境变量,请用百炼API Key将下行替换为:api_key="sk-xxx"
// 获取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("aspect_ratio", "16:9");
VideoSynthesisParam param =
VideoSynthesisParam.builder()
.apiKey(apiKey)
.model("pixverse/pixverse-v6-max-t2v")
.prompt("下着雨,赛博城市里,一只浣熊在栏杆上行走。突然他眼睛发出蓝光,变身成一架高科技无人机,快速飞离画面。")
.resolution("720P")
.duration(5)
.audio(true)
.watermark(true)
.seed(12345)
.parameters(parameters)
.build();
// 异步调用
VideoSynthesisResult task = vs.asyncCall(param);
System.out.println(JsonUtils.toJson(task));
System.out.println("please wait...");
//获取结果
VideoSynthesisResult result = vs.wait(task, apiKey);
System.out.println(JsonUtils.toJson(result));
}
// 获取任务列表
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);
}
// 获取单个任务结果
public static void fetchTask(String taskId) throws ApiException, NoApiKeyException {
VideoSynthesis is = new VideoSynthesis();
// 如果已设置 DASHSCOPE_API_KEY 为环境变量,apiKey 可为空
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
- Response example for creating a task.
{
"request_id": "9b583f1b-2423-4fac-bb3f-xxxxxx",
"output": {
"task_id": "3944b819-1bbb-4da0-a230-xxxxxx",
"task_status": "PENDING"
},
"status_code": 200,
"code": "",
"message": ""
}
- Response example for querying a task result
video_urldoes not expire but is not intended for long-term storage. You should download the video promptly.
{
"request_id": "bd1109bd-6c63-4e62-8bb8-xxxxxx",
"output": {
"task_id": "72af7c13-dad5-4aaa-b85d-xxxxxx",
"task_status": "SUCCEEDED",
"video_url": "https://media.pixverseai.cn/xxx.mp4",
"orig_prompt": "下着雨,赛博城市里,一只浣熊在栏杆上行走。突然他眼睛发出蓝光,变身成一架高科技无人机,快速飞离画面。",
"submit_time": "2026-03-20 11:21:13.227",
"scheduled_time": "2026-03-20 11:21:13.252",
"end_time": "2026-03-20 11:21:43.924"
},
"usage": {
"video_count": 1,
"duration": 5.0,
"size": "1280*720",
"input_video_duration": 0.0,
"output_video_duration": 0.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
Q: Why can't I use a 10-second duration with 1080P resolution?
A: The pixverse-v5.6-t2v model does not support a 10-second duration at 1080P. We recommend reducing the resolution to 720P, 540P, or 360P, or switching to the pixverse-c1-t2v or pixverse-v6-t2v model.