Skip to main content
POST
  1. After submission, a task_id will be returned. If you provided a callback_url, when the task status becomes finished or failed, a POST request will be sent to the callback_url.
  2. Regardless of whether callback_url is provided, you can retrieve the response result through the unified Query Task Status endpoint.
Kling 4.0 creates videos from a text prompt and optional visual references. Combine reference images and reference videos to guide appearance, movement, and scene composition.

Models

  • kling-4.0 — Text and reference-guided video generation

Features

  • Flexible duration: Generate 3–30 second videos at 720p or 1080p.
  • Visual references: Supply up to 10 reference images and up to 5 reference videos. Refer to them in the prompt as @image_1 and @video_1, using their positions in the corresponding arrays.
  • Aspect ratios: Use auto, 16:9, 9:16, 1:1, or 21:9.

Required parameters

  • prompt (string): Video instructions, 1–8,000 characters. Must contain at least one non-whitespace character. Reference uploaded materials with @image_1 or @video_1.

Optional parameters

  • duration (integer): Output duration from 3 to 30 seconds. Default: 5.
  • resolution (string): 720p or 1080p. Default: 720p.
  • aspect_ratio (string): auto, 16:9, 9:16, 1:1, or 21:9. When omitted, the ratio adapts to supplied materials; without materials, it defaults to 16:9.
  • reference_image_urls (array of strings): Up to 10 publicly accessible HTTP or HTTPS image URLs.
  • reference_video_urls (array of strings): Up to 5 publicly accessible HTTP or HTTPS video URLs. Each video must last 3–30 seconds.

Examples

  • Text-to-video: Send a prompt without reference materials. Set duration, resolution, or aspect_ratio only when needed.
  • Reference images: Supply reference_image_urls and refer to the first image as @image_1.
  • Reference videos: Supply reference_video_urls and use @video_1 to refer to the first video.
The request examples in the API playground demonstrate these inputs.

Notes

  • Provide at most 10 reference images and at most 5 reference videos. The combined duration of all reference videos cannot exceed 30 seconds.
  • Reference indexes start at 1 and follow the order of the corresponding input array. Use publicly accessible media URLs and omit unused optional fields.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
model
enum<string>
required

Public model identifier.

Available options:
kling-4.0
input
object
required

Text instructions with up to 10 reference images and up to 5 reference videos. The combined duration of all reference videos must not exceed 30 seconds.

callback_url
string<uri>

Optional webhook URL for task completion or failure notifications.

Response

Task submitted successfully

code
integer
required
Example:

200

data
object
required