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.
NoteThe 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
Note
- 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-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 Enables asynchronous processing. HTTP requests support only asynchronous calls. Must be ImportantIf this request header is missing, the error "current user api does not support synchronous calls" is returned. Request bodymodel The model to use. Valid values:
input The basic input, which includes reference images and a prompt. parameters Parameters for video generation, such as video resolution and duration. | Advertising (image only)Supported model: vidu/viduq3-ad_reference2video. Drama (image only)Supported model: vidu/viduq3-drama_reference2video. Image only |
Response parameters | Successful responseSave the Error responseTask creation failed. See Error codes. |
output The output data for the task. | |
request_id Unique request identifier for tracing and troubleshooting. | |
message Detailed 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}
Note
- 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 headersAuthorization 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 data for the task. usage Usage statistics (counted for successful tasks only). request_id Unique request identifier for tracing and troubleshooting. | Task succeededVideo URLs are valid for only 24 hours and then automatically purged. Save generated videos promptly. Task failedWhen a task fails, Task query expiredThe |
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.