Skip to main content

Kling

Kling is Kuaishou’s video generation model family. Every Kling endpoint is asynchronous: submit a job, poll it until it reaches a terminal status, then download the output. The routes mirror Kling’s own API, so the request bodies, response shapes and error codes follow Kling’s documentation. You call them with your Nunchux API key and need no Kling account.

Models

std is the standard tier. It is the fastest and the most economical. pro gives sharper detail and stronger motion. 4k gives 4K-resolution output. Higher tiers take longer. Kling 4.0 uses Kling’s newer API, with its own routes and request body. It is described in Kling 4.0. The rest of this paragraph, the endpoints below and the common fields cover the V3 models. Start with kling-v3. It supports the std, pro and 4k modes. Both models can add native audio with the sound field in Common fields. Use kling-v3-omni on the omni video endpoint for multi-reference or storyboard work. For cost-sensitive jobs, use std. It is the cheapest per second.

Endpoints

For the Kling 4.0 routes, see Kling 4.0. The base URL is https://api.nunchux.com. Each submit returns a task_id immediately. Poll the same capability that you submitted to, with the task_id appended to the route.

Common fields

Send your API key in the X-API-Key header (see Authentication). Send Content-Type: application/json on every submit. Send a User-Agent header that identifies your application, such as YourApp/1.0. The request fields below appear on more than one V3 endpoint. They do not apply to Kling 4.0.
string
required
The model to generate with. See Models. Defaults to kling-v3 on text-to-video, image-to-video and motion control. Defaults to kling-v3-omni on omni video.Options: kling-v3 on text-to-video, image-to-video and motion control. kling-v3-omni on omni video.
string
default:"std"
Quality and speed tier. Higher tiers take longer. Motion control accepts std and pro only.Options: std, pro, 4k
string
required
Description of the video to generate. Max 2500 characters. On image-to-video, describe the motion or the transformation. On omni video, refer to an input with a placeholder such as <<<image_1>>>. Not sent on motion control. Ignored in storyboard mode.
string
What to exclude from the video. Max 2500 characters. Text-to-video and image-to-video only.
string
default:"5"
Output length in seconds, sent as a string. Billed per second. Common values are "5" and "10". Not sent on motion control, where the output length follows the reference video. Ignored in storyboard mode.Range: 3-15 on text-to-video and image-to-video. 3-10 on omni video.
string
default:"off"
Native audio generation. Off by default, so a clip is silent unless you send on. Text-to-video, image-to-video and omni video. In std and pro, a clip with sound bills at a higher per-second rate. On kling-v3 in 4k mode, audio is always included and this flag is ignored. On omni video, on cannot be combined with video_list; that request returns a 400.Options: on, off
string
If set, Kling POSTs status updates to this URL, and you do not need to poll. Text-to-video and image-to-video only.

Text-to-video

POST https://api.nunchux.com/v1/klingai/videos/text2video Generate a video from a text prompt. Send model_name and prompt. Every other field is optional and falls back to its default. Use kling-v3.
string
default:"16:9"
Output aspect ratio.Options: 16:9, 9:16, 1:1
To plan a sequence of shots instead of one prompt, see Storyboard mode.

Image-to-video

POST https://api.nunchux.com/v1/klingai/videos/image2video Animate a starting image into a video clip. Send model_name, image and a prompt that describes the motion. Use kling-v3.
string
required
The starting frame. Pass a public URL or raw base64, with no data:image/...;base64, prefix. Kling rejects the prefixed form with code 1201.

Omni video

POST https://api.nunchux.com/v1/klingai/videos/omni-video Compose one clip from reference images, videos and elements. Use kling-v3-omni. At least one of image_list, video_list or element_list must be non-empty. You can send up to 7 reference inputs across the three lists. Refer to an input from the prompt with a 1-indexed placeholder in submission order: <<<image_1>>>, <<<video_1>>>, <<<element_1>>>.
array
Reference images.
array
Reference videos to continue or to composite from.
array
Reference elements, such as segmented objects or characters, to compose into the video.
string
Output aspect ratio. Required when image_list has no first_frame entry. Without it, the request returns a 400.Options: 16:9, 9:16, 1:1
To plan a sequence of shots, see Storyboard mode.

Motion control

POST https://api.nunchux.com/v1/klingai/videos/motion-control Drive a still character with the motion of a reference video. Kling transfers the action from the driver clip and preserves the character’s identity. Use kling-v3. Do not send prompt or duration. The output length follows the reference video.
string
required
Public URL or raw base64 of the still character to animate, with no data:image/...;base64, prefix.
string
required
Public URL of the driver clip whose motion is transferred onto the character.
string
required
How the character reference is provided. image expects a still image in image_url (cap: 10 s). video expects a video in image_url (cap: 30 s).Options: image, video
integer
required
Length of the driver clip in seconds. This value drives per-second billing, so declare it accurately.Range: 1-10.
BillingKling bills per second of generated output. If you under-declare input_video_seconds, a follow-up charge is applied after the job completes. If you over-declare, the difference is not refunded automatically.

