关于 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。超出这些限制的请求会在扣费之前被拒绝。