curl --request POST \
--url https://toapis.com/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "viduq4-preview",
"prompt": "圖片中的人物緩緩轉身微笑,電影質感打光",
"image_urls": ["https://example.com/portrait.jpg"],
"duration": 5,
"resolution": "1080p",
"audio": true
}'
import requests
response = requests.post(
"https://toapis.com/v1/videos/generations",
headers={
"Authorization": "Bearer <token>",
"Content-Type": "application/json",
},
json={
"model": "viduq4-preview",
"prompt": "圖片中的人物緩緩轉身微笑,電影質感打光",
"image_urls": ["https://example.com/portrait.jpg"],
"duration": 5,
"resolution": "1080p",
"audio": True,
},
)
print(response.json())
const response = await fetch("https://toapis.com/v1/videos/generations", {
method: "POST",
headers: {
Authorization: "Bearer <token>",
"Content-Type": "application/json"
},
body: JSON.stringify({
model: "viduq4-preview",
prompt: "圖片中的人物緩緩轉身微笑,電影質感打光",
image_urls: ["https://example.com/portrait.jpg"],
duration: 5,
resolution: "1080p",
audio: true
})
});
console.log(await response.json());
{
"id": "<string>",
"object": "<string>",
"model": "<string>",
"status": "<string>",
"created_at": 123
}Vidu Q4 Preview
Vidu Q4 Preview 影片生成
使用 Vidu Q4 Preview 模型生成影片,支援圖生影片和多參考圖生成,參考模式可附加參考音訊
POST
/
v1
/
videos
/
generations
curl --request POST \
--url https://toapis.com/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "viduq4-preview",
"prompt": "圖片中的人物緩緩轉身微笑,電影質感打光",
"image_urls": ["https://example.com/portrait.jpg"],
"duration": 5,
"resolution": "1080p",
"audio": true
}'
import requests
response = requests.post(
"https://toapis.com/v1/videos/generations",
headers={
"Authorization": "Bearer <token>",
"Content-Type": "application/json",
},
json={
"model": "viduq4-preview",
"prompt": "圖片中的人物緩緩轉身微笑,電影質感打光",
"image_urls": ["https://example.com/portrait.jpg"],
"duration": 5,
"resolution": "1080p",
"audio": True,
},
)
print(response.json())
const response = await fetch("https://toapis.com/v1/videos/generations", {
method: "POST",
headers: {
Authorization: "Bearer <token>",
"Content-Type": "application/json"
},
body: JSON.stringify({
model: "viduq4-preview",
prompt: "圖片中的人物緩緩轉身微笑,電影質感打光",
image_urls: ["https://example.com/portrait.jpg"],
duration: 5,
resolution: "1080p",
audio: true
})
});
console.log(await response.json());
{
"id": "<string>",
"object": "<string>",
"model": "<string>",
"status": "<string>",
"created_at": 123
}中國大陸用戶請注意: 請使用
https://toapis.cn 作為接口地址(Base URL)。文件範例中的 https://toapis.com 請替換為 https://toapis.cn。- 非同步任務接口,提交後返回任務 ID
- 支援模型:
viduq4-preview - 兩種生成模式:
- 首幀圖生影片:單張圖片作為首幀
- 參考生影片:多張參考圖,可附加參考音訊
請傳入公網可存取的圖片和音訊 URL。不要在
image_urls、reference_images 或 sounds 中直接傳 base64 資料;本地檔案請先使用 上傳圖片接口 取得 URL。認證
string
必填
所有接口均需要使用 Bearer Token 認證。
Authorization: Bearer YOUR_API_KEY
請求參數
string
必填
模型名稱,固定為
viduq4-preview。string
必填
影片提示詞,描述主體、動作、場景、鏡頭和風格。
string[]
圖片 URL 陣列。生成模式由
video_generation_mode 和圖片數量決定:- 首幀模式(預設):在
image_urls中傳入恰好 1 張圖片 URL,圖片作為首幀。 - 參考模式:將
video_generation_mode設為reference_images_to_video,在image_urls(或reference_images)中傳入參考圖。
["https://example.com/first-frame.jpg"]string
生成模式選擇器。可選值:
reference_images_to_video- 多參考圖生成,image_urls中的多張圖片按參考圖處理
reference_images 或 sounds 的請求會自動路由到參考生影片。integer
預設值:"5"
影片時長(秒),
3 到 16。string
預設值:"720p"
影片解析度。可選值:
540p720p1080p2K4K
string
影片寬高比,用於參考模式。可選值:
16:9、9:16、4:3、3:4、1:1boolean
預設值:"true"
是否為影片生成音訊。
boolean
預設值:"false"
是否在生成的影片上添加浮水印。
integer
隨機種子,相同參數下可獲得更可重現的結果。
object
擴展參數,用於傳遞上游 API 支援但未暴露為頂層欄位的參數。
顯示 展開 metadata 欄位
顯示 展開 metadata 欄位
模式選擇
| 模式 | 觸發方式 | 圖片輸入 | 音訊輸入 |
|---|---|---|---|
| 首幀圖生影片 | image_urls 傳 1 張圖(預設) | 恰好 1 張 | 僅 audio 開關 |
| 參考生影片 | video_generation_mode: "reference_images_to_video",或多圖 / reference_images / sounds | 最多 15 張參考圖 | 最多 3 條 sounds + audio 開關 |
計費維度
Vidu Q4 Preview 按生成影片秒數計費,按解析度分檔定價:540p/720p/1080p/2K/4K- 解析度越高單價越高
響應
string
任務 ID,用於查詢任務狀態。
string
物件類型,通常為
generation.task。string
請求使用的模型。
string
任務狀態:
queued、in_progress、completed 或 failed。integer
任務建立時間戳。
範例
首幀圖生影片
{
"model": "viduq4-preview",
"prompt": "圖片中的人物緩緩轉身微笑,電影質感打光",
"image_urls": ["https://example.com/portrait.jpg"],
"duration": 5,
"resolution": "1080p",
"audio": true
}
參考生影片
{
"model": "viduq4-preview",
"prompt": "保持參考圖中的人物一致,夜晚霓虹城市街道上行走",
"video_generation_mode": "reference_images_to_video",
"image_urls": [
"https://example.com/character-front.jpg",
"https://example.com/character-side.jpg"
],
"duration": 5,
"resolution": "720p",
"aspect_ratio": "3:4",
"audio": true
}
帶參考音訊的參考生影片
{
"model": "viduq4-preview",
"prompt": "人物說出台詞,嘴型與聲音同步",
"video_generation_mode": "reference_images_to_video",
"image_urls": ["https://example.com/character.jpg"],
"duration": 5,
"resolution": "720p",
"aspect_ratio": "16:9",
"metadata": {
"sounds": ["https://example.com/voice.mp3"]
}
}
提示詞擴寫與浮水印
{
"model": "viduq4-preview",
"prompt": "一隻貓在夕陽下的沙灘上行走",
"image_urls": ["https://example.com/cat.jpg"],
"duration": 8,
"resolution": "2K",
"watermark": true,
"metadata": {
"is_rec": true
}
}
影片生成為非同步任務。使用 取得影片任務狀態 接口查詢進度和結果。
curl --request POST \
--url https://toapis.com/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "viduq4-preview",
"prompt": "圖片中的人物緩緩轉身微笑,電影質感打光",
"image_urls": ["https://example.com/portrait.jpg"],
"duration": 5,
"resolution": "1080p",
"audio": true
}'
import requests
response = requests.post(
"https://toapis.com/v1/videos/generations",
headers={
"Authorization": "Bearer <token>",
"Content-Type": "application/json",
},
json={
"model": "viduq4-preview",
"prompt": "圖片中的人物緩緩轉身微笑,電影質感打光",
"image_urls": ["https://example.com/portrait.jpg"],
"duration": 5,
"resolution": "1080p",
"audio": True,
},
)
print(response.json())
const response = await fetch("https://toapis.com/v1/videos/generations", {
method: "POST",
headers: {
Authorization: "Bearer <token>",
"Content-Type": "application/json"
},
body: JSON.stringify({
model: "viduq4-preview",
prompt: "圖片中的人物緩緩轉身微笑,電影質感打光",
image_urls: ["https://example.com/portrait.jpg"],
duration: 5,
resolution: "1080p",
audio: true
})
});
console.log(await response.json());