Claude Opus 5.5 已在 SeedRouter 上線

Video

Kling 4.0

View Markdown

用提示詞、關鍵影格或圖片、影片和音訊參考生成 3–30 秒的 Kling 4.0 影片,或編輯和延伸影片,720p 或 1080p 解析度。

Kling 4.0 是快手在 2026 年 9 月公布的影片模型。一個模型 ID 涵蓋五種模式:文字轉影片、最多 10 張影格的圖像轉影片、從圖片、影片和音訊進行參考生成、影片編輯和影片延伸。每段影片都是 3–30 秒,720p 或 1080p,附帶立體聲。提交請求、保留返回的任務 ID,然後從任務中讀取完成的影片。媒體以 URL 形式傳入。

模型 ID

模型 ID模式解析度時長
kling-4-0text, image, reference, edit, extend720p, 1080p3–30 秒

查看模型頁面瞭解當前費率。

快速範例

curl https://api.seedrouter.ai/v1/videos/generations \
  -H "Authorization: Bearer $SEEDROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "kling-4-0",
    "prompt": "A woman with a red umbrella walks down a neon-lit street on a rainy night, signs shimmering in the puddles, the camera tracking low beside her. No text, no logos.",
    "resolution": "720p",
    "duration": 5,
    "aspect_ratio": "16:9"
  }'

端點

POST https://api.seedrouter.ai/v1/videos/generations
標頭值
AuthorizationBearer YOUR_API_KEY
Content-Typeapplication/json

回應是任務({"id": "task_...", "status": "processing"}),不是完成的影片。輪詢 GET /v1/tasks/{task_id} 取得結果。將 API 金鑰保存在伺服器端程式碼中。

參數

欄位類型預設值說明
modelstring必填kling-4-0
promptstring必填僅圖像轉影片時可選。將參考命名為 @Image1、@Video1、@Audio1,每個清單中從 1 開始編號。
durationinteger53–30 秒。編輯:省略,輸出跟隨輸入影片。延伸:新部分的長度。
resolutionenum720p720p 或 1080p。
aspect_ratioenum依模式16:9、9:16、1:1、21:9;參考模式僅 auto。預設值:文字 16:9、圖像第一張影格的形狀、參考 auto、編輯輸入影片的形狀。不接受延伸。
image_urlsURL 清單無圖像轉影片:最多 2 個,第一個和最後一個影格。參考(使用 omni_reference_task_type: "reference")和編輯:最多 10 個參考圖像。
image_with_roles物件清單無{"url", "role"} 包含角色 first_frame、last_frame、keyframe(或 middle_frame)或 reference_image。恰好 1 個首影格,最多 8 個關鍵影格按順序使用,總共 10 個影格。
first_frame_imageURL無圖像轉影片的第一個影格。
last_frame_imageURL無圖像轉影片的最後一個影格,或延伸的目標最後一個影格。
video_urlsURL 清單無參考影片:最多 5 個,總共使用 30 秒。對於編輯或延伸,恰好 1 個取代 video_url。
video_urlURL無要編輯或延伸的輸入影片;需要 omni_reference_task_type 為 edit 或 extend。
audio_urlsURL 清單無參考音訊:最多 3 個,每個 5–30 秒。
omni_reference_task_typeenumautoauto、reference、edit 或 extend。
audio_settingenum依模式origin 保留輸入影片的音訊,auto 重新生成。編輯預設保留;含影片的參考預設重新生成。不接受延伸。

每段影片都附帶立體聲;沒有聲音開關。沒有 mode、negative_prompt、watermark 或多鏡頭欄位。結構描述嚴格:未知欄位被拒絕而非忽略。callback_url 不可用;輪詢任務代替。

模式

模式跟隨你傳送的媒體和 omni_reference_task_type:

模式如何選擇
文字轉影片無媒體。
圖像轉影片首影格,可選最後一個影格和關鍵影格。
參考video_urls、audio_urls 或 reference_image 角色,或 omni_reference_task_type: "reference"。
編輯omni_reference_task_type: "edit" 和一個輸入影片。
延伸omni_reference_task_type: "extend" 和一個輸入影片。

