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.
Quick Start
| 1 | curl -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
| 1 | Authorization: Bearer YOUR_API_KEY |
Available Models
Kling 4.0 New
3–30 s scenes at 720p or 1080p with references, subjects, voices and keyframes
Select with "model": "kling-4.0"
| Type | Description | Duration | Credits |
|---|---|---|---|
reference-to-video | Text, reference images, subjects and voices (chosen automatically) | 3-30s | 28.5/s (720p) · 42.5/s (1080p) |
keyframe-to-video | First, intermediate and last frames (chosen automatically) | 3-30s | 28.5/s (720p) · 42.5/s (1080p) |
Kling 4.0 Flash New
Lower-cost 720p clips with image-to-video, references and video edits
Select with "model": "kling-4.0-flash"
| Type | Description | Duration | Credits |
|---|---|---|---|
text-to-video | Text to video, 720p | 3-20s | 24/s |
image-to-video | Animate a first-frame image, prompt optional | 3-20s | 24/s |
reference-to-video | Up to 10 images and 5 reference videos | 3-20s | 24/s · 32/s (videos) |
video-edit | Edit a source video with a prompt, billed per source second | auto (3-20s) | 32/s |
Kling 3.0
High-quality 4K video generation
| Type | Description | Duration | Credits |
|---|---|---|---|
pro-text-to-video | Pro quality text-to-video generation | 3-15s | 54/s (no audio) · 80/s (with audio) |
pro-image-to-video | Pro quality image-to-video animation | 3-15s | 54/s (no audio) · 80/s (with audio) |
std-text-to-video | Standard quality text-to-video | 3-15s | 40/s (no audio) · 60/s (with audio) |
std-image-to-video | Standard quality image-to-video | 3-15s | 40/s (no audio) · 60/s (with audio) |
Kling Video O3
Next-gen with reference & video editing
| Type | Description | Duration | Credits |
|---|---|---|---|
o3-pro-text-to-video | O3 Pro text-to-video | 3-15s | 48/s |
o3-pro-image-to-video | O3 Pro image-to-video | 3-15s | 48/s |
o3-pro-reference-to-video | O3 Pro with reference images/video | 3-15s | 72/s |
o3-pro-video-edit | O3 Pro video editing | auto | 435 fixed |
o3-std-text-to-video | O3 Standard text-to-video | 3-15s | 36/s |
o3-std-image-to-video | O3 Standard image-to-video | 3-15s | 36/s |
o3-std-reference-to-video | O3 Standard reference-to-video | 3-15s | 20/s |
o3-std-video-edit | O3 Standard video editing | auto | 360 fixed |
API Endpoints
/api/generateCreate 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
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.
Kling 3.0 / O3 task type (e.g., pro-text-to-video, o3-pro-reference-to-video). Not needed when model is set.
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.
Video duration in seconds. Kling 3.0: 3-15. O3: 3-15. Defaults to 5.
Output aspect ratio (16:9, 9:16, 1:1) Defaults to 16:9.
Image URL for image-to-video tasks
End frame image URL (image-to-video only)
Video URL for reference-to-video or video-edit tasks
Array of reference image URLs (O3 reference-to-video, max 7)
Enable native audio generation Defaults to true.
Negative prompt to avoid certain elements
Prompt adherence (0-1, Kling 3.0 only) Defaults to 0.5.
Kling 4.0 - Reference Images
| 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
| 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
| 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
| 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
| 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
| 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
| 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
| 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 | } |
/api/statusCheck 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
The task ID returned by the generate endpoint, for any model
Example Request
| 1 | curl -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.
| 1 | // Extract video URL from response |
| 2 | const 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.
Error Codes
| Status | Code | Description |
|---|---|---|
| 400 Bad Request | INVALID_PROMPT | The prompt is invalid or empty |
| 400 Bad Request | INVALID_DURATION | Duration out of supported range |
| 400 Bad Request | INVALID_TYPE | Unsupported task type |
| 400 Bad Request | MISSING_IMAGE | Image is required for image-to-video tasks |
| 400 Bad Request | MISSING_VIDEO | Video is required for video-edit tasks |
| 401 Unauthorized | INVALID_API_KEY | API key is missing or invalid |
| 402 | INSUFFICIENT_CREDITS | Not enough credits for this operation |
| 429 Too Many Requests | RATE_LIMITED | Too many requests, please slow down |
| 500 Internal Server Error | INTERNAL_ERROR | Server error, please try again later |