Guide

How to use the Kling API: Python, curl, parameters and cost per second

Prices checked Nov 26, 2026 · 4 min read

How to use the Kling API: a long video clip priced per second

To use the Kling API, send one POST /v1/tasks with model set to kling-4-0, a prompt, a duration and a resolution. Then poll GET /v1/tasks/{id} or pass a callback_url. When the task succeeds, output.urls holds the video. You use one TapModels key, not a Kling key. Kling 4.0 costs $0.1425 per second at 720p, $0.2125 at 1080p and $0.495 at 4K.

No Kling account or API key needed

People search "kling ai api key" because Kling's own access needs its own account. With TapModels you create one key in the dashboard and use it for every model. Keys can carry a spend_limit_credits and an allowed_models list, so a key for a Kling script can be limited to kling-4-0 and a fixed budget. A request to a model outside the list gets 403 model_not_allowed.

The request

Video is asynchronous. The base URL is https://api.tapmodels.com/v1 and auth is Authorization: Bearer sk_live_....

{
  "model": "kling-4-0",
  "input": {
    "prompt": "A skateboarder lands a kickflip in an empty plaza at golden hour, low camera",
    "duration": "10",
    "resolution": "1080p",
    "aspect_ratio": "16:9",
    "audio": true
  },
  "callback_url": "https://your.app/hooks/tapmodels"
}

The reply is 202 { "id": "task_...", "status": "queued", "estimated_credits": 212.5 }. That is 10 seconds x 21.25 credits.

Parameters and valid values

FieldRequiredValid valuesDefault
promptyesThe shot, the motion and the cameranone
image_urlnoFirst frame; turns the request into image to videonone
durationno5, 10, 15, 30 (seconds)5
resolutionno720p, 1080p, 4K720p
aspect_rationo16:9, 9:16, 1:116:9
audionotrue, falsetrue

Kling 4.0 is described as a long-form model with native stereo audio. If a field is outside the list above, the call returns 422 invalid_input and names the field. The live schema is at GET /v1/models/kling-4-0.

Python example

Searches for "kling api python" want a runnable script. This one needs only requests.

import os, time, requests

BASE = "https://api.tapmodels.com/v1"
H = {"Authorization": f"Bearer {os.environ['TAPMODELS_API_KEY']}"}

r = requests.post(f"{BASE}/tasks", headers=H, json={
    "model": "kling-4-0",
    "input": {
        "prompt": "A skateboarder lands a kickflip in an empty plaza at golden hour",
        "duration": "10", "resolution": "1080p",
    },
})
r.raise_for_status()
task = r.json()
print("will hold", task["estimated_credits"], "credits")

while task["status"] in ("queued", "running"):
    time.sleep(5)
    task = requests.get(f"{BASE}/tasks/{task['id']}", headers=H).json()

if task["status"] == "succeeded":
    print(task["output"]["urls"], "charged", task["credits_charged"])
else:
    print("failed:", task["error"], "charged", task["credits_charged"])

Curl example

curl https://api.tapmodels.com/v1/tasks \
  -H "Authorization: Bearer $TAPMODELS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"kling-4-0","input":{"prompt":"A skateboarder lands a kickflip at golden hour","duration":"10","resolution":"1080p"}}'

curl https://api.tapmodels.com/v1/tasks/task_123 \
  -H "Authorization: Bearer $TAPMODELS_API_KEY"

For image to video, upload the first frame with POST /v1/files and pass the returned URL as image_url. Uploaded and output files are kept for 14 days.

Kling API cost per second

Kling 4.0 is priced per second of video. List price is the provider's published rate as recorded in our catalog on 2026-11-26.

ResolutionTapModels per secondList per second10 second clip30 second clip
720p$0.1425$0.157$1.425$4.275
1080p$0.2125$0.235$2.125$6.375
4K$0.495$0.549$4.95$14.85

Worked example: a 15 second 720p ad draft costs 15 x $0.1425 = $2.1375, which is 213.75 credits. At list price it is 15 x $0.157 = $2.355. The same 15 seconds at 1080p is 15 x $0.2125 = $3.1875. Four 1080p variants of that clip cost 4 x $3.1875 = $12.75.

Because the price scales with length, draft at 5 seconds and 720p, then rerun the winner longer. A 5 second 720p draft costs 5 x $0.1425 = $0.7125.

Common errors

HTTPCodeWhat to do
401unauthorizedCheck the key is present and not revoked
402insufficient_creditsBalance minus held credits is below the estimate
402key_limit_reachedThe key's spend limit would be exceeded
403model_not_allowedThe key's allowed_models excludes kling-4-0
422invalid_inputA field is outside the valid values above
429rate_limitedWait for Retry-After, then retry
task failedupstream_errorResubmit: 0 credits were charged

Credits are held at submit and charged only on success. The default limit is 20 new tasks per 10 seconds per account.

Next step: compare per-second prices across video models in Veo vs Kling, or read the Kling pricing page.

Frequently asked questions

How do I use the Kling API?

Send POST /v1/tasks with model kling-4-0 and an input object with a prompt, a duration of 5, 10, 15 or 30 seconds and a resolution. Poll GET /v1/tasks/{id} or pass a callback_url. When the task succeeds, output.urls holds the video file.

Do I need a Kling API key?

Not through TapModels. You use one TapModels key, created in the dashboard, for Kling and every other model. You do not sign up with Kling, and its keys do not work on our endpoint. A key can have a spend limit and an allowed models list.

How much does the Kling API cost?

Kling 4.0 on TapModels costs $0.1425 per second at 720p, $0.2125 at 1080p and $0.495 at 4K. A 10 second 1080p clip is 10 x $0.2125 = $2.125. You pay per second of video, so shorter clips cost proportionally less.

Is there a Kling 3.0 API?

Our catalog lists Kling 4.0, and it is the Kling model we sell. We do not list a Kling 3.0 model, so for Kling through our API use model id kling-4-0. Check GET /v1/models for the current list before you build.

Sources