One continuous five-second cinematic shot inside a quiet orbiting space station. Medium close-up of a female astronaut in a plain blue flight suit, face unobstructed, floating beside a round window showing Earth. One large clear water droplet floats slowly at eye level in front of her. She follows it with her eyes, smiles gently and says clearly in English, 'Even water flies up here.' Natural synchronized lips and subtle facial expression. The droplet drifts upward as she remains weightless; restrained camera drift, realistic skin and soft daylight. Native audio: her calm close voice over a soft steady ventilation hum. Finish the short sentence within the shot. No music, subtitles, written text, logos, advertising, helmets or scene cuts.
Kling 2.6 Pro Text to Video API
kwaivgi/kling-v2.6-pro/text-to-videoKling 2.6 Pro Text to Video 将纯文本提示词转化为 1080p 影视级动态视频,支持原生音视频同步、5 秒与 10 秒灵活时长,以及多种标准电影画幅。它能够严格遵循提示词中的复杂场景设定与物理运动规律,并在大幅度动态演绎中保持时空连贯与视觉细节稳定。
747/1,000
示例
REST API 规格
快速上手
提交任务并查询状态。example.com 和 your-domain.com 地址仅为占位示例;图片和回调地址请替换为你自己的公开可访问地址,输出文件地址仅作展示。
第一步:配置身份鉴权
在控制台申请 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-v2.6-pro/text-to-video
REQUEST_BODY=$(cat <<'JSON'
{
"model": "kwaivgi/kling-v2.6-pro/text-to-video",
"input": {
"prompt": "A slow camera pan across a sunlit garden.",
"duration": 5,
"sound": false,
"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-example",
"status": "running",
"created_time": "2026-09-23T00:00:00Z"
}
}{
"code": 200,
"data": {
"task_id": "task-example",
"status": "finished",
"files": [
{
"file_type": "video",
"file_url": "https://example.com/output.mp4"
}
],
"created_time": "2026-09-23T00:00:00Z"
}
}端到端完整脚本示例
展开查看在生产环境中具备轮询重试、异常保护和超时处理的完整自动化脚本。
set -euo pipefail
: "${VIDGO_API_KEY:?Set VIDGO_API_KEY in your environment}"
REQUEST_BODY=$(cat <<'JSON'
{
"model": "kwaivgi/kling-v2.6-pro/text-to-video",
"input": {
"prompt": "A slow camera pan across a sunlit garden.",
"duration": 5,
"sound": false,
"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 中,model 和可选 callback_url 放在请求根级。使用标准 JSON 类型;不支持的 input 字段会被拒绝。
| 字段 | 类型 | 必填 | 默认值 | 描述 |
|---|---|---|---|---|
| prompt | string | 是 | - | 必填字符串,去除首尾空白后为 1–1,000 个字符,不能为空。 |
| duration | integer | 是 | - | 必填整数,仅支持 5 或 10 秒;不接受字符串或小数时长。 |
| aspect_ratio | string | 是 | - | 必填:16:9、9:16 或 1:1。控制输出视频的宽高比。 |
| sound | boolean | 是 | - | 必填布尔值。true 为有声,false 为无声。 |
响应字段(查询状态接口)
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-v2.6-pro/text-to-video | |
| 时长 | 5 / 10 s | 必填整数,仅支持 5 或 10 秒;不接受字符串或小数时长。 |
Kling 2.6 Pro Text to Video API 常见问题
Kling 2.6 Pro Text to Video API 是什么?
Kling 2.6 Pro Text to Video 是快手科技研发的高阶文本生成视频模型。它根据文本提示词直接生成 1080p 影视级高清视频,支持 5 秒与 10 秒成片时长、原生音视频同步合成,以及 16:9、9:16 和 1:1 三种主流构图画幅。基于先进的时空扩散建模架构,它在严格遵循文本运动指导的同时保持真实物理规律与画面连贯性。你可以通过 API 进行程序化调用,也可以在上方体验区直接在线试用。
Kling 2.6 Pro Text to Video 的原生音频支持哪些声音类型?
开启声音选项后,模型会在单次推理中同步合成与画面动作契合的原生音效,包含环境背景音、物理动作拟音以及情境伴音,免去额外的后期音频制作流程。
Kling 2.6 Pro Text to Video 支持生成 10 秒视频吗?
支持。该端点提供 5 秒与 10 秒两种整秒时长选项。选择 10 秒规格可以呈现更完整的镜头叙事、更丰富的动作演进与连贯的场景氛围。
Kling 2.6 Pro Text to Video 支持哪些画面比例?
支持 16:9 宽画幅、9:16 竖屏以及 1:1 正方形比例。模型在生成时直接按指定比例进行构图与渲染,避免了后期画面二次裁剪带来的构图损失。
Kling 2.6 Pro Text to Video 是如何计费的?
费用按成片时长与音频配置核算:5 秒无声为 65 积分($0.325),10 秒无声为 130 积分($0.650);5 秒有声为 120 积分($0.600),10 秒有声为 240 积分($1.200)。若任务执行异常中断,扣除的积分将全额自动返还。
Kling 2.6 Pro Text to Video 如何处理大幅度动作连贯性?
依托深度时空注意力建模机制,模型能够建立跨帧的运动连贯性,在表现人物奔跑、转身或镜头剧烈运动时,保持主体结构与环境空间的物理合理性。
撰写 Kling 2.6 Pro Text to Video 提示词有哪些关键技巧?
建议按照“核心主体、具体动作、环境背景、摄影机运镜与光线氛围”的顺序分层撰写,明确镜头运动速度与动作起始方向,为生成过程提供清晰的视觉锚点。