Kling 4 APIAvailability & integration guide
Check the model version, key provider and supported parameters before integrating video generation. This guide tracks Kling 4.0 access on this site and provides current Kling 3.0 provider examples.
Status checked: 2026-10-05 · By kling4.io editors · Independent third-party guide
Is the Kling 4 API available here?
Kling 4.0 API is not connected on this site
The online generator currently uses Kling 3.0 and Kling 3.0 Turbo. Official 4.0 demos and announced features do not establish that this site offers a callable 4.0 endpoint. When connected, the parameters, pricing and examples will be updated for the actual model.
| Access route | Key & billing | Current use |
|---|---|---|
| Official Kling platform | Official account & key | Check official versions, access and documentation |
| KIE API | Your own KIE key & provider balance | Examples below call Kling 3.0 directly |
| kling4.io | Site account & credits | Online generation; no verified public Kling developer endpoint yet |
Quickstart: the current Kling 3.0 API
These examples call KIE directly with your own KIE API key and consume provider credits. They do not call kling4.io or spend site credits. Keep the key on your server.
- 1.Prepare a KIE key & balance
- 2.Submit once and save taskId
- 3.Poll about every 5s, then download
# KIE provider API: use your own KIE key, not a kling4.io key.
# Submitting a generation consumes provider credits.
curl --fail-with-body https://api.kie.ai/api/v1/jobs/createTask \
-H "Authorization: Bearer $KIE_API_KEY" \
-H "Content-Type: application/json" \
--data '{
"model": "kling-3.0/video",
"input": {
"prompt": "One continuous shot of a ceramic cup on a wooden table. Soft morning light from the left. A slow camera push-in as a thin ribbon of steam rises. Quiet room tone, no speech or text.",
"mode": "std",
"duration": "5",
"sound": true,
"multi_shots": false,
"aspect_ratio": "16:9"
}
}'
# Copy data.taskId from the response; poll about every 5 seconds.
curl --fail-with-body \
'https://api.kie.ai/api/v1/jobs/recordInfo?taskId=YOUR_TASK_ID' \
-H "Authorization: Bearer $KIE_API_KEY"
# When data.state is success, parse data.resultJson (a JSON string).
# Download the URL in resultUrls[0] before the provider link expires.
curl --fail --location 'VIDEO_URL_FROM_RESULT' --output kling-video.mp4// Node.js 18+. Set KIE_API_KEY in your server environment.
// This calls KIE directly and consumes KIE credits.
const apiKey = process.env.KIE_API_KEY;
if (!apiKey) throw new Error("Set KIE_API_KEY first");
const base = "https://api.kie.ai/api/v1/jobs";
const headers = {
Authorization: "Bearer " + apiKey,
"Content-Type": "application/json",
};
async function request(url, options = {}) {
const response = await fetch(url, {
...options, headers, signal: AbortSignal.timeout(30000),
});
const json = await response.json();
if (!response.ok || json.code !== 200) {
throw new Error(json.msg || "Provider request failed");
}
return json.data;
}
// Submit once. An unknown POST outcome may already have created a paid job.
const created = await request(base + "/createTask", {
method: "POST", body: JSON.stringify({
"model": "kling-3.0/video",
"input": {
"prompt": "One continuous shot of a ceramic cup on a wooden table. Soft morning light from the left. A slow camera push-in as a thin ribbon of steam rises. Quiet room tone, no speech or text.",
"mode": "std",
"duration": "5",
"sound": true,
"multi_shots": false,
"aspect_ratio": "16:9"
}
}),
});
if (!created.taskId) throw new Error("Missing taskId");
console.log("Save this task ID:", created.taskId);
let videoUrl;
for (let attempt = 0; attempt < 180; attempt++) {
await new Promise(resolve => setTimeout(resolve, 5000));
const task = await request(base + "/recordInfo?taskId=" +
encodeURIComponent(created.taskId));
if (task.state === "fail") throw new Error(task.failMsg || "Generation failed");
if (task.state === "success") {
videoUrl = JSON.parse(task.resultJson || "{}").resultUrls?.[0];
if (!videoUrl) throw new Error("Missing result URL");
break;
}
}
if (!videoUrl) throw new Error("Still processing. Resume polling the saved task ID.");
console.log(videoUrl);# Python 3.9+. Uses only the standard library.
# Calls KIE directly and consumes provider credits.
import json, os, time, urllib.request
key = os.environ["KIE_API_KEY"]
base = "https://api.kie.ai/api/v1/jobs"
def request(path, body=None):
data = json.dumps(body).encode() if body is not None else None
req = urllib.request.Request(base + path, data=data, headers={
"Authorization": "Bearer " + key,
"Content-Type": "application/json",
})
with urllib.request.urlopen(req, timeout=30) as response:
result = json.load(response)
if result.get("code") != 200:
raise RuntimeError(result.get("msg", "Provider request failed"))
return result["data"]
# Submit once; do not blindly retry a timed-out creation request.
payload = json.loads(r'''{
"model": "kling-3.0/video",
"input": {
"prompt": "One continuous shot of a ceramic cup on a wooden table. Soft morning light from the left. A slow camera push-in as a thin ribbon of steam rises. Quiet room tone, no speech or text.",
"mode": "std",
"duration": "5",
"sound": true,
"multi_shots": false,
"aspect_ratio": "16:9"
}
}''')
created = request("/createTask", payload)
task_id = created["taskId"]
print("Save this task ID:", task_id)
for attempt in range(180):
time.sleep(5)
task = request("/recordInfo?taskId=" + task_id)
if task["state"] == "fail":
raise RuntimeError(task.get("failMsg") or "Generation failed")
if task["state"] == "success":
urls = json.loads(task.get("resultJson") or "{}").get("resultUrls", [])
if not urls:
raise RuntimeError("Missing result URL")
print(urls[0])
break
else:
raise TimeoutError("Resume polling the saved task ID; do not resubmit")Documentation: KIE Kling 3.0 · Task query
Models & request parameters
This table describes the Kling 3.0 example above. Do not replace its model ID with a guessed kling-4 string; a new model requires checking the complete request contract.
| Parameter | Value / type | Notes |
|---|---|---|
| model | kling-3.0/video | This example calls Kling 3.0, not Kling 4.0. |
| input.prompt | string | Describe subject, action, camera and sound; this integration caps prompts at 2,500 characters. |
| input.duration | "3" … "15" | Pass seconds as a string, for example "5". |
| input.mode | std / pro | std selects 720p; pro selects 1080p. |
| input.aspect_ratio | 16:9 / 9:16 / 1:1 | Text-to-video only. Omit for image-to-video; the image defines the frame. |
| input.image_urls | HTTPS URL[] | For image-to-video, supply a start image and optionally an end image. The example has no images. |
| input.sound | true / false | Audio switch for Kling 3.0. Turbo always has audio and does not use this field. |
| input.multi_shots | false | This example disables multi-shot mode, matching the site generator. |
Turbo uses kling/v3-turbo-text-to-video or kling/v3-turbo-image-to-video. It takes resolution, always renders audio, and accepts only a start frame for image-to-video. Read the Turbo reference
Task states & results
Read data.taskId after creation. A successful HTTP status query does not mean the video is complete; inspect data.state.
- waiting / queuing / generating
- Not finished. Keep the task ID and continue polling.
- success
- Parse the JSON string data.resultJson, read resultUrls and download promptly.
- fail
- Read failMsg and follow the provider’s failure and billing rules.
Pricing, duration & limits
Site credit plans apply to online generation here. Direct provider calls follow the provider’s current model, quality, audio and duration pricing. There is no verified Kling 4.0 API price for this site yet.
- The current integration supports 3–15s and 720p / 1080p. Do not apply announced 4.0 limits to this endpoint.
- Confirm model capabilities before setting retries, concurrency and a cost ceiling.
- Provider failure charging and refunds follow its own documentation.
API questions & troubleshooting
Authentication fails
Use the provider’s own key. Official Kling keys, KIE keys and this site’s account credentials are not interchangeable.
Parameters are rejected
Check the model ID, string duration and std/pro tier. Do not send aspect_ratio with image-to-video.
A request times out
A creation request may already have succeeded; check provider task history first. Resume status queries with the same task ID.
Generation fails
Read failMsg and check accessible media and content restrictions. Provider charging and refunds follow the provider’s rules.
The task keeps processing
Save taskId and resume polling later. A long wait is not a reason to submit another paid task.
Start with a clearly directed prompt
Refine the scene and timing in the online generator before integrating a workflow into your app.