DEV Community

useapi.net
useapi.net

Posted on • Originally published at useapi.net

How to Generate AI Video with Kling v3 via the Kling API

Introduction

Kling AI is rated by independent text-to-video leaderboards among the strongest models for prompt adherence and motion realism — and you can drive every Kling model from code against your own account. Kling AI is the generative video service from Chinese short-video giant Kuaishou Technology, and useapi.net fronts it with a third-party Kling API that runs your own Kling account over a standard REST endpoint — no enterprise contract, no per-call billing from us.

Supported models

Pick a model per request with the model_name field on POST /videos/text2video. kling-v1-6 is the default. Capabilities differ by version:

Model Durations Modes / resolution Audio
kling-v3-0 3–15s std 720p · pro 1080p · 4k 4K Default on
kling-v3-0-turbo 3–15s std 720p · pro 1080p Always on
kling-v2-6 5 / 10s std 720p · pro 1080p Native Audio (pro)
kling-v2-5 5 / 10s pro 1080p only Sound effects
kling-v2-1-master 5 / 10s pro 1080p only Sound effects
kling-v1-6 (default) 5 / 10s std 720p · pro 1080p Sound effects
kling-v1-5 5 / 10s std 720p · pro 1080p Sound effects

Model v3-0 is the most capable: it adds 4k mode and audio on by default. Model v3-0-turbo is the faster v3 — it keeps v3.0 quality with shorter generation times, audio always on, and std/pro modes (no 4k). Model 2.6 produces Native Audio, but only in pro mode. The negative_prompt and cfg_scale parameters apply only to the 1.x models — 2.5, 2.6, and 3.0 do not support negative_prompt, and cfg_scale is a 1.x-only control. The same account and token also drive Kling's multi-shot storytelling, Video Elements, Avatars, and lip-sync — see the Kling API overview for the full lineup.

Pricing

You keep your normal Kling website subscription for the underlying account — Kling starts with a free tier and a $10/month Standard plan — and add a single flat $15/month to useapi.net that covers API access to every supported service, with no per-generation surcharge from us. Generations draw from your Kling account's own credit balance at Kling's standard rates, which vary by model, mode, duration, and audio. The Kling API overview has a live cost calculator that maps each model and mode to its credit cost for your plan.

This is the consumer-account route. Kuaishou's official Kling API bills per generation at developer rates on a separate developer account, while useapi.net automates the consumer account you already pay for at the website subscription price.

Generate a video in two API calls

You need a useapi.net API token and a connected Kling account — export the token so the curl examples below run as-is:

export USEAPI_TOKEN="user:1234-..."
Enter fullscreen mode Exit fullscreen mode

Generation is asynchronous — the create call returns a task object immediately, then you poll until the video is ready.

1. Submit the jobPOST https://api.useapi.net/v1/kling/videos/text2video:

curl -X POST "https://api.useapi.net/v1/kling/videos/text2video" \
  -H "Authorization: Bearer $USEAPI_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "A majestic mountain landscape with snow-capped peaks and flowing rivers, camera slowly panning right",
    "model_name": "kling-v3-0",
    "aspect_ratio": "16:9",
    "mode": "pro",
    "duration": "5"
  }'
Enter fullscreen mode Exit fullscreen mode

The response returns immediately with a task object. The task id you poll on is task.id (a number):

{
  "task": {
    "id": 123456789,
    "type": "m2v_aio2video",
    "status": 5,
    "status_name": "submitted",
    "status_final": false
  },
  "works": [],
  "status": 5,
  "status_name": "submitted",
  "status_final": false,
  "message": ""
}
Enter fullscreen mode Exit fullscreen mode

The email field is required in the body only when you have more than one Kling account configured. A 500 from Kling almost always means a content-moderation rejection rather than a server fault — read the error text (the message field is generic and often misleading) to tell them apart.

2. Poll for the resultGET https://api.useapi.net/v1/kling/tasks/{task_id}:

curl "https://api.useapi.net/v1/kling/tasks/123456789?email=user@example.com" \
  -H "Authorization: Bearer $USEAPI_TOKEN"
Enter fullscreen mode Exit fullscreen mode

The task is done when status_final is true. Success is status_name: "succeed" (status: 99); the MP4 is in works[0].resource.resource:

{
  "status": 99,
  "status_name": "succeed",
  "status_final": true,
  "works": [
    {
      "workId": 123456789,
      "status_name": "succeed",
      "resource": {
        "resource": "https://s21-kling.klingai.com/....mp4",
        "height": 1268,
        "width": 724,
        "duration": 5041
      }
    }
  ]
}
Enter fullscreen mode Exit fullscreen mode

The MP4 at works[0].resource.resource is watermarked. To get the clean, non-watermarked master, take the workId from the works array and call GET /assets/download — it returns a cdnUrl to the file (a single workId plus a single fileTypes value yields a direct MP4 link, otherwise a .zip):

