tencent cloud

LLM Service TokenHub

Vidu Video Generation API Guide

Baixar
Modo Foco
Tamanho da Fonte
Última atualização: 2026-10-16 21:32:31
Traduzido por IA

Overview

Vidu is a video generation model series launched by Shengshu Technology, supporting capabilities such as image-to-video and multi-image reference video generation, and featuring simultaneous audio and video output. This document describes how to call the Vidu video model vidu-video-q4-preview through TokenHub.

Prerequisites

You have registered a Tencent Cloud account and activated the TokenHub service.
You have obtained an API Key from the TokenHub console.
Enable postpaid billing for the corresponding model in Console - Online Inference - Vision Models.
Note:
In all examples below, YOUR_API_KEY must be replaced with your own API Key. The authentication method is the request header Authorization: Bearer YOUR_API_KEY.

Call Process

Video generation is a time-consuming task. The API uses an asynchronous call mode, which is divided into two steps:
1. Submit a task: Call the generation API, which returns task_id and the initial status created upon success.
2. Poll for results: Call the "Query Task Result" API with task_id until state = success, and obtain the video URL from the result.
Attention:
Task status: created (successfully created) / queueing (in queue) / processing (in progress) / success (succeeded) / failed (failed). All API responses include request_id (at the top level, for troubleshooting). The query API additionally returns tokenhub_usage (usage consumption).

Model List

Model Name
model Parameter Value
Supported Capability
Video Duration (s)
Resolution Tier
Selection Recommendations
Vidu-Video-q4-preview
vidu-video-q4-preview
Image-to-video / reference-to-video / synchronized audio-video generation
3 ~ 16
540p / 720p / 1080p / 2K / 4K
Flagship preview version, supports 2K/4K output, with up to 15 reference images and up to 3 reference audio clips.
Note:
vidu-video-q4-preview currently supports only image-to-video and reference-to-video. For the duration value ranges of these two capabilities, see Appendix: Duration Value Quick Reference for Each API.
Supports simultaneous audio and video output (audio): enabled by default for image-to-video, while for reference-to-video, true must be explicitly passed.
Supported resolutions include 540p / 720p / 1080p / 2K / 4K, with 720p as the default.
Reference-to-video supports up to 15 reference images + 3 reference audio clips (sounds).

Image-to-Video

1. API Description

Generate a video starting from a first-frame image, with optional text prompts, direct audio/video output, and recommended prompts. The output aspect ratio follows the input image ratio (no aspect_ratio parameter).
API: POST https://tokenhub-intl.tencentcloudmaas.com/v1/wand/vidu/image-to-video

2. Input Parameters

Parameter Name
Required
Type
Description
model
Yes
string
Model name. Value: vidu-video-q4-preview
images
Yes
array[string]
images: supports input of 1 image in URL or Base64 format. Image formats: png/jpeg/jpg/webp. Image aspect ratio must be less than 1:4 or greater than 4:1.
1. Base64: The image size must be less than or equal to 15 MB, and the total size after conversion to Base64 must be less than or equal to 20 MB. Format requirement: data:image/<image_format>;base64,. Note: If the image is in jpg format, use jpeg as the image format.
2. URL: The size of a single file must be less than or equal to 50 MB, and the file must be publicly accessible (http/https).
prompt
No
string
Text prompt. No more than 5000 characters. This parameter is ignored when is_rec is used.
audio
No
boolean
Whether to output audio and video directly (output a video with audio containing dialogue/sound effects). Default value: true.
audio_type
No
string
Audio type (required when audio=true). Default value: all. Options: all / speech_only / sound_effect_only.
is_rec
No
boolean
Whether to use recommended prompts. When set to true, the system automatically recommends and generates them (each task consumes 10 additional credits).
duration
No
integer
Video duration in seconds. Options: 3 to 16. Default value: 5.
resolution
No
string
Resolution. Options: 540p / 720p / 1080p / 2K / 4K. Default value: 720p.
seed
No
integer
Random seed. If not specified or set to 0, a random number is used.
payload
No
string
Pass-through parameter. No more than 1,048,576 characters.
watermark
No
boolean
Whether to add a watermark. Default value: false.
wm_position
No
integer
Watermark position. TokenHub does not support this parameter. When watermark is enabled, a Tencent watermark is added to the upper left corner by default.
wm_url
No
string
Custom watermark image URL. If not specified, the default watermark is used.

3. Request Example

