Kling 4.0 API
快手 Kling 4.0——文生视频、图生视频、参考生视频、视频编辑和视频延长,支持 3-30 秒片段、720p 和 1080p 输出,并随画面同步生成立体声音频。
五个端点:kwaivgi/kling-v4.0/text-to-video 将提示词变成片段,image-to-video 以首帧为起点生成动画,可选尾帧和关键帧,reference-to-video 最多利用 10 张图像、5 段视频和 3 段音频生成新片段,video-edit 根据文字指令重写已有视频,video-extend 则从视频的最后一帧继续延长。片段时长为 3 到 30 秒,分辨率为 720p 或 1080p。
概览
关于 Kling 4.0 API
Kling 4.0 能做什么、它在 Kuaishou 模型阵容中的定位,以及团队选择它的原因。
Kling 4.0 是 Kuaishou 推出的视频生成模型,可通过 WaveSpeedAI REST API 使用。快手 Kling 4.0——文生视频、图生视频、参考生视频、视频编辑和视频延长,支持 3-30 秒片段、720p 和 1080p 输出,并随画面同步生成立体声音频。
五个端点:kwaivgi/kling-v4.0/text-to-video 将提示词变成片段,image-to-video 以首帧为起点生成动画,可选尾帧和关键帧,reference-to-video 最多利用 10 张图像、5 段视频和 3 段音频生成新片段,video-edit 根据文字指令重写已有视频,video-extend 则从视频的最后一帧继续延长。片段时长为 3 到 30 秒,分辨率为 720p 或 1080p。
WaveSpeedAI 上的 Kling 4.0 系列提供 5 个 REST 端点,涵盖 Text-To-Video, Image-To-Video, Reference-To-Video, Video-To-Video, Video-Extend 个工作流。每个变体都有各自的定价、参数选项和示例输出——请选择与你的输入模态和生产约束相匹配的那一个,或使用同一个 API 密钥调用多个变体,组合成多步骤流水线。
使用与 WaveSpeedAI 上其他 1,000 多个 AI 模型相同的 API 密钥、账单账户和速率限制来运行 Kling 4.0。无需单独对接供应商,无需各家 SDK,也无需应对各家不同的速率限制——一次集成即可覆盖从文生图、文生视频到音频合成、3D 生成、放大和编辑的全部能力。
规格
Kling 4.0 API 的能力与发布状态
开发者在选择 API 之前会搜索的模型细节:可用性、预期输出时长、参考素材支持情况,以及当前可用的在线替代方案。
端点
5 个变体
文生视频、图生视频、参考生视频、视频编辑和视频延长。
时长
3-30 秒
3 到 30 秒的任意时长;默认 5 秒。
分辨率
720p / 1080p
默认 720p。
参考
10 张图像 + 5 段视频 + 3 段音频
用于参考生视频,配合文本提示词使用。
端点
全部 Kling 4.0 API 端点
WaveSpeedAI 现已提供 5 个 Kling 4.0 端点——请选择适合你工作流的变体。
/filters:quality(82)/media/images/d30a6613-c770-408a-82da-6561afe428f2.webp)
Kling v4.0 Text To Video
Kling V4.0 Text-to-Video generates cinematic clips of 3 to 30 seconds from a text prompt, with 720p and 1080p output, four aspect ratios including 21:9 ultrawide, and synchronized stereo audio. Ready-to-use REST inference API, best performance, no coldstarts, affordable pricing.
/filters:quality(82)/media/images/2f854b02-6af0-40c0-a820-c4c52bec314a.webp)
Kling v4.0 Image To Video
Kling V4.0 Image-to-Video animates a first frame into a clip of 3 to 30 seconds, with an optional last frame and up to 8 in-between keyframes to direct the story, 720p and 1080p output and synchronized stereo audio. Ready-to-use REST inference API, best performance, no coldstarts, affordable pricing.
/filters:quality(82)/media/images/61c6cd42-d051-4094-981f-6cfaa207f6ab.webp)
Kling v4.0 Reference To Video
Kling V4.0 Reference-to-Video builds a new clip of 3 to 30 seconds from up to 10 reference images, 5 reference videos and 3 reference audios, following the subjects, motion and camera you point to in the prompt, with 720p and 1080p output and synchronized stereo audio. Ready-to-use REST inference API, best performance, no coldstarts, affordable pricing.
/filters:quality(82)/media/images/cf027f12-e273-477c-b42c-1cc8ffb421a0.webp)
Kling v4.0 Video Edit
Kling V4.0 Video Edit rewrites a 3 to 30 second video from a text instruction: it keeps the scene, subject and motion and changes what you describe, with optional reference images, 720p and 1080p output and the original sound kept by default. Ready-to-use REST inference API, best performance, no coldstarts, affordable pricing.
/filters:quality(82)/media/images/cc4137a0-c214-4cc5-abd9-3468a8d15952.webp)
Kling v4.0 Video Extend
Kling V4.0 Video Extend continues a video from its last frame with a new 3 to 30 second segment guided by your prompt, at 720p or 1080p with synchronized stereo audio, and returns the original and the new segment joined. Ready-to-use REST inference API, best performance, no coldstarts, affordable pricing.
示例
看看 Kling 4.0 的实际效果
由 Kling 4.0 API 生成的真实输出。悬停在任意视频上即可预览,点击可打开全尺寸查看器。
使用方法
如何使用 Kling 4.0 API
从注册到完成一次生成,只需四步。完整的 Python、Node.js 和 cURL 示例见下方的 API 部分。
- 01
获取 API 密钥
注册 WaveSpeedAI 账号,并从控制台复制你的 API 密钥。新账号附带免费体验额度——足够在开始计费前把 Playground 运行几十次。
- 02
提交预测
把你的输入以 JSON 形式 POST 到 https://api.wavespeed.ai/api/v3/kwaivgi/kling-v4.0/text-to-video。端点会立即返回预测 ID——生成是异步的,因此推理期间你无需保持连接。
- 03
轮询完成状态
GET https://api.wavespeed.ai/api/v3/predictions/{request_id}/result。状态为 completed 时返回输出;状态为 failed、cancelled、timeout 或 deleted 时以错误终止;其他任何状态都继续轮询。
- 04
读取输出 URL
状态变为 "completed" 后,从 data.outputs[0] 读取 URL。该 URL 指向 WaveSpeedAI CDN 上你生成的媒体——具体是图片、视频、音频还是 3D 文件,取决于你调用的 Kling 4.0 变体。
应用场景
用 Kling 4.0 可以构建什么
开发者和创作者使用 Kling 4.0 API 的常见工作流。
超长单镜头
kwaivgi/kling-v4.0/text-to-video 一次生成 3 到 30 秒的任意时长,为真实的动作和镜头运动留出空间,无需再拼接短片段。
超宽银幕电影画幅
文生视频支持 16:9、9:16、1:1 或 21:9,同一条提示词既可用于宽屏预告片、竖版社交媒体帖子,也可用于超宽银幕电影镜头。
用关键帧导演故事
kwaivgi/kling-v4.0/image-to-video 以你的图像作为首帧,并可选填尾帧和中间关键帧,总计最多 10 张图像,由你决定片段从哪里开始、经过哪里、在哪里结束。
由混合参考构建的场景
kwaivgi/kling-v4.0/reference-to-video 可组合最多 10 张参考图像、5 段参考视频和 3 段参考音频,提示词中分别以 @Image1、@Video1 和 @Audio1 引用。
用文字编辑视频
kwaivgi/kling-v4.0/video-edit 保留视频的场景、主体和动作,只修改你描述的内容——更换角色、改变场景或天气——并默认保留原始声音。
延续一段片段
kwaivgi/kling-v4.0/video-extend 从视频的最后一帧开始,续接一段 3-30 秒的新片段,并返回原片段与新片段拼接后的结果,还可指定目标尾帧。
借用镜头运动或表演
在提示词中指向参考视频,即可复用其镜头运动或跟随其表演,而输出时长可独立于参考视频选择。
声音随画面一同生成
每个端点都会在生成视频的同时生成同步的立体声音频。在参考生视频中,你也可以改为保留参考视频自带的声音。
技巧
Kling 4.0 提示词技巧
让 Kling 4.0 输出更好结果的实用建议——总结自生产流水线中各类视频模型都适用的做法。
- 01
写明主体、动作、场景和镜头
告诉模型主体是什么、做什么动作、发生在哪里,以及镜头如何运动,例如缓慢推进或手持跟拍。对于较长的片段,请描述场景从开始到结束如何发展。
- 02
描述你想要的声音
音频与画面一同生成,因此请在提示词中写明你想听到的环境音、音乐或台词。
- 03
说明每个参考的用途
在 kwaivgi/kling-v4.0/reference-to-video 上,按提供顺序以 @Image1、@Video1 和 @Audio1 引用输入,并说明每个输入应如何呈现,例如 @Image1 中的角色走过 @Image2 中的街道。
- 04
编辑时描述变化
在 kwaivgi/kling-v4.0/video-edit 上,描述哪些内容应当改变、哪些必须保留,并以 @Video1 引用视频、以 @Image1、@Image2 ... 引用参考图像。除非你另行设置,输出会沿用输入视频的时长和画幅比例。
- 05
延长时描述接下来发生什么
在 kwaivgi/kling-v4.0/video-extend 上,描述的是后续内容,而不是你已有的画面,并使其与片段结尾保持一致。只会生成新的片段;你的原始视频保持不变。
- 06
关键帧按顺序使用
在 kwaivgi/kling-v4.0/image-to-video 上,中间关键帧按你列出的顺序使用,首帧、关键帧和尾帧合计最多 10 张图像。请描述连接各帧的变化。
- 07
720p 出草稿,1080p 交付
先以 720p 和较短时长探索创意,再用选定的提示词以 1080p 重新生成用于交付。
定价
Kling 4.0 API 定价
按输出计费。最终费用会随你在各变体 Playground 中设置的参数(分辨率、时长、输出数量、参考素材)而变化。
| 端点 | 类型 | 起步价 |
|---|---|---|
| kwaivgi/ | text-to-video | $0.785 |
| kwaivgi/ | image-to-video | $0.785 |
| kwaivgi/ | reference-to-video | $0.785 |
| kwaivgi/ | video-to-video | $0.47 |
| kwaivgi/ | video-extend | $0.785 |
API
调用 Kling 4.0 API
在 wavespeed.ai/accesskey 注册并获取 API 密钥,然后通过 REST 提交预测。Playground 可以为任意输入组合生成可直接粘贴的示例代码。
POSThttps://api.wavespeed.ai/api/v3/kwaivgi/kling-v4.0/text-to-video
# 1. Submit the prediction.
SUBMIT_RESPONSE=$(curl --silent --show-error --fail-with-body \
-X POST "https://api.wavespeed.ai/api/v3/kwaivgi/kling-v4.0/text-to-video" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $WAVESPEED_API_KEY" \
-d '{
"prompt": "A cinematic shot of a city at sunset, soft golden light",
"resolution": "720p",
"duration": 5,
"aspect_ratio": "16:9"
}')
TASK=$(printf '%s' "$SUBMIT_RESPONSE" | jq 'if has("data") then .data else . end')
PREDICTION_ID=$(printf '%s' "$TASK" | jq -r '.id')
if [ -z "$PREDICTION_ID" ] || [ "$PREDICTION_ID" = "null" ]; then
printf 'Submission response did not contain a prediction id
' >&2
exit 1
fi
RESULT_URL="https://api.wavespeed.ai/api/v3/predictions/$PREDICTION_ID/result"
# 2. Poll until the prediction finishes.
while true; do
RESPONSE=$(curl --silent --show-error --fail-with-body "$RESULT_URL" \
-H "Authorization: Bearer $WAVESPEED_API_KEY")
RESULT=$(printf '%s' "$RESPONSE" | jq 'if has("data") then .data else . end')
STATUS=$(printf '%s' "$RESULT" | jq -r '.status')
case "$STATUS" in
completed) printf '%s\n' "$RESULT" | jq '.outputs'; break ;;
failed|cancelled|timeout|deleted) printf '%s\n' "$RESULT" | jq . >&2; exit 1 ;;
*) sleep 2 ;;
esac
doneconst submitUrl = "https://api.wavespeed.ai/api/v3/kwaivgi/kling-v4.0/text-to-video";
const apiKey = process.env.WAVESPEED_API_KEY;
if (!apiKey) throw new Error('Set WAVESPEED_API_KEY');
async function requestJson(url, options = {}) {
const response = await fetch(url, options);
if (!response.ok) throw new Error(await response.text());
return response.json();
}
// 1. Submit the prediction.
const body = await requestJson(submitUrl, {
method: "POST",
headers: {
"Authorization": `Bearer ${apiKey}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"prompt": "A cinematic shot of a city at sunset, soft golden light",
"resolution": "720p",
"duration": 5,
"aspect_ratio": "16:9"
}),
});
const task = body.data ?? body;
const resultUrl = `https://api.wavespeed.ai/api/v3/predictions/${task.id}/result`;
// 2. Poll until the prediction finishes.
while (true) {
const resultBody = await requestJson(resultUrl, {
headers: { "Authorization": `Bearer ${apiKey}` },
});
const result = resultBody.data ?? resultBody;
if (result.status === "completed") {
console.log(result.outputs);
break;
}
if (["failed", "cancelled", "timeout", "deleted"].includes(result.status)) throw new Error(JSON.stringify(result));
await new Promise(resolve => setTimeout(resolve, 2000));
}import json
import os
import time
from urllib.request import Request, urlopen
api_key = os.environ["WAVESPEED_API_KEY"]
headers = {"Authorization": f"Bearer {api_key}", "Content-Type": "application/json"}
payload = {
"prompt": "A cinematic shot of a city at sunset, soft golden light",
"resolution": "720p",
"duration": 5,
"aspect_ratio": "16:9"
}
def request_json(url, data=None):
request = Request(url, data=data, headers=headers, method="POST" if data else "GET")
with urlopen(request) as response:
return json.load(response)
# 1. Submit the prediction.
body = request_json("https://api.wavespeed.ai/api/v3/kwaivgi/kling-v4.0/text-to-video", json.dumps(payload).encode())
task = body.get("data", body)
result_url = f"https://api.wavespeed.ai/api/v3/predictions/{task['id']}/result"
# 2. Poll until the prediction finishes.
while True:
result_body = request_json(result_url)
result = result_body.get("data", result_body)
status = result.get("status")
if status == "completed":
print(result.get("outputs", []))
break
if status in {"failed", "cancelled", "timeout", "deleted"}:
raise RuntimeError(result)
time.sleep(2)对比
Kling 4.0 与其他方案对比
在 WaveSpeedAI 上,何时应选择 Kling 4.0 而不是同类模型。
Kling 4.0 对比 Kling 3.0
Kling 3.0 提供 Standard、Pro 和 4K 档位,以及独立的运动控制端点。Kling 4.0 则是一套五个端点,支持 3-30 秒片段,并新增支持图像、视频和音频混合参考的参考生视频,以及视频编辑和视频延长。
Kling 4.0 对比 Seedance 2.5
Seedance 2.5 同样可达 30 秒单镜头,也提供视频编辑和视频延长端点。Kling 4.0 覆盖相同范围,最多可使用 10 张图像、5 段视频和 3 段音频作为参考。
Kling 4.0 对比 Wan 3.0
Wan 3.0 提供最长 30 秒、最高 1080p 的文生视频、图生视频和参考生视频。Kling 4.0 覆盖相同范围,当你需要 21:9 超宽银幕输出、首帧、尾帧和中间关键帧控制,或图像、视频、音频混合参考时,它是更合适的选择。
常见问题
Kling 4.0 API — 常见问题
定价、许可、集成——关于在 WaveSpeedAI 上运行 Kling 4.0 的常见问题。
Kling 4.0 API 是什么?
Kling 4.0 是 Kuaishou 的视频生成模型,在 WaveSpeedAI 上以 REST API 形式提供。快手 Kling 4.0——文生视频、图生视频、参考生视频、视频编辑和视频延长,支持 3-30 秒片段、720p 和 1080p 输出,并随画面同步生成立体声音频。你可以通过编程方式调用它,也可以在上方链接的 Playground 中试用。
如何调用 Kling 4.0 API?
注册 WaveSpeedAI 账号,从 /accesskey 复制你的 API 密钥,然后把输入以 JSON 形式 POST 到 https://api.wavespeed.ai/api/v3/kwaivgi/kling-v4.0/text-to-video。端点会返回预测 ID。从大约每 2 秒一次开始轮询结果端点,长耗时任务可适当拉长间隔,并在任何终止状态时停止。上方有面向生产环境的 Python / Node.js / cURL 示例。
Kling 4.0 API 的费用是多少?
Kling 4.0 每次调用 $0.47 起。实际费用会随你设置的参数(分辨率、时长、输出数量、参考素材)而变化。Playground 中“生成”按钮旁的实时费用预览会显示你当前输入对应的准确价格。
有哪些 Kling 4.0 变体可用?
WaveSpeedAI 托管了 5 个已上线的 Kling 4.0 端点:kwaivgi/kling-v4.0/text-to-video, kwaivgi/kling-v4.0/image-to-video, kwaivgi/kling-v4.0/reference-to-video, kwaivgi/kling-v4.0/video-edit, kwaivgi/kling-v4.0/video-extend。每个变体都有自己的 Playground 页面和定价。
Kling 4.0 的输出可以商用吗?
商用权利遵循 Kuaishou 的模型许可。大多数 Kuaishou 模型允许商用输出;具体许可摘要请查看各模型的 Playground 页面,平台层面的条件请参阅 WaveSpeedAI 的服务条款。
为什么要在 WaveSpeedAI 上使用 Kling 4.0,而不是直接对接?
一个 API 密钥、一个账单账户,即可使用 Kling 4.0 以及来自其他提供方的 1,000 多个 AI 模型。无需逐家配置 SDK,无需应对各自独立的速率限制,也无需为每家重写集成代码。价格通常与 Kuaishou 直接提供的 API 持平或更低。
提供方
关于 Kuaishou
Kling 4.0 及 WaveSpeedAI 上 Kuaishou 更多模型背后的团队。
快手是中国领先的短视频平台,也是 Kling 系列视频生成模型背后的团队。Kling 3.0 提供 Standard、Pro 和 4K 档位,具备原生音频合成(每个变体都有 sound 参数),另有专用的运动控制端点,可从参考视频迁移动作,让静态角色图像动起来。
在 WaveSpeedAI 上用 Kling 4.0 开始构建
注册即送免费体验额度。一个 API 密钥,即可使用来自 Kuaishou 及其他所有提供方的 1,000 多个 AI 模型。