Claude Opus 5.5 已在 SeedRouter 上线
LogoSeedRouter

按名称搜索模型,例如 nano banana

按名称搜索模型,例如 nano banana

Kling 3.0 API 使用教程:API Key、请求、轮询、首尾帧与多镜头

一步步调用 Kling 3.0 API:创建 API Key、发送视频任务、轮询拿到视频 URL、从首帧和尾帧开始生成,以及制作多镜头视频。

以 Markdown 阅读

使用 Kling 3.0(可灵 3.0)API 的步骤是:创建一个 API Key,POST 一个带模型 ID kling-3-0 和提示词的 JSON 请求体,然后轮询返回的任务,直到视频 URL 就绪。文生视频、首尾帧生视频、多镜头视频和主体参考都走同一个端点,由请求体里的字段决定用哪一种。

本教程用可运行的代码逐步讲解每一步,然后介绍首尾帧、多镜头视频、主体,以及哪些请求会在扣费之前就被拒绝。

发第一个请求之前需要准备什么?

  1. 一个 API Key。 在 API Keys 页面创建,并保存在你的服务器上。绝不要把它写进浏览器端代码。
  2. 额度。 在账单页面充值。额度永不过期,失败的任务不收费。
  3. 模型 ID kling-3-0。
export SEEDROUTER_API_KEY="your-key"

怎么发送 Kling 3.0 请求?

把任务 POST 到 /v1/videos/generations:

curl https://api.seedrouter.ai/v1/videos/generations \
  -H "Authorization: Bearer $SEEDROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "kling-3-0",
    "prompt": "A red paper boat drifting on a calm pond at sunrise, soft mist on the water, slow push-in, no text, no logos.",
    "mode": "std",
    "duration": 5,
    "aspect_ratio": "16:9"
  }'

响应是一个任务,而不是视频:

{"id": "task_...", "model": "kling-3-0", "status": "processing", "created_at": 1789689600}

除了 model 和 prompt,其他字段都有默认值:

字段默认值取值
modeprostd(720p)、pro(1080p)、4K
duration53–15 秒
aspect_ratio16:916:9、9:16、1:1
soundfalsetrue 生成原生音频

请求结构是严格校验的:未知字段会在任务创建之前以 HTTP 400 拒绝,所以拼错一个字段,绝不会变成一段设置被悄悄忽略、却照样收费的视频。

怎么拿到视频?

每 10–20 秒轮询一次 GET /v1/tasks/{id},直到 status 变为 completed 或 failed。在我们的测试中,一段 3 秒的 std 视频大约两分钟完成,一段带声音的 5 秒 pro 视频大约两分半完成。

import os
import time
import requests

API = "https://api.seedrouter.ai/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['SEEDROUTER_API_KEY']}"}

task = requests.post(
    f"{API}/videos/generations",
    headers=HEADERS,
    json={
        "model": "kling-3-0",
        "prompt": "A red paper boat drifting on a calm pond at sunrise, slow push-in, no text, no logos.",
        "mode": "std",
        "duration": 5,
    },
    timeout=60,
)
task.raise_for_status()
task_id = task.json()["id"]

while True:
    result = requests.get(f"{API}/tasks/{task_id}", headers=HEADERS, timeout=60).json()
    if result["status"] in ("completed", "failed"):
        break
    time.sleep(15)

if result["status"] == "completed":
    print(result["output"]["video_url"])
else:
    print(result["error"])

完成的任务长这样:

{
  "id": "task_...",
  "model": "kling-3-0",
  "status": "completed",
  "output": {"video_url": "https://static.seedrouter.ai/media/tasks/task_example/0.mp4"}
}

std 返回的分辨率是 1280 × 720,pro 是 1920 × 1080,都是 MP4(H.264);开启 sound 时文件带一条立体声音轨。请把文件下载到你自己的存储:托管链接不会永久有效。轮询时出现网络超时并不代表生成失败,所以请保留任务 ID 再查一次,而不是重新提交一个任务。

怎么从首帧和尾帧开始生成?

在 image_urls 中传入一个或两个图片 URL。第一张图片是视频的开头,第二张是视频的结尾。不传图片时,视频只根据提示词生成。

{
  "model": "kling-3-0",
  "prompt": "The camera glides from the empty street to the lit shop window",
  "image_urls": ["https://example.com/start.png", "https://example.com/end.png"],
  "mode": "pro",
  "duration": 6
}