curl -X POST 'https://tokenhub-intl.tencentcloudmaas.com/v1/wand/vidu/image-to-video' \\
-H 'Authorization: Bearer YOUR_API_KEY' \\
-H 'Content-Type: application/json' \\
-d '{
"model": "vidu-video-q4-preview",
"images": ["https://example.com/start.jpg"],
"prompt": "Make the subject in the frame move naturally while the camera slowly pushes in",
"duration": 5,
"resolution": "720p",
"audio": true
}'

4. Output Parameters

Field
Type
Description
task_id
string
Task ID generated by Vidu
state
string
Processing status: created / queueing / processing / success / failed
model
string
Model name used in this call
prompt
string
Prompt parameter used in this call
images
array[string]
Image parameter used in this call
duration
integer
Video duration parameter used in this call
audio
boolean
Whether audio and video are synchronized in this call
seed
integer
Random seed parameter used in this call
resolution
string
Resolution parameter used in this call
credits
integer
Number of credits consumed by this call
created_at
string
Task creation time (ISO 8601)
request_id
string
Unique request ID used for troubleshooting

5. Response Example

{
"task_id": "4-WandVideo-a786becfdc80433b8cff4aa344c8fd3d",
"state": "created",
"model": "vidu-video-q4-preview",
"prompt": "Make the subject in the frame move naturally while the camera slowly pushes in",
"images": ["https://example.com/start.jpg"],
"duration": 5,
"audio": true,
"seed": 0,
"resolution": "720p",
"credits": 100,
"created_at": "2026-07-31T15:41:31.968Z",
"request_id": "3aec3299-06ad-4654-8b45-c57b823a15d2"
}

6. Error Codes

When a request fails, an error code is returned. For details, see Error Information. For common error codes, see Appendix: Unified Error Codes.

Multi-Image Reference Video Generation

1. API Description

Generate a video with subject consistency maintained by using reference images. Two calling methods are supported:
Method 1: Use subjects (which can be referenced in the prompt as @subject_name).
Method 2: Use the top-level images directly as references. You must choose one of the two methods.
API: POST https://tokenhub-intl.tencentcloudmaas.com/v1/wand/vidu/reference-to-video

2. Input Parameters

Parameter Name
Required
Type
Description
model
Yes
string
Model name. Value: vidu-video-q4-preview
subjects
Conditionally required
array[object]
Subject collection (method 1, mutually exclusive with images). See the table below for subfields.
images
Conditionally required
array[string]
Reference images (method 2, mutually exclusive with subjects): up to 15 images, supporting URL and Base64 formats. Image formats: png/jpeg/jpg/webp. Image aspect ratio must be less than 1:4 or greater than 4:1.
1. Base64: The total size of all images must be less than or equal to 15 MB, and the total size after conversion to Base64 must be less than or equal to 20 MB. Format requirement: data:image/<image_format>;base64,. Note: If the image is in jpg format, use jpeg as the image format.
2. URL: The size of a single file must be less than or equal to 50 MB, and the file must be publicly accessible (http/https).
prompt
Yes
string
Text prompt. No more than 5000 characters in subject mode (can be referenced with @subject name); no more than 2000 characters in direct reference mode.
auto_subjects
No
boolean
Whether to use the intelligent subject library capability. Default value: false.
audio
No
boolean
Whether to output audio and video directly. If not passed, false is used by default. To output audio and video simultaneously, explicitly pass true. Supported only in subjects mode.
audio_type
No
string
Audio type (required when audio=true). Default value: all. Options: all / speech_only / sound_effect_only.
duration
No
integer
Video duration in seconds. Options: 3 to 16. Default value: 5.
aspect_ratio
No
string
Aspect ratio. Default value: 16:9. Options: 16:9 / 9:16 / 3:4 / 4:3 / 1:1.
resolution
No
string
Resolution. Options: 540p / 720p / 1080p / 2K / 4K. Default value: 720p.
seed / payload / watermark / wm_position / wm_url
No
-
Common configuration, same as that for image-to-video.
Subfields of each element in the subjects array:
Parameter Name
Required
Type
Description
name
Yes
string
Subject ID/name, referenced later in the prompt as @name.
images
Yes
array[string]
Image subjects.images[]: supports input of 1 to 3 images in URL or Base64 format. Image formats: png/jpeg/jpg/webp. Image aspect ratio must be less than 1:4 or greater than 4:1.
1. Base64: The total size of all images must be less than or equal to 15 MB, and the total size after conversion to Base64 must be less than or equal to 20 MB. Format requirement: data:image/<image_format>;base64,. Note: If the image is in jpg format, use jpeg as the image format.
2. URL: The size of a single file must be less than or equal to 50 MB, and the file must be publicly accessible (http/https).
Note:
Maximum number of reference materials: up to 15 reference images + 3 reference audio clips (sounds).

