Vidu 官方接口
curl --request POST \
--url 'https://api.example.com/{{llmApiOrigin}}/vidu/ent/v2/text2video' \
--header 'Authorization: <authorization>'import requests
url = "https://api.example.com/{{llmApiOrigin}}/vidu/ent/v2/text2video"
headers = {"Authorization": "<authorization>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: '<authorization>'}};
fetch('https://api.example.com/{{llmApiOrigin}}/vidu/ent/v2/text2video', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/{{llmApiOrigin}}/vidu/ent/v2/text2video",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/{{llmApiOrigin}}/vidu/ent/v2/text2video"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/{{llmApiOrigin}}/vidu/ent/v2/text2video")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/{{llmApiOrigin}}/vidu/ent/v2/text2video")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body视频系列
Vidu 官方接口
Vidu 视频生成官方接口(文生视频 / 图生视频 / 首尾帧 / 参考图)
POST
{llmApiOrigin}
/
vidu
/
ent
/
v2
/
text2video
Vidu 官方接口
curl --request POST \
--url 'https://api.example.com/{{llmApiOrigin}}/vidu/ent/v2/text2video' \
--header 'Authorization: <authorization>'import requests
url = "https://api.example.com/{{llmApiOrigin}}/vidu/ent/v2/text2video"
headers = {"Authorization": "<authorization>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: '<authorization>'}};
fetch('https://api.example.com/{{llmApiOrigin}}/vidu/ent/v2/text2video', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/{{llmApiOrigin}}/vidu/ent/v2/text2video",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/{{llmApiOrigin}}/vidu/ent/v2/text2video"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/{{llmApiOrigin}}/vidu/ent/v2/text2video")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/{{llmApiOrigin}}/vidu/ent/v2/text2video")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body简介
Vidu 官方接口以 Vidu 官方 API 风格提供文生视频、图生视频、首尾帧生视频和参考图生视频能力,通过腾讯 TokenHub 或 Vidu 官方渠道分发。模型标识写在请求体里,不同场景对应不同的 URL 路径。| 方法 | 路径 | 场景 |
|---|---|---|
POST | /vidu/ent/v2/text2video | 文生视频 |
POST | /vidu/ent/v2/img2video | 图生视频(首帧) |
POST | /vidu/ent/v2/start-end2video | 首尾帧生视频 |
POST | /vidu/ent/v2/reference2video | 参考图生视频 |
GET | /vidu/ent/v2/tasks/{task_id}/creations | 查询任务与结果 |
认证
string
必填
Bearer Token,如
Bearer sk-xxxxxxxxxx支持模型
| 模型 | 说明 |
|---|---|
viduq3 | Vidu Q3(TokenHub 渠道) |
viduq3-pro | Vidu Q3 Pro |
viduq3-turbo | Vidu Q3 Turbo |
viduq2 | Vidu Q2(参考图生视频仅支持该系列) |
viduq1 | Vidu Q1 |
vidu2.0 | Vidu 2.0 |
vidu1.5 | Vidu 1.5 |
提交任务
POST/vidu/ent/v2/text2video(或按场景选 img2video / start-end2video / reference2video)
文生视频
curl -X POST "https://api.shengmoai.com/vidu/ent/v2/text2video" \
-H "Authorization: Bearer sk-xxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "viduq3-pro",
"prompt": "一只白色的小猫在草地上打滚,阳光明媚",
"duration": 5,
"resolution": "1080P"
}'
图生视频(首帧)
curl -X POST "https://api.shengmoai.com/vidu/ent/v2/img2video" \
-H "Authorization: Bearer sk-xxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "viduq3-pro",
"prompt": "人物的衣角随风飘动,镜头缓慢拉近",
"images": ["https://example.com/assets/first.png"],
"duration": 5
}'
首尾帧生视频
images 传两张图(首帧 + 尾帧):
curl -X POST "https://api.shengmoai.com/vidu/ent/v2/start-end2video" \
-H "Authorization: Bearer sk-xxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "viduq3-pro",
"prompt": "画面从首帧自然过渡到尾帧",
"images": ["https://example.com/assets/start.png", "https://example.com/assets/end.png"],
"duration": 5
}'
参考图生视频
images 传多张参考图(仅 viduq2 模型支持,不能带 pro/turbo 后缀):
curl -X POST "https://api.shengmoai.com/vidu/ent/v2/reference2video" \
-H "Authorization: Bearer sk-xxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "viduq2",
"prompt": "让参考图里的角色在镜头前自然挥手",
"images": ["https://example.com/assets/ref1.png", "https://example.com/assets/ref2.png", "https://example.com/assets/ref3.png"],
"duration": 5
}'
请求参数
| 字段 | 类型 | 说明 |
|---|---|---|
model | string | 模型标识(必填) |
prompt | string | 提示词 |
images | array | 图片输入(URL 或 Base64)。1 张为首帧;2 张为首尾帧;多于 2 张为参考图 |
duration | integer | 时长(秒),默认 5 |
seed | integer | 随机种子 |
resolution | string | 分辨率,如 360P、540P、720P、1080P(模型支持范围不同) |
movement_amplitude | string | 运动幅度,默认 auto |
bgm | boolean | 是否生成背景音乐 |
payload | string | 扩展透传参数 |
callback_url | string | 回调地址 |
metadata.action | string | 可选:手动指定动作(text / generate / first_tail / reference),默认根据 images 数量自动判断 |
提交响应
任务接受后返回视频任务对象(task_id 用于查询):
{
"id": "task_1234567890",
"task_id": "task_1234567890",
"object": "video",
"model": "viduq3-pro",
"status": "queued",
"created_at": 1782642668
}
查询任务
GET/vidu/ent/v2/tasks/{task_id}/creations
curl "https://api.shengmoai.com/vidu/ent/v2/tasks/task_1234567890/creations" \
-H "Authorization: Bearer sk-xxxxxxxxxx"
state 取值语义:
| 状态 | 说明 |
|---|---|
created / queueing | 排队中 |
processing | 生成中 |
success | 成功 |
failed | 失败 |
creations[](url 为视频地址、cover_url 为封面图),也可以使用视频内容获取接口取视频文件。
相关页面
视频生成总览
异步流程与入口选择
视频内容获取
下载与代理获取视频文件
