Kling API Documentation

Complete guide to integrating Kling 4.0, Kling 4.0 Flash, Kling 3.0 and Kling Video O3 into your applications with one API key.

API v1.0 Base URL: https://kling3api.com

Quick Start

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 cinematic shot of mountains at sunrise",
7 "duration": 5,
8 "resolution": "1080p",
9 "aspect_ratio": "16:9"
10 }'

Authentication

All API requests require authentication using a Bearer token in the Authorization header.

Get Your API Key: You can get your API key from the API Keys page in your dashboard. → Get Your API Key

http
1Authorization: Bearer YOUR_API_KEY

Available Models

4.0

Kling 4.0 New

3–30 s scenes at 720p or 1080p with references, subjects, voices and keyframes

Model guide →

Select with "model": "kling-4.0"

TypeDescriptionDurationCredits
reference-to-videoText, reference images, subjects and voices (chosen automatically)3-30s28.5/s (720p) · 42.5/s (1080p)
keyframe-to-videoFirst, intermediate and last frames (chosen automatically)3-30s28.5/s (720p) · 42.5/s (1080p)
Flash

Kling 4.0 Flash New

Lower-cost 720p clips with image-to-video, references and video edits

Model guide →

Select with "model": "kling-4.0-flash"

TypeDescriptionDurationCredits
text-to-videoText to video, 720p3-20s24/s
image-to-videoAnimate a first-frame image, prompt optional3-20s24/s
reference-to-videoUp to 10 images and 5 reference videos3-20s24/s · 32/s (videos)
video-editEdit a source video with a prompt, billed per source secondauto (3-20s)32/s
3.0

Kling 3.0

High-quality 4K video generation

TypeDescriptionDurationCredits
pro-text-to-videoPro quality text-to-video generation3-15s54/s (no audio) · 80/s (with audio)
pro-image-to-videoPro quality image-to-video animation3-15s54/s (no audio) · 80/s (with audio)
std-text-to-videoStandard quality text-to-video3-15s40/s (no audio) · 60/s (with audio)
std-image-to-videoStandard quality image-to-video3-15s40/s (no audio) · 60/s (with audio)
O3

Kling Video O3

Next-gen with reference & video editing

TypeDescriptionDurationCredits
o3-pro-text-to-videoO3 Pro text-to-video3-15s48/s
o3-pro-image-to-videoO3 Pro image-to-video3-15s48/s
o3-pro-reference-to-videoO3 Pro with reference images/video3-15s72/s
o3-pro-video-editO3 Pro video editingauto435 fixed
o3-std-text-to-videoO3 Standard text-to-video3-15s36/s
o3-std-image-to-videoO3 Standard image-to-video3-15s36/s
o3-std-reference-to-videoO3 Standard reference-to-video3-15s20/s
o3-std-video-editO3 Standard video editingauto360 fixed

API Endpoints

POST/api/generate

Create a new video generation task. Set model to kling-4.0 or kling-4.0-flash for the Kling 4 family; for Kling 3.0 and O3, the type field selects the backend.

Request Body

Body ParametersJSON
model:optional string

Kling 4 family model: kling-4.0 or kling-4.0-flash. Omit it to use Kling 3.0 or O3 with the type field. Each Kling 4 model has its own fields; see the model guides.

type:optional string

Kling 3.0 / O3 task type (e.g., pro-text-to-video, o3-pro-reference-to-video). Not needed when model is set.

prompt:string

Text description of the video to generate. Max length: 2,000 characters for Kling 3.0, 8,000 for Kling 4.0 and 2,500 for Kling 4.0 Flash.

duration:optional number

Video duration in seconds. Kling 3.0: 3-15. O3: 3-15. Defaults to 5.

aspect_ratio:optional string

Output aspect ratio (16:9, 9:16, 1:1) Defaults to 16:9.

image:optional string

Image URL for image-to-video tasks

end_image:optional string

End frame image URL (image-to-video only)

video:optional string

Video URL for reference-to-video or video-edit tasks

images:optional string[]

Array of reference image URLs (O3 reference-to-video, max 7)

sound:optional boolean

Enable native audio generation Defaults to true.

negative_prompt:optional string

Negative prompt to avoid certain elements

cfg_scale:optional number

Prompt adherence (0-1, Kling 3.0 only) Defaults to 0.5.

Kling 4.0 - Reference Images

