A Kling video request is not a single universal API call. Kling, Kuaishou's video-generation model, is exposed through the official Open Platform and aggregators such as WaveSpeedAI, KIE, and fal, each with different credentials, model IDs, request envelopes, and billing. The stable part is the async workflow: submit a job, store its ID, wait for a terminal status, and fetch the output without unchecked retries.
Start with the route, not the SDK
Kling maintains an official Open Platform, but “Kling API” search results also contain independent gateways. Choose the route based on vendor access, integration speed, and billing control, not on the model name alone.
| Route | Authentication shape | Job pattern | Best fit | Main trade-off |
|---|---|---|---|---|
| Kling Open Platform | Use the credentials and schema in Kling’s current developer docs | Follow the official task flow | Direct Kuaishou relationship and first-party access | Onboarding, pricing, and concurrency rules must be checked in the official account |
| WaveSpeedAI | Authorization: Bearer <key> | POST prediction, then GET result | A plain REST integration across many models | WaveSpeed’s endpoint IDs, prices, and limits apply |
| KIE | Authorization: Bearer <token> | createTask, then callback or task query | Kling 3.0 multi-shot and named elements | KIE’s task envelope is not interchangeable with WaveSpeed or fal |
| fal | Authorization: Key $FAL_KEY or fal SDK | Queue submission and result retrieval | SDK users who want queue helpers and model-specific schemas | Endpoint IDs and queue behavior are fal-specific |
For price-by-resolution details, use the existing Kling 3 API pricing guide; here, treat price, audio multipliers, concurrency, and failed-task billing as provider-specific configuration.
Official Kling flow
Use the official Open Platform when procurement requires a direct Kuaishou relationship or you need first-party model availability. The current official docs separate credential setup, task creation, callbacks, concurrency rules, and error codes, so follow that route rather than adapting an aggregator payload:
- Create or retrieve the official credential in the authentication guide, then keep the token server-side.
- Submit the documented asynchronous video task with the model-specific endpoint and request fields shown in the official reference.
- Add
callback_urlwhen you want status pushes. The documented callback states includesubmitted,processing,succeed, andfailed; storetask_status_msgfor failures. - Enforce the account’s current concurrency allocation locally. The official concurrency guide describes overload as HTTP
429with business code1303, not as work that Kling will necessarily queue for you. - Use the official error-code reference to distinguish bad credentials, invalid parameters, depleted resources, policy blocks, and retryable server failures.
The official authentication page is client-rendered in the accessible version of the docs, so this guide does not reproduce an unverified token-generation snippet. Copy the current credential format from that page instead of assuming that a WaveSpeed, KIE, or fal header works.
The official lifecycle can still be normalized without guessing its exact payload:
official_credential = get_from_kling_console()
task = POST official_model_endpoint(official_credential, documented_input)
store(task.task_id)
wait_for_callback_or_query_status(task.task_id)
if status == "succeed": save_output(task_result.videos)
else: classify(http_status, business_code, task_status_msg)
This is a lifecycle sketch, not a copy-paste endpoint. Use the linked official reference for the exact token, path, request fields, and response envelope.
When an aggregator is the better fit
Aggregators are faster for prototypes that need pay-as-you-go access, one account for several models, or a provider SDK, but they control the key, schema, queue, output URL, and sometimes retention. Classify the failing layer before retrying.
The Kling API contract you can safely standardize
A production client should hide provider-specific details behind one internal function. Regardless of route, your application needs to perform these steps:
- Validate the prompt and media URLs before spending credits.
- Submit a video-generation task with a provider-specific model ID.
- Persist the returned task or prediction ID immediately.
- Receive a callback or poll a result endpoint until the job reaches a terminal state.
- Save the output URL, provider, model, parameters, and cost metadata.
- Stop retrying when the provider reports failure, cancellation, timeout, or deletion.
The abstraction should return your own normalized object, for example:
{
"provider": "wavespeed",
"job_id": "provider-job-id",
"status": "queued",
"output_url": null,
"error": null
}
The parameters that travel well
| Concept | Common Kling use | Example values |
|---|---|---|
| Prompt | Describe subject, action, camera, lighting, and atmosphere | A slow dolly toward a rain-soaked neon street |
| Duration | Select the clip length | 3, 5, 10, or 15 seconds, depending on the endpoint |
| Aspect ratio | Match the destination platform | 16:9, 9:16, 1:1 |
| Audio or sound | Enable native sound where the route supports it | true / false or sound |
| Start image | Animate a supplied first frame | Public image URL |
| End image | Guide the final frame where supported | Public image URL |
| Negative prompt | Exclude blur, distortion, or unwanted objects | A provider-specific string field |
| Multi-shot prompt | Break a longer idea into several shots | An array of prompt-duration objects |
| Mode or tier | Trade iteration cost against quality | std, pro, or a provider-specific tier |
The concepts travel well; the field names do not. generate_audio, sound, and generate_audio: true can describe related behavior on different services. Treat each provider schema as a separate adapter.
The parameters that do not travel well
Model IDs are the first trap. kling-3.0, kling-3.0/video, fal-ai/kling-video/v3/standard/text-to-video, and kwaivgi/kling-v3.0-std/text-to-video identify different API routes, not interchangeable values.
The same applies to authentication headers, callback names, result URLs, task-status values, and file-upload rules. A client that hard-codes one provider’s status string—such as completed—can misclassify another provider’s succeeded or failed response.
Three real request shapes
These provider-specific examples show why one universal Kling endpoint does not exist.
WaveSpeedAI: prediction ID plus result polling
WaveSpeedAI documents Kling 3.0 Standard text-to-video at this endpoint:
POST https://api.wavespeed.ai/api/v3/kwaivgi/kling-v3.0-std/text-to-video
The request uses a Bearer token. The endpoint returns a prediction ID, and the result is read from:
GET https://api.wavespeed.ai/api/v3/predictions/{prediction_id}/result
A minimal cURL flow is:
export WAVESPEED_API_KEY="replace_me"
submit=$(curl --fail-with-body -s \
-X POST \
"https://api.wavespeed.ai/api/v3/kwaivgi/kling-v3.0-std/text-to-video" \
-H "Authorization: Bearer $WAVESPEED_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "A cinematic sunrise over a futuristic cityscape",
"duration": 5,
"aspect_ratio": "16:9",
"cfg_scale": 0.5,
"shot_type": "customize"
}')
prediction_id=$(printf '%s' "$submit" | jq -r '.data.id // .id')
curl -s \
"https://api.wavespeed.ai/api/v3/predictions/$prediction_id/result" \
-H "Authorization: Bearer $WAVESPEED_API_KEY"
WaveSpeedAI’s model documentation lists a 3–15 second range, 16:9, 9:16, and 1:1 ratios, and a cfg_scale default of 0.5. Its Standard pricing table shows $0.42 for a 5-second clip without sound and $0.63 with sound; treat those figures as a provider snapshot, not a universal Kling price.
For production, poll the result endpoint with backoff rather than issuing requests in a tight loop. Stop on completed, failed, cancelled, timeout, or deleted, which are the terminal statuses documented for this endpoint.
KIE: createTask plus callback or task query
KIE uses a shared task-creation endpoint:
POST https://api.kie.ai/api/v1/jobs/createTask
The Kling 3.0 model identifier is kling-3.0/video, and authentication uses a Bearer token. A compact single-shot payload looks like this:
{
"model": "kling-3.0/video",
"callBackUrl": "https://example.com/webhooks/kie",
"input": {
"prompt": "A paper boat moving across a sunlit stream, gentle camera push-in",
"duration": "5",
"aspect_ratio": "16:9",
"mode": "std",
"sound": false,
"multi_shots": false
}
}
KIE documents 3–15 second videos, 16:9, 9:16, and 1:1 output ratios, and up to five shots in multi-shot mode. Multi-shot entries can specify 1–12 seconds each. Image elements use 2–4 JPG or PNG URLs, with a documented maximum of 10 MB per image; video elements use one MP4 or MOV URL up to 50 MB.
The callback is optional but recommended by KIE for production. Your webhook should verify the signature when available, acknowledge quickly, and put the task result onto a queue. Keep task-query polling as a recovery path for missed callbacks.
KIE documents separate response codes for common failures, including 401 for invalid authentication, 402 for insufficient credits, 422 for validation errors, and 429 for rate limits. Log the code and message together; a generic “Kling failed” message is not enough to decide whether a retry is safe.
fal: model endpoint plus queue client
fal exposes Kling 3.0 through model-specific endpoint IDs. For Standard text-to-video, the documented ID is:
fal-ai/kling-video/v3/standard/text-to-video
The raw API uses an Authorization: Key $FAL_KEY header. The Python and JavaScript examples use fal’s queue-aware client, which is usually simpler than writing the polling loop yourself.
import { fal } from "@fal-ai/client";
fal.config({ credentials: process.env.FAL_KEY });
const result = await fal.subscribe(
"fal-ai/kling-video/v3/standard/text-to-video",
{
input: {
prompt: "A paper boat moving across a sunlit stream, gentle camera push-in",
duration: 5,
aspect_ratio: "16:9",
generate_audio: false,
negative_prompt: "blur, distort, low quality",
cfg_scale: 0.5
},
logs: true
}
);
console.log(result.data.video.url);
fal documents a 3–15 second range, three text-to-video aspect ratios, and a cfg_scale range of 0–1 with a default of 0.5. The Standard schema says that prompt and multi_prompt are alternatives: provide one, not both. Its documented generate_audio default is true, so set it explicitly if your budget or post-production pipeline assumes silent output.
fal also documents separate IDs for image-to-video and motion-control. Do not infer those IDs by changing text-to-video in a string without checking the current model reference.
Quotas, queue time, and credit safety
There is no single public Kling quota that applies to the official platform, WaveSpeedAI, KIE, and fal. Concurrency, rate limits, credit balances, failed-task billing, and output retention belong to the route you selected. Store those values as provider configuration, not as constants named KLING_LIMIT.
A real user summarized the operational risk more precisely than a generic retry recommendation:
“Kling bills per generation with real queue latency. The thing I'd wire in first is a cost/concurrency cap, otherwise an agent that retries on a bad frame quietly burns your credits overnight.” — @ukrroot on X
Budget and concurrency guardrails
Implement these controls before allowing an agent or batch worker to call Kling:
- Maximum in-flight jobs: Set a provider-specific ceiling instead of launching one job per prompt.
- Per-job budget: Estimate duration, tier, audio, and output count before submission.
- Retry budget: Retry transport failures selectively; do not retry validation, authentication, or insufficient-credit errors.
- Job ledger: Record the provider job ID before any follow-up request so a worker restart does not submit a duplicate generation.
- Terminal-state policy: Mark failed, cancelled, timed-out, or deleted jobs as finished unless the provider explicitly says they are safe to resubmit.
- Credit alarm: Stop the queue when balance or projected spend crosses a threshold.
- Key and output safety: Keep keys server-side, rotate exposed keys immediately, and copy finished videos to durable storage.
A five-second Standard test can be cheap compared with a 15-second Pro or audio-enabled job, but “cheap” is provider-specific. Read the live model page before choosing a default tier.
What to measure before production
Track these fields for every request:
| Metric | Why it matters |
|---|---|
| Queue wait | Separates provider backlog from model inference time |
| Inference time | Helps set realistic client timeouts |
| Final status | Shows failure and cancellation rates |
| HTTP status | Separates 401, 402, 422, 429, and server errors |
| Effective cost | Includes retries, audio, and abandoned jobs |
| Output retention | Determines when you must copy the video to your own storage |
| In-flight count | Shows whether you are approaching a provider limit |
Treat latency and quotas as endpoint-specific; the public sources do not provide one cross-provider SLA.
Kling API FAQ
Does Kling have an official API?
Yes. Kling maintains an official Open Platform developer documentation area. The official route and third-party gateways are separate services, so verify current credentials, quotas, and pricing in the Kling Open Platform documentation.
Is there one universal Kling API endpoint?
No. The official platform, WaveSpeedAI, KIE, and fal use different endpoint paths, model IDs, authentication headers, and response envelopes. Build a provider adapter instead of assuming that kling-3.0 is valid everywhere.
Should I use polling or webhooks?
Use a callback or webhook for production when the provider supports it, but retain polling for local tests and missed-callback recovery. Add exponential backoff, a total wait limit, and idempotency so a late callback cannot create a duplicate record.
What duration and aspect ratios are supported?
Several current Kling 3.0 aggregator documents list 3–15 second clips and 16:9, 9:16, and 1:1 ratios. Individual endpoints can differ, so validate against the selected model page rather than treating those values as a first-party universal contract.
Does enabling audio change cost?
Usually it can. WaveSpeedAI documents a 1.5× sound multiplier for its Kling 3.0 Standard endpoint, while fal and KIE expose audio or sound as request parameters. Check the selected endpoint’s live billing page and set the flag explicitly.
Why did a retry create extra charges?
A retry may create a second generation even if the first job is still queued. Persist the job ID, use a concurrency cap, retry only transient failures, and reconcile provider billing before resubmitting an ambiguous request.
For the first production-like test, run one 5-second silent Standard job, log the full lifecycle, then add Pro, audio, multi-shot, or concurrency only after duplicate-worker handling works.