Kling 4.0 Flash API 调用参考
快速生成带声音的 720p Kling 视频,3 至 20 秒
用一个 PopNow API 密钥,就能在自己的代码里调用 Kling 4.0 Flash。下面列出要填的调用名、这个型号接受的每个输入字段、每次请求花多少美元(USD),以及一段可以直接粘进终端运行的请求。
参数说明直接取自型号的输入 schema,暂时只有英文。
一览
- 出品方
- Kuaishou
- 产出
- 视频
- 起价
- $0.1128 USD 每秒成片
价格以 USD 显示,从你的 PopNow 余额扣款。任务受理时预留可能的最高费用,完成后按实际用量结算并释放余款;失败任务不收费。运行前可调用 POST /api/v1/jobs/quote 获取准确报价。
生成视频
kling/4.0-flash/text-to-video
价格
| 选项 | USD |
|---|---|
默认 | $0.1128 每秒成片 |
参数
| 字段 | 类型 | 默认值 | 取值范围 | 作用 |
|---|---|---|---|---|
prompt必填 | string | — | — | Describe the scene, the action, the camera and the sound. Put spoken lines in quotes. |
aspect_ratio可选 | string | 16:9 | 16:9, 9:16, 1:1, 21:9 | Output aspect ratio, including 21:9 ultrawide. |
duration_seconds可选 | integer | 5 | 3 到 20 | Output length in whole seconds, from 3 to 20. Billed per second. |
请求示例
这段请求原样就能运行,没写的字段都用默认值。运行前先把密钥放进环境变量 POPNOW_API_KEY。
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: $(uuidgen)" \
-d '{
"model": "kling/4.0-flash/text-to-video",
"input": {
"prompt": "A paper boat drifts down a rain-soaked street at dusk, neon signs reflecting in the water, slow tracking shot at ground level",
"duration_seconds": 5
}
}'响应里会立刻带回 taskId。之后用 GET /api/v1/jobs/recordInfo 取结果,或者在请求里加上 callBackUrl 等通知。
curl "https://api.popnow.ai/api/v1/jobs/recordInfo?taskId=TASK_ID_FROM_CREATE_TASK" \
-H "Authorization: Bearer $POPNOW_API_KEY"图生视频
kling/4.0-flash/image-to-video
价格
| 选项 | USD |
|---|---|
默认 | $0.1128 每秒成片 |
参数
| 字段 | 类型 | 默认值 | 取值范围 | 作用 |
|---|---|---|---|---|
image_url必填 | string (uri) | — | — | Opening frame (JPEG, PNG or WebP). The clip starts from this image. |
prompt可选 | string | — | — | Optional: describe what happens after the opening frame - the action, the camera and the sound. |
aspect_ratio可选 | string | auto | auto, 16:9, 9:16, 1:1, 21:9 | Output aspect ratio; auto follows the opening frame. |
duration_seconds可选 | integer | 5 | 3 到 20 | Output length in whole seconds, from 3 to 20. Billed per second. |
请求示例
这段请求原样就能运行,没写的字段都用默认值。运行前先把密钥放进环境变量 POPNOW_API_KEY。
示例里的 image_url 用的是 PopNow 的示例素材,换成你自己的公开 HTTPS 链接、上传文件或已保存的素材即可。
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: $(uuidgen)" \
-d '{
"model": "kling/4.0-flash/image-to-video",
"input": {
"prompt": "He lands softly on the rooftop, laughs and turns toward the camera while the balloons sway in the evening breeze; slow push-in",
"image_url": "https://media.popnow.ai/influencer/examples/marco.webp",
"duration_seconds": 5
}
}'响应里会立刻带回 taskId。之后用 GET /api/v1/jobs/recordInfo 取结果,或者在请求里加上 callBackUrl 等通知。
curl "https://api.popnow.ai/api/v1/jobs/recordInfo?taskId=TASK_ID_FROM_CREATE_TASK" \
-H "Authorization: Bearer $POPNOW_API_KEY"参考生视频
kling/4.0-flash/reference-to-video
价格
| 选项 | USD |
|---|---|
默认 | $0.1128 每秒成片 |
with_video = true | $0.1512 每秒成片 |
参数
| 字段 | 类型 | 默认值 | 取值范围 | 作用 |
|---|---|---|---|---|
prompt必填 | string | — | — | Say what each reference is and what the shot should do with it. Refer to images as @Image1, @Image2 and to videos as @Video1, @Video2, numbered in upload order. |
reference_image_urls可选 | array<string (uri)> | — | 最多 10 项 | Reference images for characters, objects, outfits or places, up to 10. Refer to them as @Image1, @Image2 and so on. |
reference_video_urls可选 | array<string (uri)> | — | 最多 5 项 | Optional reference videos for motion, camera and pacing, up to 5 and 20 seconds in total. Refer to them as @Video1, @Video2. With a reference video every output second is billed at a higher per-second rate. |
aspect_ratio可选 | string | auto | auto, 16:9, 9:16, 1:1, 21:9 | Output aspect ratio; auto follows the reference images or video. |
keep_original_audio可选 | boolean | false | — | Keep the reference video's own sound instead of generating new audio. Only used with a reference video. |
duration_seconds可选 | integer | 5 | 3 到 20 | Output length in whole seconds, from 3 to 20. Billed per second. |
请求示例
这段请求原样就能运行,没写的字段都用默认值。运行前先把密钥放进环境变量 POPNOW_API_KEY。
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: $(uuidgen)" \
-d '{
"model": "kling/4.0-flash/reference-to-video",
"input": {
"prompt": "The man from the reference image jogs across a sunlit rooftop at golden hour and smiles at the camera; smooth tracking shot",
"duration_seconds": 5
}
}'响应里会立刻带回 taskId。之后用 GET /api/v1/jobs/recordInfo 取结果,或者在请求里加上 callBackUrl 等通知。
curl "https://api.popnow.ai/api/v1/jobs/recordInfo?taskId=TASK_ID_FROM_CREATE_TASK" \
-H "Authorization: Bearer $POPNOW_API_KEY"编辑视频
kling/4.0-flash/video-edit
价格
| 选项 | USD |
|---|---|
默认 | $0.1512 每秒成片 |
参数
| 字段 | 类型 | 默认值 | 取值范围 | 作用 |
|---|---|---|---|---|
prompt必填 | string | — | — | 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. |
video_url必填 | string (uri) | — | — | The clip to edit (MP4 or WebM), 3 to 20 seconds; anything past 20 seconds is cut off. The edit keeps its scene, subject and motion. Billed per second of the source clip, rounded up. |
reference_image_urls可选 | array<string (uri)> | — | 最多 10 项 | Optional reference images for a subject, object or style to bring into the edit, up to 10. Refer to them as @Image1, @Image2 and so on. |
aspect_ratio可选 | string | auto | auto, 16:9, 9:16, 1:1, 21:9 | Output aspect ratio; auto follows the source clip. |
keep_original_audio可选 | boolean | true | — | Keep the source clip's own sound. Turn it off to generate new synchronized audio instead. |
请求示例
这段请求原样就能运行,没写的字段都用默认值。运行前先把密钥放进环境变量 POPNOW_API_KEY。
示例里的 video_url 用的是 PopNow 的示例素材,换成你自己的公开 HTTPS 链接、上传文件或已保存的素材即可。
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: $(uuidgen)" \
-d '{
"model": "kling/4.0-flash/video-edit",
"input": {
"prompt": "Recolor the flowers in soft pastel blue; keep the face and the motion unchanged",
"video_url": "https://media.popnow.ai/effects/flower-bloom-1abd6efb.mp4"
}
}'响应里会立刻带回 taskId。之后用 GET /api/v1/jobs/recordInfo 取结果,或者在请求里加上 callBackUrl 等通知。
curl "https://api.popnow.ai/api/v1/jobs/recordInfo?taskId=TASK_ID_FROM_CREATE_TASK" \
-H "Authorization: Bearer $POPNOW_API_KEY"
