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 金鑰呼叫多個變體,組合成多步驟的處理流程。
使用您呼叫其他 1,000+ 個 WaveSpeedAI 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
提交 prediction
將您的輸入以 JSON 格式 POST 到 https://api.wavespeed.ai/api/v3/kwaivgi/kling-v4.0/text-to-video。端點會立即回傳 prediction id — 生成是非同步進行的,因此推論期間您不需要保持連線。
- 03
輪詢完成狀態
GET https://api.wavespeed.ai/api/v3/predictions/{request_id}/result。狀態為 completed 時回傳輸出;狀態為 failed、cancelled、timeout 或 deleted 時停止並回報錯誤;其他狀態則持續輪詢。
- 04
讀取輸出網址
當狀態為 "completed" 時,從 data.outputs[0] 讀取網址。該網址指向 WaveSpeedAI CDN 上您生成的媒體 — 依您呼叫的 Kling 4.0 變體,可能是圖片、影片、音訊或 3D 檔案。
應用情境
您可以用 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 提交 prediction。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 vs Kling 3.0
Kling 3.0 提供 Standard、Pro 與 4K 等級,以及獨立的動作控制端點。Kling 4.0 則是一組五個端點,支援 3-30 秒片段,並新增可混合圖片、影片與音訊參考的參考轉影片,以及影片編輯與影片延伸。
Kling 4.0 vs Seedance 2.5
Seedance 2.5 同樣可達 30 秒單鏡頭,也提供影片編輯與影片延伸端點。Kling 4.0 涵蓋相同範圍,最多可使用 10 張圖片、5 段影片與 3 段音訊作為參考。
Kling 4.0 vs 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。端點會回傳 prediction 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 背後的團隊,以及 Kuaishou 在 WaveSpeedAI 上的完整模型陣容。
快手是中國大型短影音平台,也是 Kling 影片生成模型系列背後的團隊。Kling 3.0 提供 Standard、Pro 與 4K 等級,並具備原生音訊合成(每個版本皆有 sound 參數),另有專用的動作控制端點,可將參考影片中的動作轉移,讓靜態角色圖片動起來。
在 WaveSpeedAI 上開始使用 Kling 4.0 打造應用
註冊即贈免費入門點數。一組 API 金鑰,涵蓋來自 Kuaishou 與所有其他供應商的 1,000+ 個 AI 模型。