Request parameters Request headers Content-Type string (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) Asynchronous processing configuration parameter. HTTP requests support asynchronous mode only, and it must be set to enable. ImportantIf this request header is missing, the error "current user api does not support synchronous calls" is returned. Request body model string (required) The model to use. Valid values:
vidu/viduq3-ad_reference2video
vidu/viduq3-drama_reference2video
vidu/viduq3-mix_reference2video
vidu/viduq3_reference2video
vidu/viduq3-turbo_reference2video
vidu/viduq2-pro_reference2video
vidu/viduq2_reference2video
Model selection guide
- Advertising videos: Use viduq3-ad. Designed for the advertising industry, it features marketing-grade smart shot transitions, camera movements, and direct audio output. Upload product images to generate advertising videos.
- Premium dramas / AI comics: Use viduq3-drama. Strong character consistency, refined effects, and realistic emotional expression, ideal for narrative content production.
- General use: Use viduq3-mix. Balanced visual quality and dynamic effects, suitable for most reference-to-video scenarios.
- Speed and cost efficiency: Use viduq3-turbo. The fastest generation speed.
input 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_reference2video, vidu/viduq3_reference2video, vidu/viduq3-turbo_reference2video, vidu/viduq2_reference2video The value is fixed to: Asset limit: 1 to 7 images. Provide reference images and videos Supported model: vidu/viduq2-pro_reference2video Valid values:
image: The reference image. Required.
video: The reference video. Optional.
Asset limits: url string (required) The URL of the media asset. Assets include images and videos. Provide an image (type=image) The URL of the reference image. The URL must be publicly accessible. Image limits:
- Formats: JPEG, JPG, PNG, and WEBP.
- Aspect ratio: 1:4 to 4:1.
- File size: Up to 50 MB.
Provide a video (type=video) The URL of the reference video. The URL must be publicly accessible. Video limits:
- Formats: MP4, AVI, and MOV.
- Resolution: The total number of pixels must be at least 128 × 128.
- Aspect ratio: 1:4 to 4:1.
- Duration: 1 to 8 seconds for one reference video; 1 to 5 seconds for each of two reference videos.
- File size: Up to 50 MB.
parameters object (required) Parameters for video generation, such as video resolution and duration. Properties resolution string (optional) ImportantThe resolution directly affects billing. Before you call the API, confirm the model pricing. The resolution of the generated video. The valid values depend on the selected model:
- vidu/viduq3-ad_reference2video: 720P or 1080P. Default: 720P.
- vidu/viduq3-drama_reference2video: 720P or 1080P. Default: 1080P.
- vidu/viduq3-mix_reference2video: 540P, 720P, or 1080P. Default: 720P.
- vidu/viduq3_reference2video: 540P, 720P, or 1080P. Default: 720P.
- vidu/viduq3-turbo_reference2video: 540P, 720P, or 1080P. Default: 720P.
- vidu/viduq2-pro_reference2video: 540P, 720P, or 1080P. Default: 720P.
- vidu/viduq2_reference2video: 540P, 720P, or 1080P. Default: 720P.
size string (optional) The resolution of the generated video, in pixels, formatted as width*height. The default value depends on resolution:
- When resolution=540P, size defaults to
1024*576.
- When resolution=720P, size defaults to
1280*720.
- When resolution is 1080P, size defaults to
1920*1080.
Supported aspect ratios vary by model:
- vidu/viduq3-drama_reference2video: Only 16:9 and 9:16 are supported.
- Other models: 16:9, 4:3, 1:1, 3:4, and 9:16 are supported.
Resolution tier | Aspect ratio | Valid size values (width*height) | 540P | 16:9 | 1024*576 | 4:3 | 1024*768 | 1:1 | 1024*1024 | 3:4 | 768*1024 | 9:16 | 576*1024 | 720P | 16:9 | 1280*720 | 4:3 | 1280*960 | 1:1 | 1280*1280 | 3:4 | 960*1280 | 9:16 | 720*1280 | 1080P | 16:9 | 1920*1080 | 4:3 | 1920*1440 | 1:1 | 1808*1808 | 3:4 | 1440*1920 | 9:16 | 1080*1920 |
duration integer (required) ImportantThe duration directly affects billing, which is calculated per second. Before you call the API, confirm the model pricing. The duration of the generated video, in seconds.
-
vidu/viduq3-ad_reference2video: An integer in the range of [3, 15]. The default value is 5.
-
vidu/viduq3-drama_reference2video: An integer in the range of [2, 15]. The default value is 5.
- When the number of storyboard shots is too large or significantly fewer than duration, the model may automatically adjust the duration to ensure story completeness; the actual video duration may be longer or shorter than the duration setting.
- Billing is based on the actual output duration.
-
vidu/viduq3-mix_reference2video: an integer in the range [1, 16]. Default value is 5.
-
vidu/viduq3_reference2video: an integer in the range [1, 16]. Default value is 5.
-
vidu/viduq3-turbo_reference2video: an integer in the range [1, 16]. Default value is 5.
-
vidu/viduq2-pro_reference2video: an integer in the range [1, 10]. Default value is 5.
-
vidu/viduq2_reference2video: The value is an integer in the range of [1, 10]. The default value is 5.
audio boolean (optional) Supported models: vidu/viduq3-ad_reference2video, vidu/viduq3-mix_reference2video, vidu/viduq3_reference2video, vidu/viduq3-turbo_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.
false: The default value. The output is a silent video.
true: Outputs a video with audio.
Notevidu/viduq3-drama_reference2video does not support this parameter. This model outputs videos with audio by default. watermark 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".
false: Default value. A watermark is not added.
true: Adds a watermark.
seedinteger(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 | Advertising (image only)Supported model: vidu/viduq3-ad_reference2video. curl --location 'https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis' \
-H 'X-DashScope-Async: enable' \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"model": "vidu/viduq3-ad_reference2video",
"input": {
"media": [
{
"type": "image",
"url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260713/dtnctw/ad-1.png"
},
{
"type": "image",
"url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260713/bspdpd/ad-2.png"
},
{
"type": "image",
"url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260713/mhsjyy/ad-3.png"
}
],
"prompt": "一个瑜伽裤的广告。商品是一条左右各有一个口袋的黑色高腰瑜伽裤。亚洲模特开心地说"我现在再也不穿没有口袋的瑜伽裤了"。画面保持清晰、稳定、容易理解。"
},
"parameters": {
"duration": 8,
"size": "1080*1920",
"resolution": "1080P",
"watermark": true
}
}'
Python SDKimport dashscope
import os
from dashscope import DashScopeError
# 若没有配置环境变量,请用百炼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"))
media = [{'type': 'image', 'url': 'https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260713/dtnctw/ad-1.png'}, {'type': 'image', 'url': 'https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260713/bspdpd/ad-2.png'}, {'type': 'image', 'url': 'https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260713/mhsjyy/ad-3.png'}]
def sample_async_call():
# 异步提交视频生成任务
try:
job = client.videos.jobs.create(model='vidu/viduq3-ad_reference2video',
prompt='一个瑜伽裤的广告。商品是一条左右各有一个口袋的黑色高腰瑜伽裤。亚洲模特开心地说"我现在再也不穿没有口袋的瑜伽裤了"。画面保持清晰、稳定、容易理解。',
media=media,
size='1080*1920',
resolution='1080P',
duration=8,
watermark=True)
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
# 查询任务状态
try:
snapshot = client.videos.jobs.fetch(job.task_id)
print(snapshot.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")
# 等待任务完成
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()
Drama (image only)Supported model: vidu/viduq3-drama_reference2video. curl --location 'https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis' \
-H 'X-DashScope-Async: enable' \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"model": "vidu/viduq3-drama_reference2video",
"input": {
"media": [
{
"type": "image",
"url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260713/eelcsu/daram-1.png"
},
{
"type": "image",
"url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260713/adglrn/drama-2.png"
},
{
"type": "image",
"url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260713/fmofkp/drama-3.png"
},
{
"type": "image",
"url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260713/mktdht/drama-4.png"
}
],
"prompt": "酒店宴会厅,王桂兰(图3)(在画面右侧,坐在席位上)苏文博(图1)、许向暖(图2)(在画面左侧远处,敬酒中)。婚礼现场座无虚席,坐满宾客。苏文博的母亲王桂兰坐在席位上,眉头紧紧皱起,面露不满。镜头固定,捕捉她皱眉的表情。镜头推进王桂兰面部,她眼神阴沉,嘴角下撇,带着嫌弃和不满。强调她的不悦。"
},
"parameters": {
"duration": 9,
"size": "1080*1920",
"resolution": "1080P",
"watermark": true
}
}'
Image onlycurl --location 'https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis' \
-H 'X-DashScope-Async: enable' \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"model": "vidu/viduq3-mix_reference2video",
"input": {
"media": [
{
"type": "image",
"url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260320/knsple/wan-r2v-role-frame.jpg"
},
{
"type": "image",
"url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/qpzxps/wan-r2v-object4.png"
},
{
"type": "image",
"url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/wfjikw/wan-r2v-backgroud5.png"
}
],
"prompt": "男人坐在靠窗的椅子上,手持吉他,在咖啡厅旁演奏一首舒缓的美国乡村民谣"
},
"parameters": {
"duration": 5,
"size": "1280*720",
"resolution": "720P",
"watermark": true
}
}'
Image and videoSupported model: vidu/viduq2-pro_reference2video. curl --location 'https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis' \
-H 'X-DashScope-Async: enable' \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"model": "vidu/viduq2-pro_reference2video",
"input": {
"media": [
{
"type": "video",
"url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/qigswt/wan-r2v-role2.mp4"
},
{
"type": "image",
"url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/qpzxps/wan-r2v-object4.png"
},
{
"type": "image",
"url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/wfjikw/wan-r2v-backgroud5.png"
}
],
"prompt": "男人坐在靠窗的椅子上,手持吉他,在咖啡厅旁演奏一首舒缓的美国乡村民谣"
},
"parameters": {
"duration": 5,
"size": "1280*720",
"resolution": "720P",
"watermark": true
}
}'
|