Kling 3 API

REST API · Kling 4.0

Kling 4.0 API

Direct 30-second scenes with references and keyframes from one REST call.

Send a prompt with optional reference images, reusable subjects, voices or keyframes. Kling 4.0 returns up to 30 seconds of video at 720p or 1080p, billed per output second.

"model": "kling-4.0"
bash
1curl -X POST 'https://kling3api.com/api/generate' \
2 -H 'Authorization: Bearer YOUR_API_KEY' \
3 -H 'Content-Type: application/json' \
4 -d '{
5 "model": "kling-4.0",
6 "prompt": "A lighthouse keeper climbs the spiral stairs at dusk, the camera follows from below, then reveals the storm over the sea",
7 "duration": 10,
8 "resolution": "1080p",
9 "aspect_ratio": "16:9"
10 }'
Model ID
kling-4.0
Duration
3–30 s
Resolution
720p · 1080p
Aspect ratio
21:9 · 16:9 · 1:1 · 9:16 · auto
Price from
28.5 credits/s

Two endpoints, one async flow

Every request is asynchronous. Create a task, keep the task_id, then poll the status endpoint until the video URL is ready.

  1. Create an API key

    Sign in and create a key in the dashboard. Send it as a Bearer token on every request, and keep it on your server, never in browser code.

    http
    1Authorization: Bearer YOUR_API_KEY
  2. POST /api/generate

    Send the model ID, a prompt and your inputs. Credits are reserved when the task is accepted, and the response returns a task_id straight away.

    json
    1{
    2 "code": 200,
    3 "message": "success",
    4 "data": {
    5 "task_id": "k4f3a9c1e27b4d0a9video",
    6 "status": "IN_PROGRESS",
    7 "consumed_credits": 425
    8 }
    9}
  3. GET /api/status

    Poll every 10–15 seconds. When status is SUCCESS, data.response[0] is the video URL. If a task fails, its credits go back to your balance.

    json
    1{
    2 "code": 200,
    3 "message": "success",
    4 "data": {
    5 "task_id": "k4f3a9c1e27b4d0a9video",
    6 "status": "SUCCESS",
    7 "consumed_credits": 425,
    8 "response": [
    9 "https://cdn.example.com/v/abc.mp4"
    10 ],
    11 "error_message": null
    12 }
    13}

Request examples by input mode

Each tab is a complete request body for POST /api/generate. Replace the example URLs with your own public HTTPS files and send it.

A prompt is all you need. Set the duration, resolution and aspect ratio, or keep the defaults of 10 seconds, 1080p and 16:9.

json
1{
2 "model": "kling-4.0",
3 "prompt": "A lighthouse keeper climbs the spiral stairs at dusk, the camera follows from below, then reveals the storm over the sea",
4 "duration": 10,
5 "resolution": "1080p",
6 "aspect_ratio": "16:9"
7}

Pricing per output second

You pay for the seconds you generate, rounded up to a whole credit per task. There is no monthly minimum.

ConfigurationPer second5 s video10 s video30 s video
720p28.5 credits/s143≈ $1.43285≈ $2.85855≈ $8.55
1080p42.5 credits/s213≈ $2.13425≈ $4.251275≈ $12.75

Pay-as-you-go credit packs convert at 100 credits per US dollar, which is the rate used for the dollar figures above. Subscription plans can lower the effective rate. Every create response includes consumed_credits, so you can reconcile usage per task.

See credit packs

Request parameters

Send these fields at the top level of the JSON body for POST /api/generate.

Body ParametersJSON
model:string

Set to kling-4.0.

prompt:string

What happens in the scene, how the subject moves and how the camera follows. Mention attached media with @ tags.

duration:optional integer

Output length in whole seconds, from 3 to 30. Defaults to 10.

resolution:optional string

720p or 1080p. Defaults to 1080p.

aspect_ratio:optional string

21:9, 16:9, 1:1, 9:16 or auto. Defaults to 16:9.

image_urls:optional string[]

Up to 10 reference images (JPG or PNG), mentioned as @image_1, @image_2 and so on.

elements:optional object[]

Reusable subjects: each has a name and 2–4 image_urls, the first being the main view.

voices:optional object[]

Voice references: each has a name and an audio_url.

first_frame_url:optional string

Image for the opening frame. Use instead of reference media.

last_frame_url:optional string

Image for the closing frame.

keyframe_urls:optional string[]

Up to 8 intermediate frames, in order.

Limits and validation

Requests that break these rules are rejected with HTTP 400 before any credits are charged.

  • prompt is required and can be up to 8,000 characters.
  • duration is a whole number of seconds from 3 to 30. The default is 10.
  • resolution is 720p or 1080p (default 1080p). aspect_ratio is 21:9, 16:9, 1:1, 9:16 or auto (default 16:9).
  • Images must be JPG or PNG files at a public HTTP or HTTPS URL. WebP, GIF, AVIF and HEIC are rejected.
  • Up to 10 reference images, 7 subjects and 3 voices, with no more than 15 reference items in total. Subject and voice names must be unique.
  • Up to 8 intermediate keyframes. First, intermediate and last frames together cannot exceed duration + 1, with a maximum of 10.
  • Reference videos are not available through the public API yet. You can use them in the video playground.

Which Kling model should you call?

All models share one API key, the same two endpoints and one credit balance. Switching models is a change to the request body, not a new integration.

ModelSelect withDurationResolutionFromBest for
Kling 4.0"model": "kling-4.0"3–30 s720p · 1080p28.5 credits/sScenes up to 30 s at 1080p, multi-reference casting and keyframe-directed shots
Kling 4.0 Flash"model": "kling-4.0-flash"3–20 s720p24 credits/sLower-cost 720p clips up to 20 s, image-to-video and video edits
Kling 3.0"type": "pro-text-to-video"3–15 spro / std40 credits/sExisting Kling 3.0 integrations with pro and std modes and optional sound

Kling 4.0 API questions

What is the model ID for the Kling 4.0 API?

Send "model": "kling-4.0" in the body of POST /api/generate. The same API key, status endpoint and credit balance also serve Kling 4.0 Flash, Kling 3.0 and Kling Video O3.

How much does the Kling 4.0 API cost?

28.5 credits per output second at 720p and 42.5 credits per second at 1080p, rounded up per task. A 10-second 1080p video costs 425 credits. Credits for failed tasks go back to your balance.

Which inputs can I send to Kling 4.0?

A prompt on its own, up to 10 reference images, subjects built from 2–4 images, voice references, or first, last and intermediate keyframes. Keyframes and reference media cannot be mixed in one request.

Does the API send a webhook when the video is ready?

Not at the moment. Poll GET /api/status with the task_id every 10–15 seconds until the status is SUCCESS or FAILED. The finished video URL is in data.response[0].

Should I use Kling 4.0 or Kling 4.0 Flash?

Choose Kling 4.0 for scenes up to 30 seconds, 1080p output, subjects, voices and keyframe control. Choose Kling 4.0 Flash for lower-cost 720p clips up to 20 seconds, image-to-video and video editing.

Is this the official Kling API?

No. kling3api.com is an independent API platform that provides access to Kling models. It is not affiliated with or endorsed by Kuaishou.

Make your first Kling 4.0 request

Create a key, paste the cURL example into your terminal and you will have a task_id in seconds.