curl --request POST \
--url https://api.vidgo.ai/api/generate/submit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "kwaivgi/kling-v4.0/reference-to-video",
"input": {
"reference_image_urls": [
"https://example.com/character.png",
"https://example.com/cafe.png"
],
"prompt": "@Image1 sits at a window table in the cafe from @Image2, sips coffee and waves at the camera, warm afternoon light",
"duration": 8,
"resolution": "720p",
"aspect_ratio": "16:9"
}
}
'{
"code": 200,
"data": {
"task_id": "task-unified-1762160000-abc123",
"status": "not_started",
"created_time": "2026-11-03T10:30:00"
}
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}Request timeout{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}Kling
Kling 4.0 参考生视频
Kling 4.0 参考生视频 API 用最多 10 张参考图、5 个参考视频和 7 个主体引导生成 3–30 秒视频,在提示词中以 @Image1、@Element1 等引用。
POST
/
api
/
generate
/
submit
curl --request POST \
--url https://api.vidgo.ai/api/generate/submit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "kwaivgi/kling-v4.0/reference-to-video",
"input": {
"reference_image_urls": [
"https://example.com/character.png",
"https://example.com/cafe.png"
],
"prompt": "@Image1 sits at a window table in the cafe from @Image2, sips coffee and waves at the camera, warm afternoon light",
"duration": 8,
"resolution": "720p",
"aspect_ratio": "16:9"
}
}
'{
"code": 200,
"data": {
"task_id": "task-unified-1762160000-abc123",
"status": "not_started",
"created_time": "2026-11-03T10:30:00"
}
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}Request timeout{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}- 提交后会返回
task_id。如果提供了callback_url,当任务状态变为finished或failed时,系统会向callback_url发送 POST 请求。 - 无论是否提供
callback_url,都可以通过统一的查询任务状态接口获取结果。
@Image1、@Video1 或 @Element1。
Kling 4.0 是快手 Kling AI 的视频模型。Vidgo 提供四个 model ID:文生视频、图生视频、参考生视频和视频编辑。
模型
- kwaivgi/kling-v4.0/reference-to-video — Kling 4.0 参考生视频,使用图片、视频和主体,3–30 秒,720p 或 1080p。
功能
- 最多 10 张参考图、5 个参考视频和 7 个主体,合计最多 15 个素材。
- 主体可由同一对象的 2–4 张图片或一个视频构成。
- 可通过
image_urls指定起始帧。 - 支持单段或多镜头提示词;3–30 秒,720p 或 1080p。
- 五种宽高比:
auto、16:9、9:16、1:1、21:9。
输入模式
至少传一种参考输入,也可以组合使用:- 参考图(
reference_image_urls):用@Image1、@Image2……引用。 - 参考视频(
reference_video_urls):用@Video1、@Video2……引用,按输入视频计费。 - 主体(
kling_elements):用@Element1、@Element2……引用。视频主体按输入视频计费。
image_urls 可固定开场画面。然后选择单段 prompt 或 multi_prompt 镜头列表:
- 单段提示词:传
prompt,可选传duration。 - 多镜头:传
multi_prompt,每个镜头一项。视频时长为各镜头时长之和;duration可省略,或设为该总和。
必填参数
reference_image_urls、reference_video_urls、kling_elements至少传一个。prompt(string)或multi_prompt(object[]):必须且只能传一个。prompt:去除首尾空白后 1–26,000 个字符。multi_prompt:非空的镜头列表{prompt, duration?}。每个镜头的prompt为 1–512 个字符,duration为1–30的整数(默认5)。各镜头时长之和须为 3–30 秒。
可选参数
reference_image_urls(string[]):最多 10 个公开 HTTP(S) 图片 URL。reference_video_urls(string[]):最多 5 个公开 HTTP(S) 视频 URL,每个 3–30 秒。kling_elements(object[]):最多 7 个主体,其中视频主体最多 3 个。每个主体必须且只能包含以下之一:element_input_urls(string[]):该主体的 2–4 个图片 URL。element_input_video_urls(string[]):该主体的 1 个视频 URL(3–30 秒)。
image_urls(string[]):一个起始帧图片 URL。duration(integer):输出时长,3–30秒。默认5;使用multi_prompt时默认为各镜头时长之和,显式传入的值必须与之相等。resolution(string):720p或1080p。默认720p。aspect_ratio(string):auto、16:9、9:16、1:1或21:9。默认auto。
输出
任务完成后,查询任务状态和回调内容的files 数组中会返回一个带音轨的 MP4 视频。
示例
- 参考图:一张角色图和一张咖啡馆图,分别以
@Image1、@Image2引用,720p,8 秒。 - 主体加参考视频,带回调:由两张图片构成的机器人主体,加一段以
@Video1引用的舞蹈视频,1080p,10 秒,9:16。
注意事项
- 数量限制:起始帧加参考图 ≤ 10;所有素材(起始帧、参考图、参考视频、主体)≤ 15;视频主体 ≤ 3。
- 输入视频会在服务端下载并检测时长(每个最大 100 MB)。每个视频须为 3–30 秒,所有输入视频合计不得超过 30 秒。
- 主体中的
voice_id及其他多余字段会返回 400。 - 上文未列出的字段会返回 400。
model和callback_url放在请求根级,不要放进input。 - 积分在提交时预扣,取决于
resolution和时长。有输入视频时使用单独的输入视频费率,计费秒数 = 输出时长 + max(输出时长,输入视频总时长);输入视频时长先求和再向上取整到整秒。任务失败会全额退还。当前费率见定价页。只含参考图或图片主体的请求按标准费率、以输出时长计费。 - 仅支持 720p 或 1080p 输出;本模型没有 4K 或 HDR 档位,没有音频开关,也不支持
seed。
授权
所有 API 接口都需要 Bearer Token 认证
获取 API Key:
进入 仪表盘 → API 密钥(API Key 管理页面)获取你的 API Key
在请求头中添加:
Authorization: Bearer VIDGO_API_KEY
请求体
application/json