Warm steam curls gently upward from the enamel cup of tea as the station attendant hands it to the elderly grandfather; raindrops streak steadily down the dark waiting-room window while warm train headlights glide across the misty platform outside. Subtle slow push-in, preserving faces, clothing, and warm tungsten light. Audio: soft autumn rain and distant train rumble.
Kling 4.0 Flash Image to Video API
kwaivgi/kling-v4.0-flash/image-to-videoKling 4.0 Flash Image to Video API 将单张起始帧转化为 3–20 秒 720p 视频,支持可选动作提示词。它在保留原图构图与光影的同时自然注入流畅运镜。
拖拽文件、粘贴剪贴板素材,或输入 URL。 必填,仅 1 张起始帧图片(JPEG、PNG 或 WebP,最大 30 MB)。
1/1 个素材
示例
REST API
快速开始
按三步发起一次 Kling 4.0 Flash Image to Video 请求,获取 task_id 并读取生成的 720p 视频。
连接 Vidgo API
在控制台创建 API Key 并仅保存在服务端,通过 Authorization: Bearer VIDGO_API_KEY 发送。
- 端点
- POST
https://api.vidgo.ai/api/generate/submit - 认证
- Authorization: Bearer VIDGO_API_KEY
提交视频任务
向统一提交接口发送模型 ID 和对应模式参数。
curl --request POST \
--url "https://api.vidgo.ai/api/generate/submit" \
--header "Authorization: Bearer $VIDGO_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"model": "kwaivgi/kling-v4.0-flash/image-to-video",
"input": {
"prompt": "Warm steam curls gently upward from the enamel cup of tea as the station attendant hands it to the elderly grandfather; raindrops streak steadily down the dark waiting-room window while warm train headlights glide across the misty platform outside. Subtle slow push-in, preserving faces, clothing, and warm tungsten light. Audio: soft autumn rain and distant train rumble.",
"image_urls": [
"https://cdn.vidgo.ai/apis/models/bytedance/seedream-v5.0-flash/text-to-image/v1/01/output.png"
],
"duration": 5,
"resolution": "720p"
}
}'获取视频结果
使用返回的 task_id 轮询状态接口直至 finished 或 failed。
查询状态
GET https://api.vidgo.ai/api/generate/status/{task_id}在 not_started 或 running 状态继续轮询,finished 后读取 data.files[].file_url。
not_startedrunningfinishedfailed{
"code": 200,
"data": {
"task_id": "537F9S6N1LJBX0VK",
"status": "not_started",
"created_time": "2026-11-25T11:17:21"
}
}{
"code": 200,
"data": {
"task_id": "537F9S6N1LJBX0VK",
"status": "finished",
"files": [
{
"file_type": "video",
"file_url": "https://cdn.vidgo.ai/apis/models/kwaivgi/kling-v4.0-flash/image-to-video/v1/01/output.mp4"
}
],
"created_time": "2026-11-25T11:17:21",
"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-v4.0-flash/image-to-video",
"input": {
"prompt": "Warm steam curls gently upward from the enamel cup of tea as the station attendant hands it to the elderly grandfather; raindrops streak steadily down the dark waiting-room window while warm train headlights glide across the misty platform outside. Subtle slow push-in, preserving faces, clothing, and warm tungsten light. Audio: soft autumn rain and distant train rumble.",
"image_urls": [
"https://cdn.vidgo.ai/apis/models/bytedance/seedream-v5.0-flash/text-to-image/v1/01/output.png"
],
"duration": 5,
"resolution": "720p"
}
}
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')
if [ -z "$TASK_ID" ]; then
printf 'Submit response did not include task_id:
%s
' "$SUBMIT_RESPONSE" >&2
exit 1
fi
while true; do
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')
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 2
;;
*)
printf 'Unexpected task status: %s
' "$STATUS" >&2
exit 1
;;
esac
done请求参数
顶层传递 model 和可选 callback_url,生成参数放在 input 对象中。
| 字段 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
| model | string | 是 | — | 固定为 kwaivgi/kling-v4.0-flash/image-to-video。 |
| callback_url | string (URL) | 否 | — | 任务进入终态后接收结果的公开 HTTP(S) 回调地址。 |
| input.image_urls | string[] | 是 | — | 仅包含 1 张起始帧图片公开 HTTP(S) URL 的数组。 |
| input.prompt | string | 否 | — | 动作、运镜与音效描述(填写时为 1–26,000 字符)。 |
| input.duration | integer | 否 | 5 | 输出时长,3–20 的整数秒。 |
| input.resolution | string | 否 | 720p | 固定 720p。 |
响应字段
提交接口立即返回 task_id;状态接口在任务完成后返回视频文件列表或错误信息。
| 字段 | 类型 | 说明 |
|---|---|---|
| code | integer | 业务状态码,0 或 200 表示成功。 |
| data.task_id | string | 用于轮询状态接口的唯一任务 ID。 |
| data.status | string | not_started | running | finished | failed |
| data.progress | number | 0–100 进度值。 |
| data.files[].file_url | string | 生成视频的公开下载地址。 |
| data.files[].file_type | string | 视频结果为 video。 |
| data.error_message | string | null | 任务失败时的错误说明。 |
任务生命周期
仅在 not_started 和 running 时继续轮询;finished 和 failed 为终态。
not_started任务已接收并排队等待执行。
running视频正在生成,可继续轮询。
finished任务完成,从 data.files[].file_url 读取视频地址。
failed任务失败,读取 data.error_message 并停止轮询。
轮询与错误处理
- 认证401 表示 Bearer API Key 缺失或无效。
- 参数校验400 表示字段、时长(3–20 秒)或输入视频总时长(≤20 秒)超出限制。
- 轮询间隔建议每 5–10 秒轮询一次,或配置 callback_url 接收推送。
模型规格
| 规格 | 取值 | 说明 |
|---|---|---|
| 模型 | kwaivgi/kling-v4.0-flash/image-to-video | 异步视频生成公开模型 ID。 |
| 分辨率 | 720p | 固定 720p 输出。 |
| 时长 | 3–20 s | 生成模式默认 5 秒;所有输入视频总时长不超过 20 秒。 |
| 计费 | 18.8 / 12.6 积分/秒 | 无视频输入 18.8 积分/秒($0.094/s);含视频输入 12.6 积分/秒($0.063/s),按输出 + max(输出, 向上取整总输入秒数) 计费。 |
Kling 4.0 Flash Image to Video API 常见问题
Kling 4.0 Flash Image to Video API 是什么?
Kling 4.0 Flash Image to Video 是快手可灵推出的轻量级 720p 图生视频模型。Kling 4.0 Flash Image to Video API 接收 1 张起始帧与可选提示词,按 18.8 积分/秒生成 3–20 秒动态视频。它在保留原图主体外观、构图和光影的前提下生成连贯的镜头运动与自然动态。你可以通过 API 进行程序化调用,也可以在上方体验区直接在线试用。
Kling 4.0 Flash Image to Video API 必须填提示词吗?
可以。Image to Video 是 Kling 4.0 Flash 中唯一允许省略 prompt 的模式,留空时模型会自动生成贴合画面的自然动态。
Kling 4.0 Flash Image to Video 最多传几张图片?
image_urls 固定接受 1 张起始帧。如需同时指定尾帧,请使用 Kling 4.0 Image to Video。
Kling 4.0 Flash Image to Video 的画面比例如何决定?
输出比例自动跟随所上传起始帧的构图,无需额外传入 aspect_ratio。
Kling 4.0 Flash Image to Video 支持生成多长视频?
支持 3–20 秒之间的任意整数秒,默认 5 秒。
Kling 4.0 Flash Image to Video API 收费多少?
每秒 18.8 积分($0.094),5 秒视频为 94 积分($0.47)。
Kling 4.0 Flash Image to Video 支持哪些图片格式?
支持公开可访问的 JPEG、PNG 或 WebP 图片,单张最大 30 MB。



