Kling4 API

Models and inputs

The Kling model IDs the Kling4 API accepts, with Kling 4.0 as the default, what each one takes as input, which lengths and resolutions it renders, and how your media decides the generation mode.

The API serves Kling video models through the official Kling API. Put one of the IDs below in model; kling_v4 (Kling 4.0) is the recommended default. Kling4 routes the request to a matching upstream endpoint behind the scenes, so the ID you send stays the same even when that routing changes.

Model IDModelGood forImagesVideo refsLengthResolution (default)
kling_v4Kling 4.0Default: text, image and reference to video10none3 to 30 s720p or 1080p (720p)
kling_o3_text_to_videoKling O3Text or frames to video, or video to video214 to 15 s720p or 1080p (720p)
kling_v3_text_to_videoKling 3.0Text to videononenone4 to 15 s720p to 4K (720p)
kling_v3_image_to_videoKling 3.0 ImageFirst frame, or first and last frame, to video2none4 to 15 s720p to 4K (720p)

The numbers under Images and Video refs are maximums per request. A value outside a model's length or resolution range is refused with 422, and the message spells out the limit.

Video references on kling_v4 and the motion control models (kling_v3_motion_control, kling_v2_6_motion_control) are available in the web app only for now: their price follows the length of the reference clip, which the API cannot measure yet. A request that uses them is refused with 422. Tasks you start with them in the web app can still be read with GET /v1/tasks/{task_id}.

What your plan unlocks

Some models or resolutions may need a paid plan. A request your plan does not cover returns 403 plan_upgrade_required. The pricing page lists what each plan includes.

These checks run before a task exists, so a refused request never reserves credits.

How the inputs pick a mode

There is no mode field. The model and the media arrays you fill decide the workflow:

You sendThe task runs as
Only a promptText to video
One imageImage to video, with the image as the first frame
Two imagesFirst and last frame
Three or more images on kling_v4Reference to video
One video_urls entry on kling_o3_text_to_videoVideo to video, guided by the prompt

To use one or two images as references (say, a character and a product) instead of frames, add reference_mode: true. Only kling_v4 accepts it, and the request needs at least one image.

In a kling_v4 reference request, refer to your references by position in the prompt: @Image 1 is the first entry of image_urls, @Image 2 the second, and so on. For example: "The mascot from @Image 1 holds the bottle from @Image 2 on the counter from @Image 3."

With a kling_o3_text_to_video video, any images you add are used as extra references, and the output is 10 seconds at most.

Pass media as links, not file uploads. Every URL has to:

  • use https:// (Base64 strings and data: URLs are rejected),
  • contain no username or password,
  • resolve to a public address; localhost, private network ranges and hostnames that do not resolve are refused.

A rejected link returns 422 invalid_request with param: "media_url".

Other request fields

  • aspect_ratio accepts 16:9, 9:16 and 1:1 on every text-to-video model, and 21:9 as well on kling_v4. Image-to-video runs take the frame shape from the first image, and kling_v3_image_to_video refuses the field.
  • generate_audio applies to Kling 3.0 and Kling O3. It is on unless you send false. Kling 4.0 always generates sound and refuses the field. Kling O3 video to video keeps the sound of the source clip, so only false is accepted there.
  • prompt can be up to 2,500 characters on every Kling model. Longer prompts fail with 422 prompt_too_long. It is required everywhere except kling_v3_image_to_video, where the first frame alone is enough.
  • The request body is strict: a field the API does not know about is rejected with 422, and param tells you which one.