取得 API 金鑰

Kuaishou 出品

支援關鍵影格,1080p 最長 30 秒;繁忙時可能需要排隊

kling/4.0/image-to-video1,080 點數起/ 5 秒影片 · US$1.08
  • 最高 1080p
  • 3–30 秒
  • 首尾畫格
  • 最多 10 張參考圖
  • 4 種畫面比例
  • 生成影片
  • 圖生影片
  • 參考生影片

關於 Kling 4.0

支援關鍵影格,1080p 最長 30 秒;繁忙時可能需要排隊。

在 POST /jobs/createTask 把模型名稱填成 kling/4.0/image-to-video 就能呼叫,1,080 點數/ 5 秒影片起(US$1.08)。

這份指南目前只有英文版。 →

請求參數

參數必填說明
aspect_ratio否畫面形狀:橫式、方形或直式。 auto · 16:9 · 9:16 · 1:1 · 21:9 · 預設值: auto
duration_seconds否影片長度,按秒計費。 ≥ 3 · ≤ 30 · 預設值: 5
image_url是作為起點的那張圖。
keyframe_image_urls否Optional in-between frames, in the order they should appear, up to 8. The clip passes through each one between the opening and the closing frame.
last_image_url否可選的結尾畫面,讓影片剛好停在你要的地方。
prompt否Optional: describe what happens after the opening frame - the action, the camera and the sound.
resolution否輸出尺寸。越大越清晰,價格也越高。 720p · 1080p · 預設值: 720p

價格

價格以點數計,和網站上用的是同一種點數(1 點 = $0.001)。任務受理時先凍結點數,完成後依實際費用結算;失敗的任務會退還。

選項點數 /秒≈ 美元
resolution 720p216US$0.22
resolution 1080p324US$0.32

想在執行前知道確切金額,把相同的請求內容送到 POST /jobs/quote 即可。

API 快速上手

三步驟呼叫 Kling 4.0 API

  1. 建立 API 金鑰. 登入 PopNow,在 API 主控台建立金鑰。金鑰以 sk-popnow- 開頭,和網站共用同一份點數。
  2. 送出請求. 對 POST /jobs/createTask 送出請求,model 填 kling/4.0/image-to-video,input 依照參數表填寫。回應會立即傳回任務 ID。
  3. 取得結果. 用任務 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/image-to-video",
  "input": {
    "prompt": "A slow aerial shot drifting over a misty pine forest at sunrise",
    "image_url": "https://media.popnow.ai/influencer/examples/marco.webp",
    "aspect_ratio": "auto",
    "resolution": "720p",
    "duration_seconds": 5
  }
}'

# 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:最便宜的任務是圖生影片,1,080 點數(US$1.08)/ 5 秒影片起。各選項價格:720p 216 點數/秒、1080p 324 點數/秒。點數和網站通用(1 點數 = $0.001),失敗的任務會退還。

Kling 4.0 · 圖生影片 API 有哪些限制?

影片長度:3–30 s;解析度:720p · 1080p;畫面比例:auto · 16:9 · 9:16 · 1:1 · 21:9;參考圖:8;單一上傳上限:10 MB。超出這些限制的請求會在扣款之前被拒絕。

更多 Kling 4.0 相關內容