Kling 4.0 API
Generate Kling 4.0 videos from your own code. Three endpoints cover text-to-video, image-to-video with up to 10 keyframes, and reference-to-video, any whole-second duration from 3 to 30 seconds with native audio at 720p or 1080p. Kling 4.0 is resold by several providers; every request is priced across them and runs on the cheapest one that supports your settings.
24% less than the priciest provider (7 compared). Same model, same output.
As of , Kling 4.0 costs from $0.12 per second on Scenetra, billed at provider cost with no markup. Each run is priced across 12 providers and runs on the cheapest one that supports your settings.
- 720p
- $0.12/s
- 1080p
- $0.19/s
Quickstart
Async by design: submit a generation, get a run id back instantly, poll until it completes (or pass a callbackUrl). Each mode is its own endpoint.
Kling 4.0 Text to Video API
1 — Start a generation
curl -X POST https://app.scenetra.com/api/v1/generate/kling-4-t2v \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"prompt":"A lone astronaut walks across red dunes at sunrise, boots crunching, wind howling, wide 21:9 tracking shot","aspect_ratio":"21:9","duration":"10"}'Response (202)
{
"runId": "run_abc123",
"status": "PENDING",
"model": "kling-4-t2v",
"estimatedCredits": 600,
"statusUrl": "/api/v1/runs/run_abc123"
}2 — Poll until COMPLETED (every 2-5 seconds)
curl https://app.scenetra.com/api/v1/runs/run_abc123 \
-H "Authorization: Bearer YOUR_API_KEY"Response
{
"runId": "run_abc123",
"status": "COMPLETED",
"progress": { "completed": 1, "total": 1 },
"outputs": [
{ "type": "video", "url": "https://images.scenetra.com/..." }
],
"error": null,
"estimatedCredits": 600
}Request fields
| Field | Type | Description | Default |
|---|---|---|---|
| prompt* | string | Describe the scene, action and camera, and any sound. Audio is generated natively. | — |
| aspect_ratio | string | 16:9, 9:16, 1:1 or 21:9 widescreen.16:9 · 9:16 · 1:1 · 21:9 | 16:9 |
| resolution | string | 720p or 1080p.720p · 1080p | 720p |
| duration | string | Length of the video in seconds (3-30). Billed per second.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 | 5 |
| callbackUrl | string (https URL) | Optional. When the run finishes (completed or failed), we POST the final run status to this URL — same shape as the poll response, plus model, params, and chargedCredits. Best-effort; polling remains the source of truth. | |
Unknown fields are rejected with a helpful 400. Media fields take https URLs. There is no provider parameter — every run is routed to the cheapest capable provider automatically.
Kling 4.0 Image to Video API
1 — Start a generation
curl -X POST https://app.scenetra.com/api/v1/generate/kling-4-i2v \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"prompt":"@first_frame comes to life: she opens the door and steps into @last_frame, warm morning light","first_frame_url":"https://example.com/first.jpg","last_frame_url":"https://example.com/last.jpg","duration":"8"}'Response (202)
{
"runId": "run_abc123",
"status": "PENDING",
"model": "kling-4-i2v",
"estimatedCredits": 600,
"statusUrl": "/api/v1/runs/run_abc123"
}2 — Poll until COMPLETED (every 2-5 seconds)
curl https://app.scenetra.com/api/v1/runs/run_abc123 \
-H "Authorization: Bearer YOUR_API_KEY"Response
{
"runId": "run_abc123",
"status": "COMPLETED",
"progress": { "completed": 1, "total": 1 },
"outputs": [
{ "type": "video", "url": "https://images.scenetra.com/..." }
],
"error": null,
"estimatedCredits": 600
}Request fields
| Field | Type | Description | Default |
|---|---|---|---|
| prompt* | string | Describe the scene, action and camera, and any sound. Audio is generated natively. | — |
| first_frame_url* | string (https URL) | First frame (https URL). Cite it in the prompt as @first_frame. | — |
| keyframe_urls | string[] (https URLs) | Up to 8 keyframes (https URLs) between the first and last frame, cited as @keyframe_1, @keyframe_2... Total frames up to min(10, duration + 1). | — |
| last_frame_url | string (https URL) | Optional last frame (https URL), cited as @last_frame. | — |
| resolution | string | 720p or 1080p.720p · 1080p | 720p |
| duration | string | Length of the video in seconds (3-30). Billed per second.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 | 5 |
| callbackUrl | string (https URL) | Optional. When the run finishes (completed or failed), we POST the final run status to this URL — same shape as the poll response, plus model, params, and chargedCredits. Best-effort; polling remains the source of truth. | |
Unknown fields are rejected with a helpful 400. Media fields take https URLs. There is no provider parameter — every run is routed to the cheapest capable provider automatically.
Kling 4.0 Reference to Video API
1 — Start a generation
curl -X POST https://app.scenetra.com/api/v1/generate/kling-4-ref2v \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"prompt":"@image_1 dances on a rooftop at night, copying the moves from @video_1","reference_image_urls":["https://example.com/dancer.jpg"],"reference_video_urls":["https://example.com/moves.mp4"],"duration":"10"}'Response (202)
{
"runId": "run_abc123",
"status": "PENDING",
"model": "kling-4-ref2v",
"estimatedCredits": 600,
"statusUrl": "/api/v1/runs/run_abc123"
}2 — Poll until COMPLETED (every 2-5 seconds)
curl https://app.scenetra.com/api/v1/runs/run_abc123 \
-H "Authorization: Bearer YOUR_API_KEY"Response
{
"runId": "run_abc123",
"status": "COMPLETED",
"progress": { "completed": 1, "total": 1 },
"outputs": [
{ "type": "video", "url": "https://images.scenetra.com/..." }
],
"error": null,
"estimatedCredits": 600
}Request fields
| Field | Type | Description | Default |
|---|---|---|---|
| prompt* | string | Describe the scene, action and camera, and any sound. Audio is generated natively. | — |
| reference_image_urls | string[] (https URLs) | Reference images (https URLs) for characters, objects or style, cited as @image_1, @image_2... | — |
| reference_video_urls | string[] (https URLs) | Reference clips (https URLs) for motion or camera work, cited as @video_1. Billed for their seconds (up to 30s combined). | — |
| resolution | string | 720p or 1080p.720p · 1080p | 720p |
| aspect_ratio | string | 16:9, 9:16, 1:1 or 21:9 widescreen.auto · 16:9 · 9:16 · 1:1 · 21:9 | auto |
| duration | string | Length of the video in seconds (3-30). Billed per second.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 | 5 |
| keep_original_sound | boolean | Keep the reference video's audio instead of generating new sound.true · false | false |
| callbackUrl | string (https URL) | Optional. When the run finishes (completed or failed), we POST the final run status to this URL — same shape as the poll response, plus model, params, and chargedCredits. Best-effort; polling remains the source of truth. | |
Unknown fields are rejected with a helpful 400. Media fields take https URLs. There is no provider parameter — every run is routed to the cheapest capable provider automatically.
Good to know
Billing
Runs bill your account credits at provider cost with 0% markup. The submit response includes the credit estimate; failed generations are refunded automatically. Add ?dryRun=1 to get the estimate without running anything.
Errors
Errors are always { "error": { "code", "message" } } with stable codes: unauthorized, model_not_available, invalid_parameter, insufficient_credits, rate_limited. A failed run is not an HTTP error — poll responses report status: "FAILED" with the reason.
Kling 4.0 API FAQ
How do I pass keyframes?+
On kling-4-i2v send first_frame_url, optional keyframe_urls (up to 8) and optional last_frame_url, and mention them in the prompt as @first_frame, @keyframe_1 and @last_frame. The total number of frames can't exceed 10 or the duration plus one.
Are reference videos billed?+
Yes. On kling-4-ref2v, reference clips (up to 30 seconds combined) add their seconds to the price at some providers. The submit response returns the credit estimate for your exact request, and ?dryRun=1 prices it without running.
Is this the official Kling API?+
No. Scenetra routes each call to a provider that serves Kling 4.0 (the same model and output) and bills you in Scenetra credits from one balance.
How much does the Kling 4.0 API cost?+
As of November 4, 2026, Kling 4.0 costs from $0.12 per second on Scenetra, billed at provider cost with no markup. Each run is priced across 12 providers and runs on the cheapest one that supports your settings. Rates: 720p $0.12/s; 1080p $0.19/s. With default settings (720p, 5 seconds), a text to video run is estimated at about 600 credits. The submit response returns the estimate for your exact settings, and adding ?dryRun=1 prices a request without running it.
Which provider runs my request?+
The cheapest one that supports your settings, chosen per request. There is no provider parameter: the same Kling 4.0 request is priced across every provider we route to and runs on the lowest quote.
Do failed generations cost credits?+
No. Credits are reserved when you submit and refunded automatically if the run fails. A failed run is not an HTTP error: polling returns status FAILED with the reason.
Do I have to poll, or can I get a webhook?+
Both work. Pass callbackUrl and we POST the final run status to it when the run completes or fails. Delivery is best-effort, so polling GET /api/v1/runs/{runId} remains the source of truth.