NeuralBridge
Sign in Download IDE
Kling AI

Kling 4.0

video

Kling 4.0 video model: clips with sound of 3 to 30 seconds in 720p and 1080p from text and from keyframes — a first frame, up to 9 middle frames and a last frame.

Specifications

Context window
—
Max tokens in response
—
Vendor
Kling AI
Release
—
Login
text, images
Output
video

Capabilities

txt2vidimg2vidfirst_last_frame

Description

What it does

  • Text to video: describe the scene, the camera movement and the sound. Aspect ratio: 16:9, 9:16, 1:1 or 21:9.
  • Keyframes: a first frame, middle frames (up to 9) and a last frame, 10 images at most. The video passes through them in order. A last frame alone works too. With keyframes, the clip takes its proportions from the images.
  • In the prompt, refer to keyframes in order: @image_1, @image_2 … — the first frame, then the middle ones, then the last.
  • Length: a whole number of seconds from 3 to 30 in one generation. Resolution 720p or 1080p, 24 frames per second.
  • The model always creates sound: speech, music and effects from your description.
  • A prompt is always required, up to 26,000 characters. English works best. A long prompt can be split into timed shots ("SHOT 1 — 0–10 s: …").

Image requirements

JPG or PNG, up to 30 MB, each side at least 300 px, proportions from 2:5 to 5:2. An https link or a data URI.

How to call

POST /v1/videos/generations with a JSON body. Keyframes go in media: [{"type": "first_frame" | "middle_frame" | "last_frame", "url": "…"}], middle frames in the order you need.

{"model": "klingai/kling-v4-08130", "prompt": "A paper boat drifts down a rain-soaked Tokyo alley at night", "duration": 5, "resolution": "1080p", "aspect_ratio": "16:9"}

From keyframes:

{"model": "klingai/kling-v4-08130", "prompt": "Start on @image_1, pass through @image_2 and end on @image_3.", "duration": 10, "resolution": "720p", "media": [{"type": "first_frame", "url": "https://example.com/1.jpg"}, {"type": "middle_frame", "url": "https://example.com/2.jpg"}, {"type": "last_frame", "url": "https://example.com/3.jpg"}]}

Response

The response arrives when the video is ready: usually in 2 to 5 minutes, about 7 to 8 minutes for a 30-second clip. Set a client timeout of at least 16 minutes and send an Idempotency-Key header: repeating a request with the same key does not start a second paid generation; it waits for and returns the clip already paid for. data[0].url is a link to the MP4 file (it lives one day, save the file right away).

Errors

  • 400: invalid input; the error text names the field. input_moderation: a file could not be downloaded from its link, or the prompt and images did not pass the content check. input_invalid_media: an image is smaller than 300 px or has unsuitable proportions. Rejected requests are not billed.
  • 402: not enough funds on the balance. 429: the model is overloaded. 502 or 504: the video was not received; nothing is charged.

Price

You pay per second of the finished clip. The rate depends on the resolution (720p or 1080p). The prices are shown on this page.

Parameters

resolutiondefault: 1080p · 720p · 1080p
Video resolution, for example 720P or 1080P. Also affects the price.
durationdefault: 5 · 3 · 4 · 5 · 6 · 7 · 8 · 9 · 10 · 11 · 12 · 13 · 14 · 15 · 16 · 17 · 18 · 19 · 20 · 21 · 22 · 23 · 24 · 25 · 26 · 27 · 28 · 29 · 30
Length in seconds: of the clip for video, of the track for music. Also affects the price.
prompt
The request text: what you want to get. For video: the scene, camera movement and light; for music: genre, mood, instruments, tempo. The length limit depends on the model.
aspect_ratiodefault: 16:9 · 16:9 · 9:16 · 1:1 · 21:9
Aspect ratio of the result, for example 16:9, 9:16 or 1:1.
media
A list of files {type, url}: first_frame, last_frame, reference_image, reference_video (https only), reference_audio.
last_frame_alone
A last frame can be passed without a first one: the video ends on that image.
middle_frames
Images the video passes through, in order, between the first and the last frame.
keyframes
Images tied to a moment of the source video: a second from the start or a fraction of the length. The maximum number depends on the model.
images
1 to 16 PNG, JPEG or WEBP images: edits, style transfer, building a scene from objects. Up to 25 MB each, 50 MB in total.
media_labelsdefault: @image_{n}
How the model reads references to files in the prompt; {n} is the file number within its kind, in order.
reference_image_side
Image width and height, pixels.
reference_image_aspect
Width divided by height.
reference_image_mb
Megabytes per image.
reference_image_formatsimage/jpeg · image/png
Which image formats the model accepts as input.

Endpoints

POSThttps://api.neuralbridge.ru/v1/videos/generationsprimary
Videos — generations — Generate video from a text description.
POSThttps://api.neuralbridge.ru/v1/video/generations
Videos — generations (legacy path) — The early singular path for video generation. Still accepted, but use /v1/videos/generations in new integrations.

Code examples

bash
curl https://api.neuralbridge.ru/v1/videos/generations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "klingai/kling-v4-08130", "prompt": "Дрон летит над осенним лесом", "resolution": "1080P", "duration": 5}'
For OpenAI SDK, specify /v1 in base_url. For Anthropic SDK — without /v1.
Prices
Video second / second37,0125 ₽
Video second 720p / second24,7275 ₽
Video second 1080p / second37,0125 ₽
The request cost in rubles — in the response, field usage.cost
Identifier
klingai/kling-v4-08130
Get API key