3. Request Example

Method 1: subjects
curl -X POST 'https://tokenhub-intl.tencentcloudmaas.com/v1/wand/vidu/reference-to-video' \\
-H 'Authorization: Bearer YOUR_API_KEY' \\
-H 'Content-Type: application/json' \\
-d '{
"model": "vidu-video-q4-preview",
"subjects": [
{ "name": "girl", "images": ["https://example.com/girl1.jpg"] },
{ "name": "boy", "images": ["https://example.com/boy1.jpg"] }
],
"prompt": "@girl and @boy are eating hot pot together",
"duration": 8,
"audio": true
}'
Method 2: Use images directly as references
curl -X POST 'https://tokenhub-intl.tencentcloudmaas.com/v1/wand/vidu/reference-to-video' \\
-H 'Authorization: Bearer YOUR_API_KEY' \\
-H 'Content-Type: application/json' \\
-d '{
"model": "vidu-video-q4-preview",
"images": [
"https://example.com/input.jpg"
],
"prompt": "Keep the appearance of the subject in the reference image and move naturally",
}'

4. Output Parameters

Field
Type
Description
task_id
string
Task ID generated by Vidu
state
string
Processing status: created / queueing / processing / success / failed
model
string
Model name used in this call
prompt
string
Prompt parameter used in this call
images
array[string]
Image parameter used in this call
duration
integer
Video duration parameter used in this call
audio
boolean
Whether to enable direct audio and video output in this call
seed
integer
Random seed parameter used in this call
credits
integer
Number of credits consumed by this call
created_at
string
Task creation time (ISO 8601)
request_id
string
Unique request ID used for troubleshooting

5. Response Example

{
"task_id": "4-WandVideo-a786becfdc80433b8cff4aa344c8fd3d",
"state": "created",
"model": "vidu-video-q4-preview",
"prompt": "@girl and @boy are eating hot pot together",
"images": ["https://example.com/girl1.jpg", "https://example.com/boy1.jpg"],
"duration": 8,
"audio": true,
"seed": 0,
"credits": 100,
"created_at": "2026-07-31T15:41:31.968Z",
"request_id": "3aec3299-06ad-4654-8b45-c57b823a15d2"
}

6. Error Codes

When a request fails, an error code is returned. For details, see Error Information. For common error codes, see Appendix: Unified Error Codes.

Querying the Task Result

1. API Description

Common task query method for all generation APIs: After submitting a task and receiving the task_id, poll the task status through this API. Upon success, obtain the video URL from the result.
API: GET https://tokenhub-intl.tencentcloudmaas.com/v1/wand/vidu/tasks/{task_id}
Note:
The {task_id} in the path is the task_id returned when the task was submitted (represented by YOUR_TASK_ID in the example). Video generation takes approximately 1 to 5 minutes. It is recommended to poll every 5 to 10 seconds.

2. Input Parameters

Parameter Name
Required
Type
Description
task_id
Yes
string
Task ID (path parameter), which is the task_id returned when the task is submitted

3. Request Example

curl -X GET 'https://tokenhub-intl.tencentcloudmaas.com/v1/wand/vidu/tasks/YOUR_TASK_ID' \\
-H 'Authorization: Bearer YOUR_API_KEY'

4. Output Parameters

Field
Type
Description
task_id
string
Task ID
state
string
Processing status: created / queueing / processing / success / failed
model
string
Model name used in this call
prompt
string
Prompt parameter used in this call
duration
integer
Video duration parameter used in this call
seed
integer
Random seed parameter used in this call
resolution
string
Resolution parameter used in this call
creations
array[object]
List of generated results (returned on success)
creations[].url
string
Download URL of the generated video. It is a temporary URL valid for 12 hours. Download and store it promptly.
creations[].cover_url
string
Cover image URL of the generated video
credits
integer
Number of credits consumed by this call
created_at
string
Task creation time (ISO 8601)
request_id
string
Unique request ID used for troubleshooting
tokenhub_usage
object
Usage consumption
tokenhub_usage.total_tokens
integer
Number of tokens consumed by this task, used for billing/reconciliation

5. Response Example

Generation succeeded:
{
"task_id": "4-WandVideo-a786becfdc80433b8cff4aa344c8fd3d",
"state": "success",
"model": "vidu-video-q4-preview",
"prompt": "Make the subject in the frame move naturally and slowly push the camera in",
"duration": 5,
"seed": 0,
"resolution": "720p",
"creations": [
{
"url": "https://aigc-video.cos.myqcloud.com/xxx/result.mp4",
"cover_url": "https://aigc-video.cos.myqcloud.com/xxx/cover.jpg"
}
],
"credits": 100,
"created_at": "2026-07-31T15:41:31.968Z",
"request_id": "3aec3299-06ad-4654-8b45-c57b823a15d2",
"tokenhub_usage": { "total_tokens": 102655 }
}

