Skip to main content
POST
Kling 4.0 Video Edit

Authorizations

Authorization
string
header
required

API Key authentication. Format: Bearer YOUR_API_KEY.

Body

application/json

Kling 4.0 Video Edit request. Media inputs must be accessible HTTP(S) URLs; base64 and data URIs are not accepted. Images, videos, subjects and voices combined must not exceed 15 references. All keyframes and reference images combined must not exceed 10.

prompt
string
required

Required non-whitespace prompt. Up to 26,000 English characters or 11,000 non-English characters. Mixed prompts must satisfy English/26000 + non-English/11000 <= 1. Reference labels follow input order: @image_1, @video_1 and @element_1, with @voice_1 for voice references.

Required string length: 1 - 26000
Example:

"Edit @video_1. Remove the person in the foreground. Keep everything else unchanged."

video
string<uri>
required

Required base video URL for editing (MP4/MOV). All supplied video inputs together must fit within 30 seconds, with a minimum video duration of 3 seconds. Media validity is checked by the upstream service.

Minimum string length: 1
Pattern: ^[Hh][Tt][Tt][Pp][Ss]?://[^\s]+$
Example:

"https://example.com/source.mp4"

duration
integer

Optional output duration in seconds (3-30). When omitted, duration is inferred from the prompt and inputs. Final billing uses the output duration reported for the completed task.

Required range: 3 <= x <= 30
Example:

5

resolution
enum<string>
default:1080p

Output resolution. 720p and 1080p are native; 2k and 4k are upscaled outputs.

Available options:
720p,
1080p,
2k,
4k
first_frame_image
string<uri>

Publicly accessible first keyframe image URL. Optional.

Minimum string length: 1
Pattern: ^[Hh][Tt][Tt][Pp][Ss]?://[^\s]+$
Example:

"https://example.com/frame.png"

mid_frame_images
string<uri>[]

Middle keyframe image URLs in temporal order. All keyframes and reference images together must not exceed 10.

Required array length: 1 - 10 elements
Minimum string length: 1
Pattern: ^[Hh][Tt][Tt][Pp][Ss]?://[^\s]+$
last_frame_image
string<uri>

Publicly accessible last keyframe image URL. A last frame alone is accepted.

Minimum string length: 1
Pattern: ^[Hh][Tt][Tt][Pp][Ss]?://[^\s]+$
Example:

"https://example.com/frame.png"

reference_images
string<uri>[]

Reference image URLs, ordered after first and middle keyframes and before the last keyframe. At most 10 images including all keyframes.

Required array length: 1 - 10 elements
Minimum string length: 1
Pattern: ^[Hh][Tt][Tt][Pp][Ss]?://[^\s]+$
reference_videos
string<uri>[]

Additional motion or camera reference video URLs (MP4/MOV). At most 4 in addition to the base video; total input video duration must not exceed 30 seconds.

Required array length: 1 - 4 elements
Minimum string length: 1
Pattern: ^[Hh][Tt][Tt][Pp][Ss]?://[^\s]+$
subject_ids
string[]

Existing subject IDs available through this model's channel, referenced as @element_1, @element_2, and so on. At most 7 subjects, including at most 3 created from videos. This endpoint does not create subjects.

Required array length: 1 - 7 elements
Minimum string length: 1
voice_ids
string[]

Existing voice IDs accessible to the configured account, referenced as @voice_1, @voice_2, and @voice_3. Cannot be combined with audio=original.

Required array length: 1 - 3 elements
Minimum string length: 1
audio
enum<string>
default:native

native generates new audio; original preserves the source video audio and disables generated audio. original cannot be combined with voice_ids.

Available options:
native,
original
aspect_ratio
enum<string>
default:adaptive

Output aspect ratio. adaptive follows the source video.

Available options:
adaptive,
21:9,
16:9,
9:16,
1:1

Response

Task submitted successfully

code
integer
required

Response code, 0 indicates success

Example:

0

message
string
required

Response message

Example:

"success"

data
object
required

Detailed data about the submitted asynchronous task.