Omni
使用 Kling 3.0 Omni 统一生成视频,可组合提示词、图片、Element 与参考视频。异步任务接口,提交后返回任务 ID,需轮询获取结果。
使用 Kling 3.0 Omni 模型生成视频,可灵活组合文本提示词、首/尾帧、参考图、Element、特征参考视频与待编辑底视频。
支持多镜头叙事、原生 / 原声 / 无音频、720p / 1080p / 4k 分辨率,时长 3–15 秒。
异步任务型接口:提交后立即返回任务 id,需轮询任务状态,成功后再下载视频。
仅支持 Kling 3.0 Omni 模型。
Base URL
https://api.autorouter.top— Production
Authentication
BearerAuth: http (bearer)
使用 Bearer Token 认证。
格式: Authorization: Bearer sk-xxxxxx
Endpoints
POST /kling/omni-video/kling-3.0-omni
创建视频生成任务
基于提示词、图片、Element 和/或视频创建 Omni 视频生成任务。
Headers
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
Content-Type | string | Yes | application/json | 数据交换格式 |
Authorization | string | Yes | - | 鉴权头。格式:Bearer sk-xxxxxx |
Request Body
Content-Type: application/json
Example(仅 prompt):
{
"contents": [
{
"type": "prompt",
"text": "将鹦鹉的羽毛颜色改为与参考图一致,视频中其他元素保持不变。"
}
],
"settings": {
"resolution": "1080p",
"duration": 5,
"audio": "native",
"multi_shot": false
},
"options": {
"callback_url": "https://xxx/callback",
"external_task_id": "",
"watermark_info": {
"enabled": false
}
}
}Example(first_frame & refer_image):
{
"contents": [
{
"type": "prompt",
"text": "将鹦鹉的羽毛颜色改为与参考图一致,视频中其他元素保持不变。"
},
{
"type": "first_frame",
"url": "https://example.com/first.png",
"id": "image_1"
},
{
"type": "refer_image",
"url": "https://example.com/refer.png",
"id": "image_2"
}
],
"settings": {
"resolution": "1080p",
"duration": 5,
"audio": "native",
"multi_shot": false
},
"options": {
"callback_url": "https://xxx/callback",
"external_task_id": ""
}
}Example(first_frame & last_frame & element):
{
"contents": [
{
"type": "prompt",
"text": "将鹦鹉的羽毛颜色改为与参考图一致,视频中其他元素保持不变。"
},
{
"type": "first_frame",
"url": "https://example.com/first.png",
"id": "image_1"
},
{
"type": "last_frame",
"url": "https://example.com/last.png",
"id": "image_2"
},
{
"type": "element",
"element_id": "162",
"id": "element_1"
},
{
"type": "element",
"element_id": "163",
"id": "element_2"
}
],
"settings": {
"resolution": "1080p",
"duration": 5,
"audio": "native",
"multi_shot": true
},
"options": {
"callback_url": "https://xxx/callback",
"external_task_id": ""
}
}Example(feature_video):
{
"contents": [
{
"type": "prompt",
"text": "将鹦鹉的羽毛颜色改为与参考图一致,视频中其他元素保持不变。"
},
{
"type": "feature_video",
"url": "https://example.com/feature.mp4",
"id": "video_1"
}
],
"settings": {
"resolution": "4k",
"audio": "off",
"multi_shot": true
},
"options": {
"callback_url": "https://xxx/callback",
"external_task_id": ""
}
}Example(base_video):
{
"contents": [
{
"type": "prompt",
"text": "将鹦鹉的羽毛颜色改为与参考图一致,视频中其他元素保持不变。"
},
{
"type": "base_video",
"url": "https://example.com/base.mp4",
"id": "video_1"
}
],
"settings": {
"resolution": "1080p",
"audio": "original",
"multi_shot": false
},
"options": {
"callback_url": "https://xxx/callback",
"external_task_id": ""
}
}Properties:
| Name | Type | Required | Default | Enum | Description |
|---|---|---|---|---|---|
contents | object[] | Yes | - | - | 参考输入集合(提示词、图片、Element、视频等) |
contents[].type | string | Yes | - | prompt, first_frame, last_frame, refer_image, feature_video, base_video, element | 输入类型 |
settings | object | No | - | - | 输出配置,如分辨率、时长等 |
settings.multi_shot | boolean | No | true | - | 是否生成多镜头视频 |
settings.audio | string | No | off | native, original, off | 是否为视频生成音频 |
settings.resolution | string | No | 720p | 720p, 1080p, 4k | 生成视频分辨率 |
settings.aspect_ratio | string | No | 16:9 | 16:9, 9:16, 1:1 | 画面宽高比;无首帧且无参考视频时必填 |
settings.duration | int | No | 5 | 3–15 | 视频时长(秒) |
options | object | No | - | - | 通用配置,如回调地址、水印等 |
options.callback_url | string | No | - | - | 任务状态变更回调 URL |
options.external_task_id | string | No | - | - | 自定义任务 ID,账户内须唯一 |
options.watermark_info | object | No | - | - | 是否同时生成带水印结果 |
contentsobject[](必选)
参考输入集合。格式示例:
[
{
"type": "prompt",
"text": "string"
},
{
"type": "first_frame",
"url": "string",
"id": "string"
},
{
"type": "last_frame",
"url": "string",
"id": "string"
},
{
"type": "refer_image",
"url": "string",
"id": "string"
},
{
"type": "feature_video",
"url": "string",
"id": "string"
},
{
"type": "base_video",
"url": "string",
"id": "string"
},
{
"type": "element",
"element_id": "string",
"id": "string"
}
]输入类型:
prompt:文本提示词first_frame:首帧图片last_frame:尾帧图片refer_image:元素 / 场景参考图feature_video:特征参考视频base_video:待编辑底视频element:Element
{
"type": "prompt",
"text": "string"
}text:提示词内容,最长 3072 字符(建议 ≤ 2500)- 多镜头格式:
"shot n, m, words; shot n, m, words;"(用标准分号分隔),其中:n:镜头序号(支持 1–6 个镜头)m:镜头时长(秒,每个镜头 ≥ 1s;各镜头时长之和须等于总视频时长)words:镜头提示词(最长 512 字符)
- 可在提示词中用
@xxx引用图片、Element 或视频,例如@image_1、@Zhang、@video_1 - 避免 Element 名称互为子串(如
@Zhang与@ZhangSan) - 避免 Element 名称与提示词内容重叠(例如提示词含
xxx@gmail.com时不要使用@gmail)
{
"type": "first_frame",
"url": "string",
"id": "string"
}图片可用作场景 / 风格参考,也可作为首帧或尾帧生成视频。
url:图片 URL 或 Base64id:可选的输入索引 ID,用于在提示词中引用;同一任务内不可重复- 格式:
.jpg、.jpeg、.png - 大小: 最大 50MB
- 尺寸: 宽高均 ≥ 300px;宽高比介于
1:2.5与2.5:1之间 - 支持「仅首帧」与「首尾帧」;不支持「仅尾帧」
- 数量限制(取决于是否有参考视频及 Element 类型):
- 无参考视频 + 仅多图 Element:参考图与多图 Element 总数 ≤ 7
- 无参考视频 + 同时有视频角色 Element 与多图 Element:参考图与多图 Element 总数 ≤ 4
- 有参考视频 + 仅多图 Element:参考图与多图 Element 总数 ≤ 4
- 有参考视频时:不支持同时使用视频角色 Element 与参考图
{
"type": "feature_video",
"url": "string",
"id": "string"
}url:视频 URLid:可选的输入索引 ID,用于在提示词中引用;同一任务内不可重复- 格式:
.mp4、.mov - 大小: 最大 200MB
- 时长: 3s–15.5s(含)
- 尺寸: 宽高介于 700px–4553px;总像素 ≤ 8294400;宽高比介于 0.4–2
- 帧率: 24fps–60fps(生成视频为 24fps)
- 最多 1 个参考视频。添加参考视频后,最多再添加 1 个视频角色 Element
使用 feature_video 时:
- 支持多镜头;此时
multi_shot只能为true - 不支持原生音频;此时
audio只能为off
使用 base_video(待编辑视频)时:
- 不支持定义首帧或尾帧
- 不支持生成多镜头视频
- 不支持原生音频,即
audio不能为native
{
"type": "element",
"element_id": "string",
"id": "string"
}element_id:由 Element 相关接口返回的 Element IDid:用于在提示词中引用的输入索引 ID(如@element_1);同一任务内不可重复- Element 分为视频角色 Element(由视频定制)与多图 Element(由图片定制);适用数量限制因类型而异
- 数量上限:
- 使用首帧或首尾帧生成视频时:最多 3 个 Element
- 无参考视频 + 仅多图 Element:参考图与多图 Element 总数 ≤ 7
- 无参考视频 + 仅视频角色 Element:视频角色 Element ≤ 3
- 无参考视频 + 两类 Element 同时存在:视频角色 Element ≤ 3;参考图与多图 Element 总数 ≤ 4
- 有参考视频 + 仅多图 Element:参考图与多图 Element 总数 ≤ 4
- 有参考视频 + 仅视频角色 Element:视频角色 Element ≤ 1
- 有参考视频时:不支持同时使用视频角色 Element 与多图 Element
settingsobject(可选)
输出配置,如分辨率、时长等。
是否生成多镜头视频。默认 true。
设为 false 时,多镜头提示词不会产出多镜头结果。
是否为视频生成音频。默认 off。
native:生成与画面匹配的原生音频original:保留参考视频原声off:无音频
输出视频分辨率。默认 720p。
720p:720P 输出1080p:1080P 输出4k:4K 输出
生成视频画面宽高比。默认 16:9。
可选:16:9、9:16、1:1
无首帧且无参考视频时必填。
视频时长(秒)。默认 5。
可选:3、4、5、6、7、8、9、10、11、12、13、14、15
optionsobject(可选)
通用配置,如回调地址与水印。
{
"callback_url": "https://example.com/cb",
"external_task_id": "string",
"watermark_info": {
"enabled": false
}
}任务结果通知回调 URL。若配置,任务状态变更时服务端会发送通知。
自定义任务 ID。不会覆盖系统生成的任务 ID,可用于查询。账户内须唯一。
是否同时生成带水印结果,由 enabled 控制:
{
"enabled": false
}true:包含带水印结果false(默认):不含水印
暂不支持自定义水印。
Responses
200: 任务创建成功
Content-Type: application/json
请求示例
curl -X POST "https://api.autorouter.top/kling/omni-video/kling-3.0-omni" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-xxxxxx" \
-d '{
"contents": [
{
"type": "prompt",
"text": "将鹦鹉的羽毛颜色改为与参考图一致,视频中其他元素保持不变。"
},
{
"type": "first_frame",
"url": "https://example.com/first.png",
"id": "image_1"
},
{
"type": "refer_image",
"url": "https://example.com/refer.png",
"id": "image_2"
}
],
"settings": {
"resolution": "1080p",
"duration": 5,
"audio": "native",
"multi_shot": false
},
"options": {
"callback_url": "https://xxx/callback",
"external_task_id": ""
}
}'响应示例
{
"code": 0,
"message": "string",
"request_id": "string",
"data": {
"id": "string",
"status": "submitted",
"create_time": 1781080778802,
"update_time": 1781080794151,
"external_id": "string"
}
}Response fields:
| Name | Type | Description |
|---|---|---|
code | integer | 错误码;0 表示成功 |
message | string | 错误信息 |
request_id | string | 系统生成的请求 ID |
data.id | string | 系统生成的任务 ID |
data.status | string | 任务状态:submitted、processing、succeeded、failed |
data.create_time | integer | 任务创建时间,Unix 时间戳(毫秒) |
data.update_time | integer | 任务更新时间,Unix 时间戳(毫秒) |
data.external_id | string | 该任务的自定义任务 ID(如有) |
GET /kling/tasks
查询视频生成任务
按系统任务 ID 或自定义任务 ID 查询异步任务状态与结果。
task_ids与external_task_ids二选一,不可同时使用- 支持批量查询,多个 ID 用
,分隔 - 生成结果约 30 天后清理,请及时保存
Headers
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
Content-Type | string | Yes | application/json | 数据交换格式 |
Authorization | string | Yes | - | 鉴权头。格式:Bearer sk-xxxxxx |
Query Params
| Name | Type | Required | Description |
|---|---|---|---|
task_ids | string | No | 系统生成的任务 ID,逗号分隔 |
external_task_ids | string | No | 自定义任务 ID,逗号分隔 |
Responses
200: 任务查询成功
Content-Type: application/json
请求示例
curl -X GET "https://api.autorouter.top/kling/tasks?task_ids={id}" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-xxxxxx"响应示例
{
"code": 0,
"message": "string",
"request_id": "string",
"data": [
{
"id": "893605946402811985",
"status": "succeeded",
"message": "string",
"create_time": 1781080778802,
"update_time": 1781080794151,
"external_id": "string",
"outputs": [
{
"type": "video",
"id": "string",
"url": "string",
"watermark_url": "string",
"duration": "5"
}
],
"billing": [
{
"charge_type": "cash",
"cash_type": "balance",
"amount": "string",
"package_type": "video",
"list_price": "string"
}
]
}
]
}Response fields:
| Name | Type | Description |
|---|---|---|
code | integer | 错误码;0 表示成功 |
message | string | 错误信息 |
request_id | string | 系统生成的请求 ID,用于追踪与排查 |
data | object[] | 任务列表 |
data[].id | string | 被查询的任务 ID |
data[].status | string | 任务状态:submitted、processing、succeeded、failed |
data[].message | string | 状态信息;失败时为失败原因(如内容风控) |
data[].create_time | integer | 任务创建时间,Unix 时间戳(毫秒) |
data[].update_time | integer | 任务更新时间,Unix 时间戳(毫秒) |
data[].external_id | string | 自定义任务 ID(如有) |
data[].outputs | object[] | 生成结果;字段随 type 变化 |
data[].billing | object[] | 计费明细 |
statusstring
任务状态:
submitted:已提交processing:处理中succeeded:成功failed:失败
建议轮询间隔 3–5 秒,直到 status 为 succeeded 或 failed。
outputsobject[]
生成结果。字段取决于 type。可能值:image、video、audio、element、voice。Omni 成功时通常返回 type=video。
| Name | Type | Description |
|---|---|---|
type | string | 固定为 video |
id | string | 视频 ID,由系统生成 |
url | string | 结果 URL(防盗链;约 30 天后清理,请及时保存) |
watermark_url | string | 带水印结果 URL(防盗链) |
duration | string | 生成视频时长(秒) |
| Name | Type | Description |
|---|---|---|
type | string | 固定为 image |
url | string | 结果 URL(防盗链;约 30 天后清理) |
watermark_url | string | 带水印图片下载 URL(防盗链) |
group_id | string | 仅分组图片时出现,用于标记分组关系 |
| Name | Type | Description |
|---|---|---|
type | string | 固定为 audio |
id | string | 音频 ID,由系统生成 |
mp3_url | string | MP3 结果 URL(防盗链;约 30 天后清理) |
wav_url | string | WAV 结果 URL(防盗链;约 30 天后清理) |
mp3_duration | string | MP3 时长(秒) |
wav_duration | string | WAV 时长(秒) |
| Name | Type | Description |
|---|---|---|
type | string | 固定为 voice |
id | string | 音频 ID,由系统生成 |
name | string | 音频名称 |
url | string | 素材下载链接 |
owned_by | string | 音色来源:kling 为官方库,数字为创作者 ID |
status | string | 状态:succeeded、deleted |
| Name | Type | Description |
|---|---|---|
type | string | 固定为 element |
id | string | 元素 ID,由系统生成 |
name | string | 元素名称 |
description | string | 元素描述 |
element_type | string | 元素类型:video_character_elements、multi_image_elements |
references | object[] | 元素相关素材 |
references[].type | string | 素材类型:image、video、voice |
references[].role | string | 素材属性;图片为 frontal / reference,视频与音色为 refer |
references[].url | string | 素材下载链接 |
references[].id | string | 音色 ID(type=voice 时) |
references[].name | string | 音色名称(type=voice 时) |
references[].owned_by | string | 音色来源(type=voice 时) |
owned_by | string | 元素来源:kling 为官方库,数字为创作者 ID |
status | string | 状态:succeeded、deleted |
tags | object[] | 元素标签 |
tags[].id | integer | 标签 ID |
tags[].name | string | 标签名称 |
tags[].description | string | 标签描述 |
billingobject[]
计费明细。
消耗账户类型:
cash:余额扣费unit:资源包扣费
余额类型,仅 charge_type=cash 时存在:
balance:正式额度test_balance:测试额度
扣费金额。charge_type=cash 时为余额折扣价;charge_type=unit 时为资源包扣减单位数(十进制字符串)。
资源包类型,仅 charge_type=unit 时存在。固定枚举:video、image、audio。
余额扣费标价,仅 charge_type=cash 时存在。
错误处理
HTTP 400 参数错误
| 场景 | 处理建议 |
|---|---|
缺少 contents | 至少提供一个有效输入项 |
| 仅传尾帧 | 不支持仅尾帧,须包含首帧 |
| 图片 / 视频格式或尺寸不合规 | 参考 first_frame / refer_image / feature_video / base_video 限制 |
| 参考图或 Element 数量超限 | 按当前模式的数量限制传参 |
feature_video 且 audio=native | 使用 audio=off |
base_video 搭配首尾帧 / multi_shot / audio=native | 遵循底视频限制 |
无首帧且无参考视频时缺少 aspect_ratio | 提供 settings.aspect_ratio |
duration / resolution / audio 非法 | 使用文档列出的枚举值 |
| 多镜头时长之和不等于总时长 | 确保各镜头时长之和等于 settings.duration |
HTTP 401 / 403 鉴权错误
401 Unauthorized:API Key 无效或已过期403 Forbidden:API Key 无权访问此模型
HTTP 402 余额不足
返回余额不足错误。请前往 AutoRouter 控制台充值。
任务 failed 状态
| 原因 | 处理建议 |
|---|---|
| 内容审核失败 | 调整提示词或更换参考素材 |
| 图片 / 视频 URL 不可访问 | 确保公网可访问,或图片改用 Base64 |
| 参数组合非法 | 按 Request Body 规范传参 |
任务失败时 AutoRouter 会自动退款到你的账户。