Storyboard mode

Text-to-video and omni video accept a multi-shot storyboard. Set multi_shot to true and describe each shot in multi_prompt. The top-level prompt and duration are ignored. The total length is the sum of the per-shot durations. All constraints are validated before billing, so a malformed request returns a 400 with no charge.
boolean
default:false
Enable multi-shot storyboard mode.
string
How shots are planned. Required when multi_shot is true.Options: customize, intelligence
array
Per-shot instructions. Text-to-video accepts up to 6 shots and 15 seconds in total. Omni video caps the total at 30 seconds.

Poll a task

GET https://api.nunchux.com/v1/klingai/videos/{capability}/{task_id} {capability} is one of text2video, image2video, omni-video and motion-control. Poll the same capability that you submitted to. A task_id polled at another capability’s route returns 404. Poll every 5 to 10 seconds at first, then back off to 15 to 30 seconds. Polls do not use credits and do not count toward your concurrency limit. task_status moves from submitted to processing, then to succeed or failed. A task handle expires after 7 days. Output URLs expire within hours, so download the output as soon as the task succeeds.
integer
required
0 on success. A non-zero value indicates a Kling error.
string
required
Human-readable status, such as SUCCEED.
object
required
The task payload.
The submit response has the same shape, with task_status set to submitted. A poll response when the task has succeeded:

Example

Submit a text-to-video job, poll it until it reaches a terminal status, then download the clip.

Kling 4.0

Kling 4.0 uses Kling’s newer API. The model ID goes in the URL, not in the body, and the body has a different shape from the V3 routes above: a prompt or a contents array, a settings object and an options object. None of the Common fields apply. Every Kling 4.0 clip has sound, and audio costs nothing extra. For per-second rates, see Pricing. A V3 model ID on these routes returns a 400. Each submit returns the task ID in data.id. Poll every route’s tasks at the one GET /v1/klingai/tasks route. The settings fields are the same on all three routes, except where a field says otherwise:
  • resolution: 720p or 1080p. Defaults to 1080p. A 1080p clip costs more per second than a 720p clip.
  • duration: whole seconds from 3 to 30. Defaults to 10. When you omit it, the API sends 10, so a length you state in the prompt does not apply. Set duration to choose the length. Billed per second.
  • aspect_ratio: text-to-video and omni video only.

Kling 4.0 text-to-video

POST https://api.nunchux.com/v1/klingai/text-to-video/kling-4.0 Generate a video with sound from a text prompt. Only prompt is required.
string
required
Description of the video to generate, including any dialogue, music or sound effects. Up to 26,000 English characters or 11,000 characters in other languages. A prompt that mixes them counts each English character as 1/26,000 and each other character as 1/11,000 of the limit.
object
Output settings.
object
Delivery options.

Kling 4.0 image-to-video

POST https://api.nunchux.com/v1/klingai/image-to-video/kling-4.0 Animate one or more key frames. Send the prompt and the frames as items of contents, in the order first frame, middle frames, last frame. Give a frame an id and refer to it from the prompt as @id, such as @frame_1. The output aspect ratio follows the frames, so settings takes no aspect_ratio here.
array
required
The prompt and the frames: one prompt item and your frame items.
object
Output settings.
object
Delivery options: callback_url and external_task_id, as on text-to-video.

Kling 4.0 omni video

POST https://api.nunchux.com/v1/klingai/omni-video/kling-4.0 Compose one clip from reference images, videos, elements and voices, or edit a video. Give each input an id and refer to it from the prompt as @id, such as @image_1. State what each input is for, for example “keep the face and the clothing of @image_1”.
array
required
The prompt and the inputs. Send one prompt item.
object
Output settings.
object
Delivery options: callback_url and external_task_id, as on text-to-video.
A request takes up to 15 inputs: up to 10 images, 5 reference videos, 1 base_video, 7 elements and 3 voices. A request with a reference video, an element or a base_video reserves credits at submit for the most the job can cost. When the task settles, the API refunds what the job did not use.

Poll a Kling 4.0 task

GET https://api.nunchux.com/v1/klingai/tasks?task_ids={id} Poll the tasks of all three Kling 4.0 routes here, by the data.id that the submit returned. To poll several tasks in one request, join up to 20 IDs with commas. Querying by external_task_ids is not supported and returns a 400. status moves from submitted to processing, then to succeeded or failed. Polls do not use credits. Output URLs expire within hours, so download the output as soon as the task succeeds. The submit response:
array
required
One item for each task ID, in the order you sent them, with repeated IDs removed. If one task cannot be read, for example an unknown ID, the response is that task’s error alone.
A poll response when the task has succeeded:

Kling 4.0 example

Submit a Kling 4.0 text-to-video job, poll it until it reaches a terminal status, then download the clip.

Tips

  • Poll; do not busy-wait. Poll every 5 to 10 seconds at first, then back off to 15 to 30 seconds.
  • Expect text-to-video and image-to-video to finish in 60 to 120 seconds. A kling-v3 std 5-second clip takes about 45 seconds. Motion control and omni video run 2 to 6 minutes, and omni video takes longer with more shots.
  • Set a client timeout of at least 5 minutes for std text-to-video and image-to-video. Use at least 10 minutes for pro, 4k, motion control and omni video.
  • Download outputs as soon as the task succeeds. Output URLs expire within hours.
  • Expect Kling 4.0 to take a few minutes. A 3-second 720p text-to-video clip took about 3 minutes. Set a client timeout of at least 10 minutes, and longer for long or 1080p clips.
  • On Kling 4.0, set settings.duration on every request. When you omit it, the clip is 10 seconds, whatever the prompt says.
  • On Kling 4.0, describe the sound you want in the prompt: dialogue, music or ambient noise. Every Kling 4.0 clip has sound.
  • Keep prompts concrete and visual. Describe what the camera sees, not abstract concepts.
  • Use negative_prompt to rule out unwanted elements such as blur, text overlays and watermarks.
  • Set sound: "on" to add ambient audio with no post-processing. Omni video clips are silent unless you do. On kling-v3 in 4k mode, audio is always included.
  • Send base64 images as raw bytes with no data:image/...;base64, prefix. Public URLs must be reachable by Kling’s servers: no auth walls and no localhost.
  • Use a clear, well-composed starting frame for image-to-video. Kling extends what it sees, so a blurry or cluttered input produces inconsistent motion.
  • Use a clean, well-lit character image for motion control. Identity preservation is only as good as the source.
  • Pass a callback_url on text-to-video or image-to-video to receive status updates without polling.

Errors and limits

A 200 means that Kling accepted the job and billing started, not that the job succeeded. Do not resubmit after a 200; a second submit creates and bills a second job. Retry only on a network or timeout error that arrives before the submit response. Retry a 5xx or a transient 429 with backoff. Never retry another 4xx; the request is invalid as sent. For the general error contract, see Error codes. For the concurrency caps and request limits, see Rate limits. Every job counts toward your plan’s simultaneous-jobs cap; polls do not. Credits are deducted at submit and refunded when a job fails; see Credits & pricing and the Partner models overview. Kling-specific limits:
  • prompt and negative_prompt: up to 2500 characters.
  • duration: 3 to 15 seconds, or 3 to 10 seconds on omni video. In storyboard mode, text-to-video accepts up to 6 shots and 15 seconds in total, and omni video accepts up to 30 seconds in total.
  • Omni video: up to 7 reference inputs across image_list, video_list and element_list.
  • Omni video: sound: "on" with a video_list returns a 400.
  • Omni video: aspect_ratio is required when image_list has no first_frame entry.
  • Motion control: input_video_seconds from 1 to 10, and mode is std or pro.
  • Voice control is not supported on kling-v3. Sending voice_control or voice_list returns a 400.
  • Kling 4.0: settings.resolution is 720p or 1080p, and settings.duration is 3 to 30 seconds. Other values return a 400 before billing.
  • Kling 4.0: prompt is up to 26,000 English characters or 11,000 characters in other languages.
  • Kling 4.0 image-to-video: up to 10 frames. A contents type that the route does not take returns a 400.
  • Kling 4.0 omni video: up to 15 inputs, with at most 10 images, 5 reference videos, 1 base_video, 7 elements and 3 voices. More returns a 400 before billing.
  • Kling 4.0 polls: up to 20 task IDs per request.

Migrating from /v1/video/kling/*

Kling used to live under /v1/video/kling/*. It now lives under /v1/klingai/videos/*, a faithful mirror of Kling’s own API: same request bodies, same response shapes, same error codes. If you call Kling directly today, you can point at us by swapping the base URL and using your Nunchux key as the Bearer token. Existing /v1/video/kling/* integrations keep working; migrate when convenient.
Two things that are not a find-and-replace
  • Polling moved from one URL to one per capability. There is no /v1/klingai/videos/tasks/{task_id}. Instead of a single GET /v1/video/kling/tasks/{task_id}, poll the endpoint you submitted to. For example, a job from POST /v1/klingai/videos/text2video is polled at GET /v1/klingai/videos/text2video/{task_id}. A shared poll helper needs to carry the submit path through; a task_id polled at another capability’s URL returns 404.
  • One path was renamed beyond the prefix change: video-effects → effects. The rest keep their trailing segment.