图片必须是公开的 HTTP(S) URL,格式为 JPG 或 PNG。Base64 数据会被拒绝;请先把文件上传到你自己的存储。

怎么制作多镜头视频?

把 multi_shots 设为 true,并在 multi_prompt 中描述每个镜头,最多五个镜头,每个 1–12 秒。各镜头时长相加必须在 3–15 秒之间,这个总和就是你被计费的视频时长;此时不使用 duration。

{
  "model": "kling-3-0",
  "mode": "pro",
  "sound": true,
  "multi_shots": true,
  "multi_prompt": [
    {"prompt": "Wide shot of a small open kitchen, a chef tosses vegetables in a wok, flames rising, warm light.", "duration": 3},
    {"prompt": "Close-up of the wok, vegetables flipping through the flames, oil sizzling, steam drifting.", "duration": 3}
  ]
}

这是该请求在我们测试中生成的视频,一段 6 秒的视频从全景切到特写:

Kling 3.0,pro(1080p),多镜头 3 + 3 秒,带声音。

怎么让一个人或一件产品保持一致?

把它加进 kling_elements:一个 name、一句简短的 description 和 2–4 个该主体的图片 URL,每个请求最多三个主体。在提示词中按名字提到这个主体。

{
  "model": "kling-3-0",
  "prompt": "@hero slowly turns toward the camera in soft window light",
  "kling_elements": [
    {
      "name": "hero",
      "description": "a young woman with short black hair and a yellow raincoat",
      "element_input_urls": ["https://example.com/hero-front.png", "https://example.com/hero-side.png"]
    }
  ]
}

哪些请求会在扣费之前被拒绝?

以下请求在提交时就会返回 HTTP 400,不会创建任务,也不会扣费:

请求原因
多镜头视频的镜头时长相加少于 3 秒或多于 15 秒Kling 3.0 生成的视频为 3–15 秒
主体没有 description每个主体都必须有描述
image_urls 超过 2 个、镜头超过 5 个或主体超过 3 个超出模型限制
小写的 mode: "4k"取值是 4K
Base64 图片,或上表之外的任何字段媒体以 URL 传入;请求结构严格校验

被受理之后才失败的任务(例如触发了模型的内容政策)会返回 status: "failed" 和一个 error 错误码,并且不收费。错误码列在错误目录中。

这和 Kling 自己的 API 有什么不同?

Kling 的开发者 API 使用自己的字段名,而且旧版和新版之间也不一样。[1][2] 如果你要迁移现有集成,请按下表对应字段:

SeedRouterKling 旧版 API
model: "kling-3-0"model_name: "kling-v3"
sound: true / falsesound: "on" / "off"
duration: 5(整数)duration: "5"(字符串)
mode: "4K"mode: "4k"
image_urls: [first, last]image 和 image_tail
multi_shots + multi_prompt: [{prompt, duration}]multi_shot + shot_type: "customize" + multi_prompt: [{index, prompt, duration}]
kling_elements: [{name, description, element_input_urls}]element_list: [{element_id}],需提前创建

SeedRouter 以任务形式交付结果,由你轮询获取;不提供 callback_url。

能让编程 Agent 帮你跑吗?

可以。Kling 3.0 页面 提供一段现成的提示词,适用于 Claude Code、Codex 或 Cursor:它会从环境变量读取 API Key,把请求和费用展示给你,等你确认后再提交、轮询并下载视频。同一个页面还有一个 Playground,发送的请求体和你的代码完全一样。

Kling 3.0 API 常见问题

Kling 3.0 有官方 API 吗?

有。Kling 提供开发者 API,有自己的 API Key、按单位计费的方式和请求格式。[1][3] SeedRouter 是调用 Kling 3.0 的另一种方式:一把 API Key、一份余额,和其他模型共用。

Kling 3.0 API 多少钱?

按视频秒数计费,费率由模式以及是否开启声音决定。Kling 3.0 API 价格指南 逐项算了各种视频的成本,模型页面 显示当前费率。

任务可以取消吗?

不可以。任务一旦被受理,就会一直运行到完成或失败。失败的任务不收费。

参考资料

  1. Kling AI. Kling 3.0: Text to Video(API 参考,旧版)。2026 年 10 月 6 日检索自 kling.ai。
  2. Kling AI. Kling 3.0: Image to Video(API 参考,旧版)。2026 年 10 月 6 日检索自 kling.ai。
  3. Kling AI. Pricing: Video(开发者 API)。2026 年 10 月 6 日检索自 kling.ai。

相关指南