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。

相關指南