PromptFlow AI
API docs

kling-4.0-flash

Kling 4.0 Flash — Generate AI videos with realistic physics & vivid character expressions using Kling 4.0 Flash — smooth cinematic camera control, supports uploading reference images, integrated natural sound & effects.

SV21 (sv21) · healthyid: kling-4.0-flashtype: videooutput: video1.13 credits
Available packages & servers (SV) for model kling-4.0-flashGET /api/v1/models/kling-4.0-flash/servers

Detailed API pricing by parameter configuration

Actual unit price (credits) deducted from your wallet when calling POST /v1/generations (or check it in advance with POST /v1/generations/estimate).

1.13 credits
1 run:1.13 credits

Input — request parameters

POST/v1/generations

Send JSON in the standard structure "model": "kling-4.0-flash", "server": "sv21" and the parameters below at the same level. Parameters not listed in the table are rejected (400).

ParameterTypeSupported valuesDescription
modelrequiredstringkling-4.0-flashThe package ID itself or the canonical model line ID (combined with the server selection parameter below).
serverstringsv21autoPins the server (SV) that runs the order (the alias server_id is also accepted), or auto to pick the best-priced healthy server automatically. Check live servers via GET /v1/models/kling-4.0-flash/servers.
promptrequiredstring

Up to 5,000 characters

Prompt
p_moderequiredenum
image-to-videotext-to-video

Default: image-to-video

Mode — Set “Mode” for the generation request.
p_aspect_ratiorequiredenum
21:916:99:161:1auto

Default: 21:9

Aspect ratio — Choose landscape, portrait, or square based on where you post.
p_durationrequiredenum
34567891011121314151617181920

Default: 3

Duration (seconds) — Length of video or audio in seconds.
p_start_image_urlstring (URL image)
First frame — Opening frame and starting point of motion.

Only applies when p_mode ∈ image-to-video

upscale4kenum
goc4k

Default: goc

Resolution — Select 4K: model runs at highest resolution, then video auto-upscales to 4K (takes a few extra minutes); price = highest model price + 4K video upscaling price. If the 4K upscale step fails, the 4K fee is refunded and the original video is still delivered.
  • File parameters (string URL) accept a public http(s) link — the server downloads it — or a URL returned by the file upload API POST /account/ai/uploads.
  • Optional parameters left blank use their default values. You can also send an Idempotency-Key header to retry safely without being charged twice.

Sample request (cURL)

curl -X POST https://promptflow.web.id/api/v1/generations \
  -H "X-API-Key: $API_KEY" -H "Content-Type: application/json" \
  -d '{
  "model": "kling-4.0-flash",
  "server": "sv21",
  "prompt": "An astronaut cat",
  "p_mode": "image-to-video",
  "p_aspect_ratio": "21:9",
  "p_duration": "3",
  "upscale4k": "goc"
}'

Complete integration code sample (Upload file → Create job → Poll result)

Python 3

import os, time, requests

BASE = "https://promptflow.web.id/api"
HEADERS = {"X-API-Key": os.environ["API_KEY"]}

r = requests.post(f"{BASE}/v1/generations", headers=HEADERS, json={
    "model": "kling-4.0-flash",
    "server": "sv21",
    "prompt": "An astronaut cat",
    "p_mode": "image-to-video",
    "p_aspect_ratio": "21:9",
    "p_duration": "3",
    "upscale4k": "goc"
}, timeout=60)
gen = r.json()
if not r.ok:
    raise RuntimeError(gen.get("message") or r.text)

while gen.get("status") in ("queued", "processing"):
    time.sleep(5)
    gen = requests.get(f"{BASE}/v1/generations/{gen['id']}", headers=HEADERS, timeout=60).json()

if gen.get("status") != "succeeded":
    raise RuntimeError(gen.get("error") or gen.get("status"))
print("Result:", gen["output"])

Node.js (18+)

const BASE = "https://promptflow.web.id/api";
const headers = { "X-API-Key": process.env.API_KEY, "Content-Type": "application/json" };

const createRes = await fetch(`${BASE}/v1/generations`, {
  method: "POST",
  headers,
  body: JSON.stringify({
  "model": "kling-4.0-flash",
  "server": "sv21",
  "prompt": "An astronaut cat",
  "p_mode": "image-to-video",
  "p_aspect_ratio": "21:9",
  "p_duration": "3",
  "upscale4k": "goc"
}),
});
let gen = await createRes.json();
if (!createRes.ok) throw new Error(gen.message || createRes.statusText);

while (["queued", "processing"].includes(gen.status)) {
  await new Promise((r) => setTimeout(r, 5000));
  gen = await fetch(`${BASE}/v1/generations/${gen.id}`, { headers }).then((r) => r.json());
}
if (gen.status !== "succeeded") throw new Error(gen.error ?? gen.status);
console.log("Result:", gen.output);

Output — response

Jobs run asynchronously. POST /v1/generations immediately returns a generation object with status queued or processing; poll GET /v1/generations/{id} every 5–10 seconds until status is succeeded, failed or cancelled.

GET/v1/generations/{id}
{
  "id": "3f1c...-uuid",
  "object": "generation",
  "code": "T8KQ2M4X",
  "model": "kling-4.0-flash",
  "canonical_model": "kling-4.0-flash",
  "server_id": "sv21",
  "server_name": "SV21",
  "status": "succeeded",       // queued | processing | succeeded | failed | cancelled
  "progress": 100,
  "cost": 2400,                // amount charged
  "currency": "CREDITS",
  "refunded": false,
  "output": {
    "type": "video",
    "files": [{ "url": "https://promptflow.web.id/uploads/ai/outputs/....mp4", "type": "video", "name": "video.mp4" }],
    "text": null
  },
  "error": null,
  "created_at": "2026-10-30T08:00:00.000Z",
  "completed_at": "2026-10-30T08:01:12.000Z"
}
FieldMeaning
model / server_idThe exact package ID and server (SV) that executed the task.
output.files[].urlResult file links — download them to your own system; files on our server may be cleaned up after some time.
output.textText content (only for models that return text).
costAmount in credits charged to your balance; refunded automatically on failure or cancellation (refunded = true).
errorError reason when status = failed.

Get a quote before running

POST/v1/generations/estimate

Same body as POST /v1/generations, without running or charging (your account's personal discount %, if any, is applied automatically).

# => {
#   "object": "estimate",
#   "model": "kling-4.0-flash",
#   "canonical_model": "kling-4.0-flash",
#   "server_id": "sv21",
#   "server_name": "SV21",
#   "cost": 2400,
#   "currency": "CREDITS"
# }
Get an API key
kling-4.0-flash · API docs | PromptFlow AI