關於 Kling 4.0
Kling 4.0 是快手新一代影片模型,可生成 3–30 秒、720p 或 1080p 的影片。可以從文字開始,用起始影格搭配可選的中間影格和結尾影格控制畫面,也可以結合圖片、影片與音訊參考素材。PopNow 還提供影片編輯,以及從原片最後一格接著生成的續寫功能。
在 POST /jobs/createTask 把模型名稱填成 kling/4.0/video-edit 就能呼叫,US$0.564 起。
請求參數
| 參數 | 必填 | 說明 |
|---|---|---|
aspect_ratio | 否 | 畫面形狀:橫式、方形或直式。 auto · 16:9 · 9:16 · 1:1 · 21:9 · 預設值: auto |
duration_seconds | 否 | 影片長度,按秒計費。 -1–30 · 預設值: -1 |
keep_original_audio | 否 | Keep the source clip's own sound. Turn it off to generate new synchronized audio instead. 預設值: true |
prompt | 是 | Describe the edit: change a subject, the setting, the weather or the style. Refer to the video as @Video1 and to reference images as @Image1, @Image2, numbered in upload order. |
reference_image_urls | 否 | 希望結果保留的人物、服裝或場景的參考圖。 |
resolution | 否 | 輸出尺寸。越大越清晰,價格也越高。 720p · 1080p · 預設值: 720p |
video_url | 是 | 要處理的影片。 |
價格
價格以美元計。API 使用獨立的美元餘額。網站點數不能用於 API,也不能轉入 API 餘額;API 餘額同樣不能轉為網站點數。 任務受理時,從 API 餘額中保留報價的最高金額;完成後按實際用量結算,實際扣款不超過保留金額,並釋放剩餘金額。任務失敗則釋放保留金額。
| 選項 | USD /秒 |
|---|---|
| resolution 720p | US$0.1128 |
| resolution 1080p | US$0.1692 |
執行前,將相同請求內容傳送至 POST /jobs/quote,即可查看預估費用與最高費用,單位為美元。報價不會執行任務或扣款。
API 快速上手
三步驟呼叫 Kling 4.0 API
- 建立 API 金鑰. 登入 PopNow,在 API 主控台建立金鑰。金鑰以 sk-popnow- 開頭,API 呼叫使用獨立的美元餘額。
- 送出請求. 對 POST /jobs/createTask 送出請求,model 填 kling/4.0/video-edit,input 依照參數表填寫。回應會立即傳回任務 ID。
- 取得結果. 用任務 ID 輪詢 GET /jobs/recordInfo,或帶上 callBackUrl,結果會推送到該網址。任務成功後下載輸出連結。
# 1. Create the task. Keep the Idempotency-Key if you retry after a network error.
export IDEMPOTENCY_KEY="$(uuidgen)"
curl -X POST https://api.popnow.ai/api/v1/jobs/createTask \
-H "Authorization: Bearer $POPNOW_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $IDEMPOTENCY_KEY" \
-d '{
"model": "kling/4.0/video-edit",
"input": {
"prompt": "A slow aerial shot drifting over a misty pine forest at sunrise",
"video_url": "https://media.popnow.ai/effects/flower-bloom-1abd6efb.mp4",
"aspect_ratio": "auto",
"resolution": "720p",
"duration_seconds": -1
}
}'
# 2. Copy data.taskId from the response, then poll until state is succeeded, failed, canceled or expired.
TASK_ID="TASK_ID_FROM_RESPONSE"
curl "https://api.popnow.ai/api/v1/jobs/recordInfo?taskId=$TASK_ID" \
-H "Authorization: Bearer $POPNOW_API_KEY"請把提示詞和連結換成你自己的。API 頁籤裡有回應、輪詢和回呼的參考。
Kling 4.0 API 常見問題
Kling 4.0 API 怎麼收費?
Kling 4.0:最便宜的任務是編輯影片,US$0.564/ 5 秒影片起。各選項價格:720p US$0.1128/秒、1080p US$0.1692/秒。API 使用獨立的美元餘額。網站點數不能用於 API,也不能轉入 API 餘額;API 餘額同樣不能轉為網站點數。 任務受理時,從 API 餘額中保留報價的最高金額;完成後按實際用量結算,實際扣款不超過保留金額,並釋放剩餘金額。任務失敗則釋放保留金額。
Kling 4.0 · 編輯影片 API 有哪些限制?
影片長度:3–30 s;解析度:720p · 1080p;畫面比例:auto · 16:9 · 9:16 · 1:1 · 21:9;參考圖:10;單一上傳上限:10 MB。超出這些限制的請求會在扣款之前被拒絕。