curl "https://api.useapi.net/v1/kling/assets/download?email=user@example.com&workIds=123456789&fileTypes=MP4" \
  -H "Authorization: Bearer $USEAPI_TOKEN"
Enter fullscreen mode Exit fullscreen mode

A video typically finishes in a few minutes depending on model, mode, and duration — std is faster than pro or 4k. Prefer not to poll? Pass a replyUrl in the create body to receive a webhook callback when the task completes. On the poll, a 404 means the task was deleted, failed at moderation, or your Kling account ran out of credits — check your balance at GET /accounts/email. The terminal failure statuses are 6, 7, 9, 50, 53, 54, and 58 (all status_final: true); see GET /tasks/task_id for what each one means.

Image-to-video

To animate a still image, use POST /videos/image2video-frames. Upload your image first with POST /assets, then pass the returned URL as image (the start frame) and optionally image_tail (the end frame, for a start→end transition):

curl -X POST "https://api.useapi.net/v1/kling/videos/image2video-frames" \
  -H "Authorization: Bearer $USEAPI_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "image": "https://example.com/start-frame.jpg",
    "image_tail": "https://example.com/end-frame.jpg",
    "prompt": "the character turns and smiles, camera pushes in",
    "model_name": "kling-v2-5",
    "mode": "pro"
  }'
Enter fullscreen mode Exit fullscreen mode

At least one of image or image_tail is required. On kling-v3-0 / kling-v3-0-turbo the aspect ratio is derived from the input image, so there is no aspect_ratio parameter — and kling-v3-0-turbo supports the start frame only (no image_tail). The response is the same task object as text-to-video, and you poll and download it exactly the same way (with GET /assets/download for the clean master).

Batch-generate with a script

Finding the right shot takes many attempts, and running them by hand is tedious. The Node.js script reads a list of prompts from prompts.json, submits each text-to-video job, then polls every task until it is final and downloads the finished MP4 — preferring the clean, non-watermarked master via GET /assets/download and falling back to the watermarked works[0].resource.resource if needed. So you can queue a batch and come back to the winners.

You need Node.js v21 or newer. Put prompts.json and kling.mjs in the same folder and run node ./kling.mjs API_TOKEN EMAIL, where API_TOKEN is your useapi.net API token and EMAIL is your connected Kling account email. The script looks the account up by email automatically.

Examples

The clip below is a real Kling generation produced through this Kling API, straight from our blog walkthrough.

Kling v3 Turbo — kling-v3-0-turbo, image-to-video, 1080p 10s with spoken dialogue and scene cuts

— from Kling 3.0 Turbo: faster video with dialogue and scene changes

Frequently asked questions

Is there a Kling API? Yes — a few ways. Kuaishou offers an official Kling developer API, and third-party resellers (fal.ai, Replicate, PiAPI, and others) expose Kling too, all billed per generation at developer rates. useapi.net is the consumer-account route: programmatic access to every Kling model by driving your own Kling account at the website subscription price through a standard REST endpoint.

How do I access Kling v3 (and v3 Turbo) through the API? Pass "model_name": "kling-v3-0" (or "kling-v3-0-turbo" for the faster variant) to POST /videos/text2video or POST /videos/image2video-frames. Kling v3 supports 3–15s durations, std/pro/4k modes, and audio on by default. See Supported models above.

Can I turn an image into a video (image-to-video)? Yes. Upload the still with POST /assets, then pass the returned URL as image (start frame) and optionally image_tail (end frame) to POST /videos/image2video-frames. See Image-to-video above.

How much does the Kling API cost? You keep your normal Kling website subscription, plus a flat $15/month to useapi.net for API access to all services. Generations draw from your Kling account's own credits at Kling's standard rates, which vary by model, mode, duration, and audio — the Kling API overview has a live cost calculator. See Pricing above.

Why is my video watermarked? The MP4 at works[0].resource.resource returned by the poll is the watermarked preview. To get the clean, non-watermarked master, take the workId from the task's works array and call GET /assets/download — it returns a cdnUrl to the watermark-free file. This requires a paid Kling account. See Generate a video in two API calls above.

How is this different from the official Kling API? Kuaishou's official Kling API bills per generation at developer rates on a separate developer account. useapi.net instead automates your own consumer Kling account, so you generate at the website subscription price plus a flat $15/month — and the same one subscription covers 10+ other AI services.

My generation returns a 500 — what does that mean? Kling reuses the 500 response for content-moderation rejections as well as genuine server faults, and the generic message field rarely makes the difference clear. Read the error text instead — a moderation rejection reads like "The content you uploaded appears to violate the community guidelines." If a job clears creation but the poll later returns 404, the task was deleted, failed at moderation, or your account ran out of credits.

Conclusion

Visit our Discord Server or Telegram Channel for any support questions and concerns.

We regularly post guides and tutorials on the YouTube Channel.

The full runnable example is in the kling-api GitHub repo.

Cross posted

Top comments (0)