Kling 4.0 API reference
Kling 4.0 is Kuaishou's newest flagship Kling video model and generates sound with every clip. One model id, kling-4.0, covers two routes: a prompt alone or a prompt with reference images, reference videos, named subjects and voices (called by @mention) is reference-to-video; first, middle and last frames are keyframe-to-video. Any whole length from 3 to 30 seconds, at 720p or 1080p. Billed per billed second: without video input $0.157/s at 720p and $0.235/s at 1080p; with a reference video $0.094 / $0.141 per billed second.
The lighter tier, Kling 4.0 Flash (kling-4.0-flash), uses the same endpoint and fields at 720p only, 3-20 seconds, $0.094/s; see the Kling 4.0 Flash section for what differs.
Pricing
| Request | 720p | 1080p | Billed seconds |
|---|---|---|---|
| Per second, no video input | $0.157 | $0.235 | Output length |
| Per billed second, with reference video / video subject | $0.094 | $0.141 | Output + max(input video, output) |
| 5 s, no video input | $0.785 | $1.175 | 5 |
| 10 s, no video input | $1.57 | $2.35 | 10 |
| 30 s, no video input | $4.71 | $7.05 | 30 |
| 10 s output + 5 s reference video | $1.88 | $2.82 | 20 |
| 10 s output + 20 s reference video | $2.82 | $4.23 | 30 |
Without video input (text, reference images, image subjects, voices, keyframes) the billed seconds equal the output length. With a reference video or video subject the billed seconds are output + max(total input video, output); each clip is rounded up to whole seconds and measured by us when the task is created. Reference images, subject images and keyframes are not billed separately; the smallest request (720p, 3 s) is $0.471. Charged only on success; failed generations are not charged.
Authentication
All requests carry the API key in the header:
Authorization: Bearer YOUR_API_KEYGenerate a video
https://api.apimodels.app/v1/video/generations·GET/v1/video/generations?task_id=# Reference-to-video: images + a reference video, mentioned by position
curl -X POST https://api.apimodels.app/v1/video/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "kling-4.0",
"prompt": "The dancer in @image_1 performs the routine from @video_1 on the rooftop in @image_2 at dusk",
"image_urls": ["https://example.com/dancer.png", "https://example.com/rooftop.jpg"],
"video_urls": ["https://example.com/routine.mp4"],
"keep_original_sound": false,
"duration": 10,
"resolution": "720p",
"aspect_ratio": "9:16"
}'
# Keyframe-to-video: first + middle + last frame (a 5 s clip takes up to 6 frames)
curl -X POST https://api.apimodels.app/v1/video/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "kling-4.0",
"prompt": "The girl in @first_frame walks out, crosses the street in @keyframe_1 and arrives at the party in @last_frame",
"first_frame_url": "https://example.com/first.png",
"keyframe_urls": ["https://example.com/street.png"],
"last_frame_url": "https://example.com/party.png",
"duration": 5,
"resolution": "1080p"
}'
# Response (async — a task is created):
# { "code": 200, "msg": "success", "data": { "taskId": "clxxx", "state": "pending" } }
# Poll until completed (result files are kept 30 days)
curl "https://api.apimodels.app/v1/video/generations?task_id=TASK_ID" \
-H "Authorization: Bearer YOUR_API_KEY"
# { "code": 200, "data": { "state": "completed",
# "resultUrls": ["https://r2.apimodels.app/videos/clxxx.mp4"] } }Two routes, one model id
- Reference-to-video (including text-only) — prompt alone is text-to-video; add any mix of image_urls (≤10, @image_1…), video_urls (≤5, @video_1…, 2-30 s each, ≤30 s together with video subjects), elements (≤7, @Name) and voices (≤3, @Name), 15 materials at most. keep_original_sound decides whether the reference videos keep their own audio. Without aspect_ratio the clip follows the references, or 16:9 for a prompt alone.
- Keyframe-to-video — first_frame_url (image and image_url also work), keyframe_urls (≤8 middle frames, in time order) and last_frame_url, mentioned as @first_frame, @keyframe_1 and @last_frame. Total frames ≤ min(10, duration + 1): 4 at 3 s, 5 at 4 s … 10 from 9 s up. The clip follows the first frame's aspect ratio.
- Frames cannot be combined with image_urls, video_urls, elements or voices; mixing them returns 400. Every @image_N, @video_N, @keyframe_N, @first_frame and @last_frame in the prompt must match an input in the request, numbered by array position; every @Name must match a name in elements or voices.
Named subjects (elements) and voices
elements and voices are API-only for now (the playground covers reference images, reference videos and keyframes). Image subject: image_urls with 2-4 images, the first being the main view. Video subject: video_url with one 3-8 second single-shot character clip, shortest side at least 700 px; at most 3 video subjects. tag is optional: character, animal, prop, costume, scene, effect or others (video subjects can only be character); description up to 100 characters; voice_url only on character subjects. voices are standalone {name, audio_url} clips, up to 3, and must contain a recognizable voice. Names are 1-20 characters (Chinese, letters, digits, underscore), unique across elements and voices regardless of case, and cannot be image_N, video_N, keyframe_N, object_N, audio_N, first_frame or last_frame.
{
"model": "kling-4.0",
"prompt": "@Hero opens the door of @image_1 and greets @Robot; @Robot answers in the voice of @Narrator",
"image_urls": ["https://example.com/door.jpg"],
"elements": [
{
"name": "Hero",
"image_urls": ["https://example.com/hero-front.jpg", "https://example.com/hero-side.jpg"],
"tag": "character",
"description": "Young man in a red jacket",
"voice_url": "https://example.com/hero-voice.mp3"
},
{
"name": "Robot",
"image_urls": ["https://example.com/robot-front.png", "https://example.com/robot-back.png"],
"tag": "prop"
}
],
"voices": [
{ "name": "Narrator", "audio_url": "https://example.com/narrator.mp3" }
],
"duration": 10
}Parameters
| Field | Required | Type | Description |
|---|---|---|---|
| model | Yes | string | kling-4.0 (kling-4-0 and kling-v4 also work) |
| prompt | Yes | string | Scene, action, camera and sound, with @mentions for inputs; up to 10,000 characters. |
| duration | No | integer | Whole seconds from 3 to 30, default 5. seconds is accepted as an alias. |
| resolution | No | string | 720p (default) or 1080p. |
| aspect_ratio | No | string | auto, 16:9, 9:16, 1:1, 21:9. Omitted: follows the references, or 16:9 for a prompt alone; keyframe clips follow the first frame. |
| image_urls | No | string[] | Reference images, up to 10, @image_1 onward. reference_image_urls and images are accepted as aliases. |
| video_urls | No | string[] | Reference videos, up to 5, 2-30 s each, ≤30 s together with video subjects; public mp4 / mov / mkv / avi / webm. reference_video_urls and video_list are accepted as aliases. |
| keep_original_sound | No | boolean | Keep the reference videos' own audio; default false. Only applies with video_urls. |
| elements | No | object[] | Named subjects, up to 7 (≤3 video subjects): {name, image_urls | video_url, tag?, description?, voice_url?}. |
| voices | No | object[] | Named voices, up to 3: {name, audio_url}. |
| first_frame_url | No | string | First frame for the keyframe route. image and image_url are accepted as aliases. |
| keyframe_urls | No | string[] | Middle frames, up to 8, in time order, @keyframe_1 onward. |
| last_frame_url | No | string | Last frame for the keyframe route. |
| callback_url | No | string | We POST the result to this URL on completion; omit it and poll the GET endpoint instead. |
Kling 4.0 Flash
Kling 4.0 Flash is the lighter tier of Kling 4.0. Model id kling-4.0-flash (kling-4-0-flash and kling-v4-flash also work); the endpoint, async polling, field names and @mention syntax are the same as kling-4.0 above. Only the differences are listed here; everything not listed (image_urls ≤10, video_urls ≤5, elements ≤7 with ≤3 video subjects, ≤15 materials, aspect_ratio, keep_original_sound, callback_url, audio always on) works as described above.
- resolution: 720p only. Use kling-4.0 for 1080p.
- duration: whole seconds from 3 to 20 (default 5).
- prompt: up to 8,000 characters.
- The keyframe route takes first_frame_url only (@first_frame), and the clip follows the first frame's aspect ratio; keyframe_urls and last_frame_url return 400 and need kling-4.0.
- A standalone voices list is not accepted (400); give a character its voice with elements[].voice_url.
- Reference videos have no per-clip length limit, but reference videos plus video subjects are at most 5 clips and must add up to 2-20 seconds.
| Request | 720p | Billed seconds |
|---|---|---|
| Per second, no video input | $0.094 | Output length |
| Per billed second, with reference video / video subject | $0.063 | Output + max(input video, output) |
| 5 s, no video input | $0.47 | 5 |
| 10 s, no video input | $0.94 | 10 |
| 20 s, no video input | $1.88 | 20 |
| 10 s output + 5 s reference video | $1.26 | 20 |
Billed seconds are counted the same way as on Kling 4.0, with each input clip rounded up to whole seconds; the smallest request (3 s) is $0.282. Reference images, subject images and the first frame are not billed separately, and failed generations are not charged.
curl -X POST https://api.apimodels.app/v1/video/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "kling-4.0-flash",
"prompt": "@Kai waves at the camera in the park from @image_1 and says: See you tomorrow",
"image_urls": ["https://example.com/park.jpg"],
"elements": [{
"name": "Kai",
"image_urls": ["https://example.com/kai-front.png", "https://example.com/kai-side.png"],
"tag": "character",
"voice_url": "https://example.com/kai-voice.mp3"
}],
"duration": 6,
"aspect_ratio": "16:9"
}'
# 6 s, no video input: 6 × $0.094 = $0.564. Same polling as Kling 4.0:
# GET https://api.apimodels.app/v1/video/generations?task_id=TASK_IDTry it on the Kling 4.0 Flash model page, with a playground, worked price examples and a comparison with Kling 4.0.
Sources
Notes
- Sound is always generated and cannot be turned off: generate_audio: false returns 400. With reference videos, keep_original_sound is the only audio switch.
- Negative prompts, multi-shot storyboards and video extension are not supported; output stops at 1080p. Kuaishou has announced 4K and 10-bit HDR, but neither is available yet.
- Reference images need each side to be at least 300 px and an aspect ratio between 0.4 and 2.5. The top-level image_urls, video_urls, first_frame_url, keyframe_urls and last_frame_url take public URLs or data URIs; media inside elements and voices must be public http(s) URLs.
- Reference video lengths are measured when the task is created; a video whose length cannot be read (login wall, expired link, unsupported format) returns 400 instead of being billed on a guess.
- Asynchronous: create returns a taskId; poll GET /v1/video/generations?task_id= every 10-15 seconds until completed, or pass callback_url. Result files are deleted after 30 days, so download or re-host promptly.
- Content safety checks run upstream; rejected generations are not charged. Only upload faces and voices you have the rights to use.
Try it in the Playground. What is new, worked price examples and a comparison with Kling V3, Kling V3 Omni and Vidu Q4 are on the Kling 4.0 model page.
FAQ
How much does the Kling 4.0 API cost?
Without video input: $0.157/s at 720p and $0.235/s at 1080p for the seconds you request, so 5 s at 720p is $0.785 and 10 s at 1080p $2.35. With a reference video or video subject: $0.094/s (720p) or $0.141/s (1080p) per billed second, where billed seconds = output + max(input video, output); 10 s of output with a 5 s reference is 20 billed seconds, $1.88. Failed generations are not charged.
Which fields switch Kling 4.0 between reference and keyframe mode?
first_frame_url, keyframe_urls or last_frame_url select keyframe-to-video. Everything else (a prompt alone, image_urls, video_urls, elements, voices) is reference-to-video. Frames cannot be combined with references; that request returns a 400 at create time.
How do @mentions work in a Kling 4.0 prompt?
By position and by name: the first item in image_urls is @image_1, the first in video_urls @video_1, the first middle frame @keyframe_1, plus @first_frame and @last_frame; subjects and voices are called by their name, such as @Mia. Every mention must match an input in the same request, otherwise the request is rejected and nothing is charged.
How many frames can a Kling 4.0 keyframe request take?
First, middle and last frames together are capped at min(10, duration + 1): 4 frames at 3 seconds, 6 at 5 seconds, 10 from 9 seconds up, with at most 8 middle frames in keyframe_urls. The clip follows the first frame's aspect ratio.
What does Kling 4.0 not accept?
generate_audio: false (audio is always on), negative prompts, multi-shot storyboards, video extension, resolutions above 1080p, more than 15 materials, reference videos outside 2-30 seconds or above 30 seconds in total, and frames mixed with references. Each returns a clear 400 instead of a degraded video.
Which request fields differ on Kling 4.0 Flash?
Use model kling-4.0-flash on the same endpoint. resolution is 720p only, duration 3-20 s, the prompt up to 8,000 characters; the keyframe route takes first_frame_url only (keyframe_urls and last_frame_url need kling-4.0); there is no standalone voices list, so a voice goes on a subject through elements[].voice_url; and reference videos plus video subjects must add up to 2-20 seconds. Price: $0.094/s, or $0.063 per billed second with a reference video.