Kling 4.0 API for 30-Second Video with Keyframes

Kuaishou's flagship video model through POST /api/v1/videos/generations with model: kling-4-0. Generate single takes of 3 to 30 seconds from a prompt or a first frame, guide them through up to 8 middle keyframes and an optional last frame. Every video comes with a native audio track.
Get API Key
Cinema camera on a dolly track crossing a wide film set at golden hour

Long Takes You Can Steer

First, middle and last frames

image_url sets the first frame, keyframes adds 1 to 8 middle frames spaced evenly in playback order, and image_end_url ends the take. Frames are not charged.
Storyboard panels pinned in sequence on a studio wall

Up to 30 seconds in one take

duration is any integer from 3 to 30 (default 5), at 720p (default) or 1080p. Text-to-video also accepts ratio 16:9, 9:16, 1:1 or 21:9.
Clapperboard and a long roll of film unspooled across a table

Native audio on every clip

Audio is always generated and has no switch, so sound and generate_audio are rejected. Describe sound and what to avoid in prompt (up to 2500 characters).
Boom microphone above an empty film set at dusk
Only the prompt is required; add frames to switch to image-to-video.

Kling 4.0 Request Fields and Limits

model and prompt (required)

kling-4-0 and a prompt of up to 2500 characters describing scene, motion and camera.

image_url

First frame; enables image-to-video and sets the aspect ratio. JPG or PNG, up to 10 MB, at least 300 px each side, aspect ratio between 1:2.5 and 2.5:1.

keyframes and image_end_url

Optional, both require image_url. 1 to 8 middle frames; all frames together at most 10 images and at most duration + 1.

duration

Integer from 3 to 30 seconds. Defaults to 5.

resolution and ratio

720p (default) or 1080p; quality is an alias. ratio 16:9 (default), 9:16, 1:1 or 21:9, text-to-video only.

Not accepted

sound, generate_audio, negative_prompt, model_params.multi_shot, image_urls and 4K are rejected before any tokens are charged.
Per second of generated video; text-to-video and image-to-video cost the same.

Kling 4.0 API Pricing

720p: 10.205 tokens ($0.2041) per second

A 5-second video costs 51.03 tokens ($1.0206).

1080p: 15.275 tokens ($0.3055) per second

A 10-second video costs 152.75 tokens ($3.055).

Frames are free

First, middle and last frames add nothing to the price; only duration and resolution matter.

Charged on acceptance

The cost field in the response is what was deducted; failed jobs are refunded automatically.

Integrate the Kling 4.0 API

1

1. Create an API key

Generate a key at /keys and send it as Authorization: Bearer <key> from your server.
2

2. Validate frames

If you use frames, check size and aspect ratio, and keep the total frame count within 10 and within duration + 1.
3

3. Submit the job

POST {"model": "kling-4-0", "prompt": "…", "image_url": "https://…", "duration": 10, "resolution": "1080p"} to /api/v1/videos/generations.
4

4. Track completion

Store img_uuid and poll GET /api/v1/jobs/detail or pass custom_callback_url, then download the video with its audio track.
Create an API Key
Longer, directed clips without stitching shots together.

What Developers Build with Kling 4.0

Product showcase videos

Rotate from a front shot through side angles to a logo close-up by passing each view as a frame.

Story beats in one take

Lay out a sequence of keyframes from a storyboard and let the model connect them over up to 30 seconds.

Vertical social content

Generate 9:16 text-to-video clips with sound for short-form feeds.

Cinematic widescreen shots

Use the 21:9 ratio for trailers, intros and title sequences.
Endpoint, frames, audio and pricing.

Kling 4.0 API FAQ

What is the Kling 4.0 API endpoint?

POST https://api.goenhance.ai/api/v1/videos/generations with model: kling-4-0.

How many keyframes can I use?

Up to 8 middle frames, plus first and last frames, with at most 10 images in total and at most duration + 1.

Can I turn audio off?

No. Every video includes a native audio track, and sound / generate_audio are rejected.

Can I use reference images?

Not on this model; image_urls is rejected. Use kling-4-0-refs for reference-to-video.

How is it priced?

10.205 tokens ($0.2041) per second at 720p and 15.275 tokens ($0.3055) per second at 1080p, for both text-to-video and image-to-video.

Is 4K available?

No. Resolution is 720p or 1080p; 4K is rejected before any tokens are charged.

Start Building with the Kling 4.0 API