The Vidu image-to-video model generates a smooth video from an input image and a text prompt.
This 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 Vidu, find the Vidu model card, and click Activate Now. In the dialog box that appears, confirm the activation and authorization.
Scope
The model, Endpoint URL, and API Key must belong to the same region. Cross-region calls will fail.
-
Select a model: Confirm the region where the model is available.
-
Select a URL: Select the corresponding regional Endpoint URL. HTTP URLs are supported.
-
Configure an API Key: Select a region, get an API Key, and then set the API Key as an environment variable.
HTTP calls
Image-to-video generation is a long-running task that typically takes 1 to 5 minutes, so the API uses an asynchronous model. The workflow consists of two core steps: create a task, then poll for the result.
Step 1: Create a task
China (Beijing) region: POST https://dashscope.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis
-
After the task is created, use the returned
task_idto query the result. Thetask_idis 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 |
Image-to-video
|
Headers |
|
|
Content-Type The content type of the request. Must be |
|
|
Content-Type The content type of the request. Must be |
|
|
X-DashScope-Async Enables asynchronous processing. HTTP requests support only asynchronous calls. Must be Important
If this request header is missing, the error "current user api does not support synchronous calls" is returned. |
|
Request body |
|
|
model The name of the model. Valid values are:
|
|
|
input The basic input, including the text prompt and media assets. |
|
|
parameters Parameters for video processing, such as resolution and duration. |
Response parameters |
Successful responseSave the
Error responseTask creation failed. See Error codes.
|
|
output Task output information. |
|
|
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. |
Step 2: Query the result
China (Beijing) region: GET https://dashscope.aliyuncs.com/api/v1/tasks/{task_id}
-
Polling recommendation: Video generation can take several minutes. Poll for the result at a reasonable interval, such as every 15 seconds.
-
Task status flow:
PENDING(queued) →RUNNING(processing) →SUCCEEDED(successful) /FAILED(failed). -
Task ID validity: The
task_idis valid for 24 hours. After this period, queries will fail and return a status ofUNKNOWN. -
RPS limit: The query endpoint has a default limit of 20 RPS. For high-frequency queries or event notifications, configure asynchronous task callbacks.
-
More operations: To perform batch queries, cancel tasks, or run other operations, see Manage Asynchronous Tasks.
Request parameters |
Query task resultReplace |
Headers |
|
|
Authorization Authenticates the request with a Model Studio API key. Example: Bearer sk-xxxx. |
|
Path parameters |
|
|
task_id The ID of the task. |
Response parameters |
Task succeededTask failedWhen a task fails,
Task query expiredThe
|
|
output Task output information. |
|
|
usage Output usage statistics, counted only for successful tasks. |
|
|
request_id Unique request identifier for tracing and troubleshooting. |
Error codes
If a model call fails, see Error Messages to troubleshoot the error.