关于 Kling 4.0
支持关键帧,1080p 最长 30 秒;繁忙时可能需要排队。
在 POST /jobs/createTask 里把模型名写成 kling/4.0/reference-to-video 即可调用,162 积分/ 5 秒视频起(US$1.62)。
请求参数
| 参数 | 必填 | 说明 |
|---|---|---|
aspect_ratio | 否 | 画面形状:横版、方形或竖版。 auto · 16:9 · 9:16 · 1:1 · 21:9 · 默认值: auto |
duration_seconds | 否 | 视频时长,按秒计费。 ≥ 3 · ≤ 30 · 默认值: 5 |
keep_original_audio | 否 | Keep the reference video's own sound instead of generating new audio. Only used with a reference video. 默认值: false |
prompt | 是 | Say what each reference is and what the shot should do with it. Refer to images as @Image1, @Image2, to videos as @Video1 and to audio clips as @Audio1, numbered in upload order. |
reference_audio_urls | 否 | 要匹配的声音:人声、音乐或节奏。 |
reference_image_urls | 否 | 希望结果保留的人物、服装或场景的参考图。 |
reference_video_urls | 否 | 希望结果跟随其动作、运镜或风格的参考视频。 |
resolution | 否 | 输出尺寸。越大越清晰,价格也越高。 720p · 1080p · 默认值: 720p |
价格
价格以积分计,和网站上用的是同一种积分(1 积分 = $0.01)。任务受理时先冻结积分,完成后按实际费用结算;失败的任务会退还。
| 选项 | 积分 /秒 | ≈ 美元 |
|---|---|---|
| resolution 720p | 32.4 | US$0.32 |
| resolution 1080p | 48.6 | US$0.49 |
想在运行前知道确切金额,把同样的请求体发到 POST /jobs/quote 即可。
API 快速上手
三步调用 Kling 4.0 API
- 创建 API 密钥. 登录 PopNow,在 API 控制台创建密钥。密钥以 sk-popnow- 开头,和网站共用同一份积分。
- 发送请求. 向 POST /jobs/createTask 发请求,model 填 kling/4.0/reference-to-video,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/reference-to-video",
"input": {
"prompt": "A slow aerial shot drifting over a misty pine forest at sunrise",
"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:最便宜的任务是参考生视频,162 积分(US$1.62)/ 5 秒视频起。各选项价格:720p 32.4 积分/秒、1080p 48.6 积分/秒。积分和网站通用(1 积分 = $0.01),失败的任务会退还。
Kling 4.0 · 参考生视频 API 有哪些限制?
视频时长:3–30 s;分辨率:720p · 1080p;画面比例:auto · 16:9 · 9:16 · 1:1 · 21:9;参考音频:3;参考图:10。超出这些限制的请求会在扣费之前被拒绝。