The Vidu image-to-video model generates a smooth video from an input image and a text prompt .
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://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis
- After the task is successfully created, use the
task_idreturned by the interface to query the result. The task_id is valid for 24 hours. Do not create duplicate tasks; use polling to obtain the results. - For a beginner's guide, see Postman.
Request parametersHeadersContent-Typestring (Required)The content type of the request. Must be application/json.Content-Type string (Required)The content type of the request. Must be application/json.X-DashScope-Async string (Required)Asynchronous processing configuration parameter. HTTP requests support asynchronous mode only, and it must be set to enable.Request bodymodelstring (Required)The name of the model. Valid values are:
object (Required)The basic input, including the text prompt and media assets.
Properties prompt string (Optional)The text prompt, which describes the desired elements and visual characteristics of the generated video.The maximum length is 5,000 characters (both Chinese characters and English letters count as one). Text exceeding this limit is truncated.For more information about how to write prompts, see Vidu Video Generation Prompt Guide.media array (Required)A list of media assets specifying the image for generation.Each element in the array is a media object containing a type field and a url field.
Properties type string (Required)The type of the media asset. This must be set to the following fixed value:
string (Required)The URL of the image file, which must be publicly accessible.
object (Optional)Parameters for video processing, such as resolution and duration.
Properties resolution string (Optional)Specifies the resolution tier for the generated video.The model scales the video to a pixel count that approximates the selected tier while preserving the input image's aspect ratio.
integer (Optional)The duration of the generated video in seconds.
boolean (Optional)Supported models: vidu/viduq3-pro-fast_img2video, vidu/viduq3-pro_img2video, vidu/viduq3-turbo_img2video.Specifies whether to generate a video with audio. If enabled, the model automatically generates matching background music or sound effects based on the video content.
boolean (Optional)Specifies whether to add a watermark. The watermark is placed in the bottom-right corner of the video and contains the fixed text "Generated by AI".
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. |
|
Response parametersoutputobjectTask output information.
Properties task_id stringThe task ID. Valid for queries for 24 hours.task_status stringThe status of the task.
Enumeration values
stringUnique request identifier for tracing and troubleshooting.codestringError code. Returned only for failed requests. See Error codes.messagestringDetailed error message. Returned only for failed requests. See Error codes. |
Save the task_id, which is used to query the task status and results. |
Step 2: Query the result
China (Beijing) region: GET https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/tasks/{task_id}
- Polling recommendation: Video generation takes several minutes. We recommend using a polling mechanism with a reasonable query interval (such as 15 seconds) to obtain the results.
- Task status transitions: PENDING (Queuing) → RUNNING (Processing) → SUCCEEDED (Success) / FAILED (Failed).
- task_id validity: 24 hours. After it expires, the result can no longer be queried, and the interface will return a task status of
UNKNOWN. - RPS limit: The default RPS of the query interface is 20. For higher-frequency queries or event notifications, we recommend configuring asynchronous task callbacks.
- More operations: For batch queries, task cancellation, and other operations, see Managing asynchronous tasks.
Request parametersHeadersAuthorizationstring (Required)Authenticates the request with a Model Studio API key. Example: Bearer sk-xxxx.Path parameterstask_idstring (Required)The ID of the task. |
Replace {task_id} with the task_id value returned by the previous API call. The task_id is valid for queries for 24 hours |
Response parametersoutputobjectTask output information.
Properties task_id stringThe task ID. Valid for queries for 24 hours.task_status stringThe status of the task.
Enumeration values
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.end_time stringThe time when the task was completed. format is YYYY-MM-DD HH:mm:ss.SSS.video_urlstringThe video URL. Returned only when task_status is SUCCEEDED.The video format is MP4 (H.264 encoding). The video link is valid for 24 hours. Please download it promptly.orig_prompt stringThe original input prompt, corresponding to the request parameter prompt.codestringError code. Returned only for failed requests. See Error codes.messagestringDetailed error message. Returned only for failed requests. See Error codes.objectOutput usage statistics, counted only for successful tasks.
Properties duration integerThe total billable video duration in seconds.output_video_durationintegerThe duration of the output video in seconds.size stringThe resolution of the output video.fps integerThe frame rate of the output video. This is fixed at 24.SR stringThe resolution tier of the output video.audio booleanIndicates whether the output is a video with audio.video_count integerThe number of output videos. This is fixed at 1.stringUnique request identifier for tracing and troubleshooting. |
|