6. Error Codes

state
Description
Handling Recommendation
success
Generation succeeded
Obtain the result video from creations[].url.
processing / queueing
Processing or queued
Poll once every 5 to 10 seconds until success.
failed
Generation failed
Check the failure cause, make modifications, and retry. If failures persist, contact technical support and provide the request_id.

Appendix

Unified Error Codes

Error Code
Error Message
Description
BadRequest
bad request
Invalid request
FieldLacking
field is missing or empty
Missing required field
FieldUnwanted
unwanted field
Unwanted field was passed.
FieldInvalid
invalid field
Input parameter failed validation.
FieldItemCountOutOfRange
field item count out of range
The number of field items exceeds the limit (for example, the number of images exceeds the limit).
PageSizeOutOfRange
page size out of range
Image size/parameter exceeds the limit
ImageFormatInvalid / VideoFormatInvalid
invalid image/video format
Image/video format does not meet requirements.
ImageSizeInvalid
image size invalid
Image size is too large or too small.
ImageDownloadFailure / VideoDownloadFailure
image/video download failure
Failed to download image/video URL
ImageCheckFaceFailed
Image Check Face Failed
Input image face detection failed.
ImageCheckBodyJointsFailed
Image Check Body Joints Failed
Input image human body detection failed.
NoFaceDetected / MultiFaceDetected
no / multi face detected
No face detected / multiple faces detected
TaskPromptPolicyViolation
prompt policy violation
Prompt triggers security review and risk control.
CreationPolicyViolation
creation policy violation
Generated content triggers risk control.
AuditSubmitIllegal / AuditFailed
submit is illegal / audit failed
Input failed security review / audit failed.
CreditInsufficient
insufficient credits
Insufficient credits
ModelUnavailable
model unavailable
Model unavailable
Unauthorized
unauthorized
Unauthorized (check Authorization)
Forbidden
forbidden
The request has no permission.
TaskNotFound / CreationNotFound / NotFound
not found
Task/creation/resource does not exist.
QuotaExceeded
quota exceeded
Exceeding the concurrency limit
TooManyRequests
too many requests
Requests are too frequent.
SystemThrottling
system is throttling
Resource limit exceeded (throttling)
UserCancelled / Canceled
user cancelled / request canceled
User manually terminated / request canceled.
InternalServiceFailure
internal service failure
Internal server error
Unknown
unknown
Unknown cause

Duration Value Lookup for Each API

API
vidu-video-q4-preview
Image-to-video generation
3 to 16, default 5
Multi-image reference video generation
3 to 16, default 5

General Material Constraints

Image: Format: png, jpeg, jpg, or webp. Pixels: greater than or equal to 128×128. Aspect ratio: must be less than 1:4 or greater than 4:1. Single image: less than or equal to 50 MB. POST body: less than or equal to 20 MB. URL or Base64 is supported (Base64 must include the data:image/png;base64, prefix).

Subject Reference Syntax

In the subjects method for reference-to-video generation, define subject names through subjects[].name and reference them in the prompt as @subject_name (for example, @girl and @boy are eating hot pot together). Avoid using subject names that are substrings of each other.

FAQs

1. What Is the Difference Between subjects and Direct Image References?

Subjects method: You can define multiple named subjects and flexibly reference them in the prompt as @subject_name, which is suitable for multi-subject interaction scenarios. The prompt can contain up to 5,000 characters. Audio and video can be generated simultaneously (audio).
Direct images method: Reference materials are passed directly, and named references are not supported. The prompt can contain up to 2,000 characters.

2. How to Enable Simultaneous Audio and Video Output?

audio enables direct audio-video output, producing a video with dialogue and sound effects. It is enabled by default for image-to-video. For reference-to-video, you must use the subjects method and explicitly pass audio: true. vidu-video-q4-preview does not support the bgm background music parameter.

3. Which APIs Can Specify the Aspect Ratio?

Only multi-image reference-to-video supports the aspect_ratio parameter. Image-to-video does not have this parameter, and the output aspect ratio follows the input image ratio.

4. Do Generated Video Links Expire?

The URL will expire. The generation result is a temporary URL valid for 12 hours. After the task succeeds, promptly download the video from creations[].url and transfer it to your own storage. Do not rely on this link long-term.


Ajuda e Suporte

Esta página foi útil?

comentários