json
1{
2 "model": "kling-4.0",
3 "prompt": "The woman from @image_1 walks into the cafe from @image_2 and orders a coffee",
4 "image_urls": [
5 "https://example.com/woman.jpg",
6 "https://example.com/cafe.png"
7 ],
8 "duration": 8,
9 "resolution": "1080p",
10 "aspect_ratio": "9:16"
11}

Kling 4.0 - Keyframes

json
1{
2 "model": "kling-4.0",
3 "prompt": "Start on @first_frame and settle on @last_frame in one continuous move",
4 "first_frame_url": "https://example.com/start.jpg",
5 "last_frame_url": "https://example.com/end.jpg",
6 "duration": 6,
7 "resolution": "720p"
8}

Kling 4.0 Flash - Image to Video

json
1{
2 "model": "kling-4.0-flash",
3 "prompt": "The product slowly rotates while soft light sweeps across it",
4 "image": "https://example.com/product.jpg",
5 "duration": 5
6}

Kling 4.0 Flash - Video Edit

json
1{
2 "model": "kling-4.0-flash",
3 "mode": "video-edit",
4 "prompt": "Turn the daytime street into a snowy night",
5 "video": "https://example.com/street.mp4",
6 "keep_original_sound": true
7}

Kling 3.0 - Text to Video

json
1{
2 "type": "pro-text-to-video",
3 "prompt": "A majestic eagle soaring through clouds at sunset",
4 "duration": 5,
5 "aspect_ratio": "16:9",
6 "sound": true
7}

Kling 3.0 - Image to Video

json
1{
2 "type": "pro-image-to-video",
3 "prompt": "The character slowly turns and smiles",
4 "image": "https://example.com/my-image.jpg",
5 "duration": 5
6}

Kling O3 - Reference to Video

json
1{
2 "type": "o3-pro-reference-to-video",
3 "prompt": "The character walks through a futuristic city",
4 "images": [
5 "https://example.com/character-reference.jpg",
6 "https://example.com/style-reference.jpg"
7 ],
8 "duration": 5,
9 "aspect_ratio": "16:9"
10}

Kling O3 - Video Edit

json
1{
2 "type": "o3-pro-video-edit",
3 "prompt": "Change the background to a snowy mountain landscape",
4 "video": "https://example.com/original-video.mp4",
5 "keep_original_sound": true
6}

Responses

Task created successfully

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

Check the status of a video generation task. Use the task_id returned by /api/generate for any model; the API routes it to the right backend.

Query Parameters

Body ParametersJSON
task_id:string

The task ID returned by the generate endpoint, for any model

Example Request

bash
1curl -X GET 'https://kling3api.com/api/status?task_id=n75abc123kling3' \
2 -H 'Authorization: Bearer YOUR_API_KEY'

💡 Tip: The response field in the status API is an array of video URLs. You can directly access data.response[0] to get the video URL.

javascript
1// Extract video URL from response
2const videoUrl = data.response[0];

Responses

1{
2 "code": 200,
3 "message": "success",
4 "data": {
5 "task_id": "n75abc123kling3",
6 "status": "SUCCESS",
7 "consumed_credits": 400,
8 "created_at": "2026-02-05T10:30:00Z",
9 "request": {
10 "type": "pro-text-to-video",
11 "prompt": "A majestic eagle soaring through clouds at sunset",
12 "duration": 5,
13 "aspect_ratio": "16:9"
14 },
15 "response": [
16 "https://cdn.example.com/videos/abc123.mp4"
17 ],
18 "error_message": null,
19 "type": "pro-text-to-video"
20 }
21}

API Playground

Test the API directly from your browser. Replace YOUR_API_KEY with your actual API key.

Example body
API PlaygroundPOST

Error Codes

StatusCodeDescription
400 Bad RequestINVALID_PROMPTThe prompt is invalid or empty
400 Bad RequestINVALID_DURATIONDuration out of supported range
400 Bad RequestINVALID_TYPEUnsupported task type
400 Bad RequestMISSING_IMAGEImage is required for image-to-video tasks
400 Bad RequestMISSING_VIDEOVideo is required for video-edit tasks
401 UnauthorizedINVALID_API_KEYAPI key is missing or invalid
402 INSUFFICIENT_CREDITSNot enough credits for this operation
429 Too Many RequestsRATE_LIMITEDToo many requests, please slow down
500 Internal Server ErrorINTERNAL_ERRORServer error, please try again later