The Vidu reference-to-video model uses a reference image and a text prompt . The model incorporates the subject from the image into the scene described by the prompt to generate smooth video.
Usage notes
To ensure successful API calls, you must use a model, endpoint URL, and API key that all belong to the same region. Cross-region calls will fail.
- Select a model: Confirm the region where your model is located.
- Select a URL: Choose the corresponding endpoint URL. Both HTTP and DashScope SDK URLs are supported.
- Configure an API key: Select a region, get an API key, and then configure the API key as an environment variable.
The sample code in this topic applies to the Singapore region.
HTTP calls
Because reference-to-video tasks are long-running (typically 1 to 5 minutes), the API uses asynchronous calls. The process consists of two core steps: "Create a task -> Poll for the result".
Step 1: Create a task
Singapore region: POST https://{WorkspaceId}.ap-southeast-1.maas.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 parametersRequest headersContent-Typestring (Required)The content type of the request. Must be application/json.Authorization string (Required)Authenticates the request with a Model Studio API key. Example: Bearer sk-xxxx.X-DashScope-Async string (Required)Enables asynchronous processing. HTTP requests support only asynchronous calls. Must be enable.Request bodymodelstring (required)The model to use. Valid values:
Model selection guide
object (required)The basic input, which includes reference images and a prompt.
Properties prompt string (required)The text prompt. Describes the elements and visual characteristics that you want in the generated video.Both Chinese and English are supported. The maximum length is 5,000 characters. Text that exceeds this limit is automatically truncated.Example: A man sits in a chair by a window, holding a guitar and playing a soothing American country folk song in a cafe.For more information about how to write prompts, see Vidu Video Generation Prompt Guide.media array (required)A list of media assets that specifies the reference materials for video generation.Each element of the array is a media object that contains type and url fields.
Element properties type string (required)The media asset type. The valid values depend on the selected model.
Provide reference images only Supported models: vidu/viduq3-ad_reference2video, vidu/viduq3-drama_reference2video, vidu/viduq3-mix_reference2videoThe value is fixed to:
string (required)The URL of the media asset.
Provide an image (type=image) The URL of the reference image. The URL must be publicly accessible.
object (required)Parameters for video generation, such as video resolution and duration.
Properties resolution string (optional)The resolution of the generated video. The valid values depend on the selected model:
string (optional)The resolution of the generated video, in pixels, formatted as width*height.The default value depends on resolution:
integer (required)The duration of the generated video, in seconds.
boolean (optional)Supported models: vidu/viduq3-ad_reference2video, vidu/viduq3-mix_reference2video.Specifies whether to generate a video with audio. If enabled, the model automatically generates background music or sound effects that match the video content.
vidu/viduq3-drama_reference2video does not support this parameter. This model outputs videos with audio by default. boolean (optional)Specifies whether to add a watermark to the lower-right corner of the video. The watermark text is fixed to "Content generated by AI".
integer(optional)The seed. The value range is [0, 2147483647].If you do not specify a seed, the system generates one randomly. To improve the reproducibility of results, we recommend setting a fixed seed value.Note that due to the model's probabilistic nature, using the same seed does not guarantee identical results across runs.Example: 12345 |
Supported model: vidu/viduq3-ad_reference2video. |
Response parameters |
Save the task_id to query the task status and result. |
output objectThe output data for the task.
Properties task_id stringThe task ID. Valid for queries for 24 hours.task_status stringThe status of the task.
Enumeration values
| |
request_id stringUnique request identifier for tracing and troubleshooting. | |
message stringDetailed error message. Returned only for failed requests. See Error codes. |
Step 2: Query the task result
Singapore region: GET https://{WorkspaceId}.ap-southeast-1.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 (for example, 15 seconds) to retrieve the result.
- Task status transitions: PENDING (queued) → RUNNING (in progress) → SUCCEEDED (successful) / FAILED (failed).
- task_id validity period: 24 hours. After the validity period expires, you can no longer query the result, and the API returns the task status as
UNKNOWN. - RPS limit: The query API has a default RPS limit of 20. For higher-frequency queries or to receive event notifications, we recommend configuring asynchronous task callbacks.
- More operations: For operations such as querying tasks in batches or canceling tasks, see Manage asynchronous tasks.
Request parametersRequest headersAuthorizationstring (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 parametersoutputobjectThe output data for the task.
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.video_urlstringThe URL of the video. This parameter is returned only when task_status is SUCCEEDED.The video is in MP4 format (H.264 encoded). The video URL is valid for 24 hours. Download the video 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.objectUsage statistics (counted for successful tasks only).
Properties duration integerThe total duration of the generated video, used for billing.size stringSpecifies the resolution of the generated video.fps integerSpecifies the frame rate of the generated video. The value is fixed at 24.SR stringSpecifies the resolution tier of the generated video.audio booleanIndicates whether the generated video includes audio.video_count integerSpecifies the number of videos generated. The value is fixed at 1.reference_type stringSpecifies the type of reference materials used.stringUnique request identifier for tracing and troubleshooting. |
Video URLs are valid for only 24 hours and then automatically purged. Save generated videos promptly. |
Error codes
If the model call fails and returns an error message, see Error codes for resolution.
FAQ
Q: Do I have to provide both size and resolution?
A: No. Both parameters are optional, but we recommend providing both. This allows you to precisely control the aspect ratio of the generated video. For details, see Valid size values.
If you do not provide both, the system handles the request as follows:
-
Only size is passed: The
sizeparameter is ignored, and the system uses the defaultresolution=720Pand its corresponding defaultsizevalue (1280*720).Example: The API returns
size="1280*720"andSR=720. -
If you provide only
resolution: The output uses the specified resolution tier.For example, if you set
resolution=540P, the API returnssize="960*528"andSR=540. If you setresolution=1080P, the API returnssize="1920*1080"andSR=1080.