Traditional Chinese ink-and-watercolor animation on textured rice paper. An empty narrow Jiangnan alley in rain, pale stone paving, dark tiled eaves. One fallen ochre oil-paper umbrella lies sideways in the foreground. A gentle gust rolls it half a turn through a shallow puddle; its reflection blooms into soft ink ripples. Locked low camera, continuous movement, restrained monochrome palette with the single ochre accent. No people. No text, logos or watermarks.
Kling O3 Standard Text to Video API
kwaivgi/kling-video-o3-std/text-to-videoKling O3 Standard 文生视频:通过文本提示词生成 3–15 秒视频。支持单镜头和多镜头;sound 必须显式传入,多镜头必须开启声音。
多镜头必须开启声音。表单自动按分镜总时长填写 duration。
Duration: 5 秒 (3-15)
示例
REST API 规格
快速上手
提交任务并查询其状态。
第一步:配置身份鉴权
在控制台申请 API Key,并在发起请求时通过请求头携带 Authorization: Bearer <API_KEY>。
- 任务提交端点
- POST
https://api.vidgo.ai/api/generate/submit - 鉴权请求头
- Authorization: Bearer VIDGO_API_KEY
第二步:提交生成任务
POST /api/generate/submit,指定模型 kwaivgi/kling-video-o3-std/text-to-video。
REQUEST_BODY=$(cat <<'JSON'
{
"model": "kwaivgi/kling-video-o3-std/text-to-video",
"input": {
"duration": 5,
"sound": true,
"multi_shots": true,
"multi_prompt": [
{
"prompt": "Photoreal cinematic science-fiction inside a compact orbital maintenance module. Medium shot: one adult astronaut with short dark hair, wearing a plain off-white flight suit with orange elbow patches, gently catches a single small silver wrench floating in front of her chest. Her body and the wrench drift in zero gravity. Soft blue Earth light through a round window, warm cabin practicals. Quiet ventilation hum and fabric rustle. Controlled natural movement. No text, logos or watermarks.",
"duration": 2
},
{
"prompt": "Cut to a close view of the same astronaut's hand and orange elbow patch in the same orbital cabin. She places the same silver wrench onto a dark magnetic tool panel. The wrench attaches with one crisp metallic click; she releases it and her hand floats gently away. Maintain the same lighting, costume and wrench. End on the stationary attached wrench. Only quiet ventilation and the synchronized magnetic click; no music or speech. No text, logos or watermarks.",
"duration": 3
}
],
"aspect_ratio": "16:9"
}
}
JSON
)
RESPONSE=$(curl --silent --show-error --fail-with-body \
--request POST \
--url "https://api.vidgo.ai/api/generate/submit" \
--header "Authorization: Bearer $VIDGO_API_KEY" \
--header "Content-Type: application/json" \
--data "$REQUEST_BODY")
CODE=$(printf '%s' "$RESPONSE" | jq -r '.code // empty')
if [ "$CODE" != "0" ] && [ "$CODE" != "200" ]; then
printf 'API error: %s
' "$RESPONSE" >&2
exit 1
fi
printf '%s
' "$RESPONSE"第三步:轮询任务执行结果
使用 task_id 查询进度;not_started 或 running 时继续轮询,finished 或 failed 时停止。成功后读取 data.files[].file_url,失败时读取 data.error_message。
状态查询端点
GET https://api.vidgo.ai/api/generate/status/{task_id}使用 task_id 查询进度;not_started 或 running 时继续轮询,finished 或 failed 时停止。成功后读取 data.files[].file_url,失败时读取 data.error_message。
not_startedrunningfinishedfailed{
"code": 200,
"data": {
"task_id": "task-submitted-example",
"status": "not_started",
"created_time": "2026-09-22T00:00:00Z"
}
}{
"code": 200,
"data": {
"task_id": "57TMAHB6XPG6VHL9",
"status": "finished",
"files": [
{
"file_type": "video",
"file_url": "https://cdn.vidgo.ai/apis/models/kwaivgi/kling-video-o3-std/text-to-video/v1/01/output.mp4"
}
],
"created_time": "2026-09-22T18:37:04",
"error_message": null,
"progress": 100
}
}端到端完整脚本示例
展开查看在生产环境中具备轮询重试、异常保护和超时处理的完整自动化脚本。
set -euo pipefail
: "${VIDGO_API_KEY:?Set VIDGO_API_KEY in your environment}"
REQUEST_BODY=$(cat <<'JSON'
{
"model": "kwaivgi/kling-video-o3-std/text-to-video",
"input": {
"duration": 5,
"sound": true,
"multi_shots": true,
"multi_prompt": [
{
"prompt": "Photoreal cinematic science-fiction inside a compact orbital maintenance module. Medium shot: one adult astronaut with short dark hair, wearing a plain off-white flight suit with orange elbow patches, gently catches a single small silver wrench floating in front of her chest. Her body and the wrench drift in zero gravity. Soft blue Earth light through a round window, warm cabin practicals. Quiet ventilation hum and fabric rustle. Controlled natural movement. No text, logos or watermarks.",
"duration": 2
},
{
"prompt": "Cut to a close view of the same astronaut's hand and orange elbow patch in the same orbital cabin. She places the same silver wrench onto a dark magnetic tool panel. The wrench attaches with one crisp metallic click; she releases it and her hand floats gently away. Maintain the same lighting, costume and wrench. End on the stationary attached wrench. Only quiet ventilation and the synchronized magnetic click; no music or speech. No text, logos or watermarks.",
"duration": 3
}
],
"aspect_ratio": "16:9"
}
}
JSON
)
SUBMIT_RESPONSE=$(curl --silent --show-error --fail-with-body \
--request POST \
--url "https://api.vidgo.ai/api/generate/submit" \
--header "Authorization: Bearer $VIDGO_API_KEY" \
--header "Content-Type: application/json" \
--data "$REQUEST_BODY")
TASK_ID=$(printf '%s' "$SUBMIT_RESPONSE" | jq -r '.data.task_id // .task_id // empty')
BUSINESS_CODE=$(printf '%s' "$SUBMIT_RESPONSE" | jq -r '.code // empty')
if [ "$BUSINESS_CODE" != "0" ] && [ "$BUSINESS_CODE" != "200" ]; then
printf 'Submit failed:
%s
' "$SUBMIT_RESPONSE" >&2
exit 1
fi
if [ -z "$TASK_ID" ]; then
printf 'Submit response did not include task_id:
%s
' "$SUBMIT_RESPONSE" >&2
exit 1
fi
START_TIME=$(date +%s)
POLL_DELAY=2
while true; do
if [ $(( $(date +%s) - START_TIME )) -ge 600 ]; then
printf 'Timed out after 600 seconds
' >&2
exit 1
fi
STATUS_RESPONSE=$(curl --silent --show-error --fail-with-body \
--url "https://api.vidgo.ai/api/generate/status/$TASK_ID" \
--header "Authorization: Bearer $VIDGO_API_KEY")
STATUS=$(printf '%s' "$STATUS_RESPONSE" | jq -r '.data.status // .status // empty')
BUSINESS_CODE=$(printf '%s' "$STATUS_RESPONSE" | jq -r '.code // empty')
if [ "$BUSINESS_CODE" != "0" ] && [ "$BUSINESS_CODE" != "200" ]; then
printf 'Status request failed:
%s
' "$STATUS_RESPONSE" >&2
exit 1
fi
case "$STATUS" in
finished)
printf '%s' "$STATUS_RESPONSE" | jq -r '(.data.files // .files // [])[]?.file_url'
break
;;
failed)
printf '%s' "$STATUS_RESPONSE" | jq -r '.data.error_message // .error_message // "Generation failed"' >&2
exit 1
;;
not_started|running)
sleep "$POLL_DELAY"
if [ "$POLL_DELAY" -lt 10 ]; then POLL_DELAY=$((POLL_DELAY + 1)); fi
;;
*)
printf 'Unexpected task status: %s
' "$STATUS" >&2
exit 1
;;
esac
done请求参数(input 对象)
生成参数放在 input 中。建议使用标准 JSON 数字和布尔值。兼容 "5" 这样的整数字符串。布尔字符串 true/1/yes/y/on 表示 true,false/0/no/n/off 表示 false,不区分大小写并忽略首尾空白;布尔字段也接受数值 1 和 0。提示词中的数字和布尔值会转为文本,0、false 和 null 按空值处理;对象和数组不能作为提示词。 提示词的 API 校验上限为 2,500 字符。部分多镜头生成请求曾因单段提示词超过 512 字符而失败,建议每段控制在 512 字符以内;这项建议不改变 API 校验上限。
| 字段 | 类型 | 必填 | 默认值 | 描述 |
|---|---|---|---|---|
| prompt | string | 条件必填 | - | multi_shots=false 时必填,描述场景、动作和镜头运动。去除首尾空白后须为非空文本,最多 2,500 字符。multi_shots=true 时请省略 prompt。 |
| multi_shots | boolean | 是 | - | 必填,必须显式传入 false(单镜头)或 true(多镜头)。单镜头需要 prompt;多镜头需要 multi_prompt 和 sound=true,且顶层 prompt 不得为非空文本。省略此字段会报错。 |
| multi_prompt | array | 条件必填 | - | multi_shots=true 时必填,单镜头模式请省略。至少提供一个分镜,每段包含非空 prompt(最多 2,500 字符)和整数 duration(1–12 秒)。分镜时长之和必须等于顶层 duration(3–15 秒)。分镜内的额外字段会被忽略。 |
| duration | integer | 是 | - | 必填,3–15 秒的整数。多镜头模式下必须等于所有分镜时长之和,积分按此值计算。 |
| sound | boolean | 是 | - | 必填,必须显式传入 true(生成声音)或 false(无声视频)。单镜头可使用任一值,多镜头必须为 true。 |
| aspect_ratio | string | 否 | - | 可选,支持 16:9(横屏)、9:16(竖屏)或 1:1(方形),用于设置视频画幅。 |
响应字段(查询状态接口)
GET /api/generate/status/{task_id} 接口返回的详细参数说明:
| 字段 | 类型 | 描述 |
|---|---|---|
| code | integer | 接口响应状态码(200 表示成功)。 |
| data.task_id | string | 全局唯一的生成任务标识符。 |
| data.status | string | 任务执行阶段:not_started(排队)、running(处理中)、finished(已完成)或 failed(失败)。 |
| data.files | array | 生成成功时返回的媒体资产列表,包含 file_url 与 file_type。 |
| data.error_message | string | null | 当任务失败时返回的具体诊断错误信息。 |
任务生命周期
客户端应持续轮询任务状态,直至进入 finished 或 failed 终态:
not_started排队中
running生成中
finished已就绪
failed失败
轮询与异常处理
- 轮询频率建议建议提交任务后前 10 秒每隔 2-3 秒轮询一次,之后可适度放缓至 5 秒一次。
- 网络容错设计遇到临时网络抖动或网关 5xx 错误时不要重新提交任务,应使用原 task_id 继续轮询重试。
- 回调机制(Webhook)在提交任务时传入 callback_url,可在任务完成时自动接收系统推送的最终结果。
接口规格
| 规格项 | 取值 | 说明 |
|---|---|---|
| 模型 | kwaivgi/kling-video-o3-std/text-to-video | 快手可灵 O3 原生多模态文生视频标准版,支持 720p 分辨率与多镜头叙事调度。 |
| 时长 | 3-15 s | 必填,3–15 整数秒。多镜头时必须等于各分镜时长之和,按此时长计费。 |
Kling O3 Standard Text to Video
Kling O3 Standard 文生视频:通过文本提示词生成 3–15 秒视频。支持单镜头和多镜头;sound 必须显式传入,多镜头必须开启声音。
为什么选择此模型
720p 高效渲染兼顾出色的生成画质与快速的响应周期,为批量原型探索与社媒短片制作提供充沛产能。
多镜头分镜叙事单次生成内支持多个分镜,独立定义每个镜头的提示词与时长,实现复杂叙事时序。
原生音视频同步一键合成与画面动作精准匹配的环境音效、拟真对白与多语种口型,无需繁琐后期配音。
视觉思维链推理依托统一多模态架构在渲染前系统规划场景空间构图、镜头轨迹与光影逻辑,保障运镜平滑稳定。
灵活画幅随心切换预置 16:9 横屏、9:16 竖屏与 1:1 正方形画幅,无缝适配流媒体播放与移动端信息流传播。
参数说明
| 参数 | 要求 | 说明 |
|---|---|---|
| prompt | 条件必填 | multi_shots=false 时必填,描述场景、动作和镜头运动。去除首尾空白后须为非空文本,最多 2,500 字符。multi_shots=true 时请省略 prompt。 默认值 - |
| multi_shots | 是 | 必填,必须显式传入 false(单镜头)或 true(多镜头)。单镜头需要 prompt;多镜头需要 multi_prompt 和 sound=true,且顶层 prompt 不得为非空文本。省略此字段会报错。 默认值 - |
| multi_prompt | 条件必填 | multi_shots=true 时必填,单镜头模式请省略。至少提供一个分镜,每段包含非空 prompt(最多 2,500 字符)和整数 duration(1–12 秒)。分镜时长之和必须等于顶层 duration(3–15 秒)。分镜内的额外字段会被忽略。 默认值 - |
| duration | 是 | 必填,3–15 秒的整数。多镜头模式下必须等于所有分镜时长之和,积分按此值计算。 默认值 - |
| sound | 是 | 必填,必须显式传入 true(生成声音)或 false(无声视频)。单镜头可使用任一值,多镜头必须为 true。 默认值 - |
| aspect_ratio | 否 | 可选,支持 16:9(横屏)、9:16(竖屏)或 1:1(方形),用于设置视频画幅。 默认值 - |
使用步骤
明确主体与环境在提示词中详细描写角色外观、核心行为动作以及场景的光线氛围。
选择镜头调度模式可选择单镜头连续推进,或开启多镜头分镜模式并逐一配置各分镜的提示词与秒数。
设置成片时长与画幅选择 3–15 秒的整数时长,并指定适合发布渠道的画面比例(16:9、9:16 或 1:1)。
配置原生声音开关开启声音选项以同步生成环境声与匹配音效,多镜头模式下声音选项自动保持启用。
提交任务并获取成片提交生成任务,系统进入异步渲染流水线,完成后即可在线预览与下载高品质 MP4 视频。
价格
费用 = 顶层 duration × 每秒费率。1 积分 = $0.005。任务若执行失败,系统将全额自动返还扣除的积分。
| 计费项 | 费率 | 说明 |
|---|---|---|
| 无声 | 10 积分/秒 ($0.050/s) | 文生视频标准 720p 规格,不含音频轨道。 |
| 有声 | 13 积分/秒 ($0.065/s) | 包含原生同步合成的环境音效、音画对白与多语种口型。 |
适用场景
短视频内容创意孵化快速将文案脑洞转化为 720p 成品样片,验证剧情节奏与视听效果。
社交媒体动态信息流一键输出适配移动端竖屏的信息流短片,自带原生音效增强粉丝互动与完播率。
微短剧分镜预演借助多镜头能力将剧本片段直接渲染为连贯视听小节,高效评估分镜衔接。
电商概念视觉演示通过纯文本描述产品使用场景与动态光影,低成本生成电商动态主图素材。
使用技巧
- 建议采用“主体外貌 + 动作时序 + 镜头轨迹 + 光照氛围”的四层结构编写提示词。
- 开启多镜头模式时,确保所有分镜的时长总和精确等于顶层 duration 设定值。
- 在提示词中加入具体的音效描写(如“踩过水洼的飞溅声”、“清脆的钟鸣”),有助于引导音频扩散引擎生成更为逼真的细节。
- 使用平稳的运镜术语(如“平滑横摇”、“缓慢推近”),能够获得更加稳健的相机运动轨迹。
- 叙事性内容建议单分镜分配 2–4 秒,使视觉动作拥有充分的物理展开时间。
注意事项
- 单镜头模式下顶层 prompt 必填;开启多镜头模式时顶层 prompt 须为空,所有描述均配置在各分镜的 prompt 中。
- 多镜头模式要求 sound 参数必须为 true,以保障跨分镜音画同步渲染。
- 任务采用异步作业机制,提交后会立即返回任务 ID,可通过轮询或配置 Webhook 回调获取最终资产。
Kling O3 Standard Text to Video API 常见问题
这个端点可以生成什么?
Kling O3 Standard 文生视频:通过文本提示词生成 3–15 秒视频。支持单镜头和多镜头;sound 必须显式传入,多镜头必须开启声音。
如何设置多镜头?
必填,必须显式传入 false(单镜头)或 true(多镜头)。单镜头需要 prompt;多镜头需要 multi_prompt 和 sound=true,且顶层 prompt 不得为非空文本。省略此字段会报错。 multi_shots=true 时必填,单镜头模式请省略。至少提供一个分镜,每段包含非空 prompt(最多 2,500 字符)和整数 duration(1–12 秒)。分镜时长之和必须等于顶层 duration(3–15 秒)。分镜内的额外字段会被忽略。
视频画幅如何确定?
可选,支持 16:9(横屏)、9:16(竖屏)或 1:1(方形),用于设置视频画幅。
如何控制声音?
必填,必须显式传入 true(生成声音)或 false(无声视频)。单镜头可使用任一值,多镜头必须为 true。
提示词有哪些长度限制?
提示词的 API 校验上限为 2,500 字符。部分多镜头生成请求曾因单段提示词超过 512 字符而失败,建议每段控制在 512 字符以内;这项建议不改变 API 校验上限。
时长和积分如何计算?
时长为 3–15 秒。无声视频 10 credits/秒,有声视频 13 credits/秒;积分为顶层 duration 乘以对应费率。
生成失败或请求超时怎么办?
非法参数会在创建生成任务和扣费前被拒绝。已受理的生成任务状态变为 failed 后,已扣积分会退回。客户端超时不代表任务失败,请先查询原 task_id 的状态,再决定是否重新提交。