影格和參考媒體無法在一個請求中混合。在參考影片或音訊旁邊,image_urls 僅在 omni_reference_task_type: "reference" 時才視為參考圖像;否則使用 reference_image 角色。沒有 edit 或 extend 的 video_url 被拒絕。

關鍵影格

{
  "model": "kling-4-0",
  "prompt": "A girl walks from the window to the door, then looks back and smiles",
  "image_with_roles": [
    {"url": "https://example.com/1.png", "role": "first_frame"},
    {"url": "https://example.com/2.png", "role": "keyframe"},
    {"url": "https://example.com/3.png", "role": "last_frame"}
  ],
  "duration": 10
}

參考

{
  "model": "kling-4-0",
  "prompt": "The woman from @Image1 walks along the beach with the camera movement of @Video1",
  "image_with_roles": [{"url": "https://example.com/woman.png", "role": "reference_image"}],
  "video_urls": ["https://example.com/camera.mp4"],
  "aspect_ratio": "auto",
  "duration": 5
}

編輯

{
  "model": "kling-4-0",
  "prompt": "Change the scene to a snowy winter evening",
  "omni_reference_task_type": "edit",
  "video_url": "https://example.com/in.mp4"
}

輸入影片必須至少 3 秒;僅使用其前 30 秒。不填 duration 時,輸出跟隨輸入影片。

延伸

{
  "model": "kling-4-0",
  "prompt": "The camera keeps moving forward as the sky grows darker",
  "omni_reference_task_type": "extend",
  "video_url": "https://example.com/in.mp4",
  "duration": 5
}

延伸從輸入影片的最後一個影格繼續,並返回原始加新部分。新增 last_frame_image 選擇其結束位置。

媒體輸入

圖片、影片和音訊是公開的 HTTP(S) URL。不接受 Base64 資料 URI:將檔案上傳到你自己的儲存空間並傳遞其 URL。圖片、影片和音訊合計最多 15 個參考檔案。

費用維度

檢查模型費率部分瞭解當前費率。Kling 4.0 按影片秒數計費,費率由解析度設定:

text, image, reference without videos:  cost = duration × standard rate
extend:                                 cost = new seconds × standard rate
edit, reference with videos:            cost = (output + max(output, input)) × video-input rate

輸入 是輸入影片的合計長度,四捨五入為整秒並上限 30。在接受請求時測量,因此保留金額是計費金額。無法讀取長度的影片在計費前被拒絕。範例:編輯 5.2 秒影片為 3 秒結果計費 3 + 6 = 9 秒。失敗的任務不計費。

輸出結構

提交返回任務:

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

取得任務

GET https://api.seedrouter.ai/v1/tasks/{task_id}

每 10–20 秒輪詢一次,直到 status 為 completed 或 failed。輪詢期間的網路逾時不表示生成失敗:保留任務 ID 並繼續檢查。不要建立另一個任務來檢查進度。

完成的任務

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

在我們的測試中,3 秒 720p 影片以 MP4 (H.264) 回傳,1280 × 720 分辨率,帶立體聲 AAC 軌道,提交後 2 分 41 秒至 4 分 22 秒。延伸的 5.2 秒影片回傳 8.1 秒長。

錯誤

在建立任務之前拒絕的請求返回 HTTP 錯誤與 error 物件,不計費。任務在接受後失敗時,查詢時返回 HTTP 200,帶 status: "failed" 和 error 物件。

查看共享錯誤目錄瞭解代碼、HTTP 狀態和重試指南。

{
  "id": "task_...",
  "model": "kling-4-0",
  "status": "failed",
  "error": {
    "code": 60001,
    "message": "The request was rejected by the content policy. Please revise the prompt or input images."
  }
}

如果提交本身逾時,在重新提交之前檢查你的任務:第一個請求可能已被接受。

秘訣

  • 描述主體、地點、運鏡、光線和聲音;影片的音訊跟隨提示詞。
  • 在 720p 時草稿,然後用相同的請求在 1080p 時渲染最終鏡頭。
  • 給較長影片加上關鍵影格,使場景按照你想要的地方移動。
  • 新增 no text, no logos 以排除臆造的標誌。

相關