Kling Multi-Element Video Editing API reference
Kling Multi-Element Video Editing changes an existing short clip: add an element from a reference image (addition), swap a marked element for the one in a reference image (swap), or remove a marked element (removal). On APIMODELS it is one model id, kling-multi-elements (kling-video-edit also works), on the unified video endpoint, and it takes one request: we run Kling's upload, frame-by-frame selection and edit steps for you on the server. Inputs must be 2-5 s or 7-10 s long. Billed per 5 seconds of output, $0.42 at std (720p) and $0.70 at pro (1080p), only when the edit succeeds.
Preços
| Output length | std (720p) | pro (1080p) |
|---|---|---|
| 5 s output (2-5 s input) | $0.42 | $0.70 |
| 10 s output (7-10 s input) | $0.84 | $1.40 |
Billed per 5 seconds of output: $0.42 at std and $0.70 at pro. The output is either 5 or 10 seconds; without duration it follows the input length (2-5 s → 5 s, 7-10 s → 10 s). The edit mode, the number of reference images and the number of marked frames do not change the price. Invalid requests return a 400 at create time and are not charged; failed generations are not charged.
Autenticação
All requests carry the API key in the header:
Authorization: Bearer YOUR_API_KEYCreate a task and poll it
https://api.apimodels.app/v1/video/generations·GET/v1/video/generations?task_id=Each example is one edit mode: cURL shows addition, Python shows swap and Node shows removal.
# Kling multi-element video editing — one call edits an existing 2-5 s or 7-10 s clip.
# edit_mode: addition (1-2 images) | swap (exactly 1 image) | removal (no image).
# Billed per 5 s of output on success: std (720p) $0.42, pro (1080p) $0.70.
# Addition: put an element from a reference image into the video (selections are optional here)
curl -X POST https://api.apimodels.app/v1/video/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "kling-multi-elements",
"video_url": "https://example.com/street-4s.mp4",
"edit_mode": "addition",
"image_urls": ["https://example.com/red-umbrella-cropped.png"],
"prompt": "Using the context of <<<video_1>>>, seamlessly add the red umbrella from <<<image_1>>> into the hand of the woman walking on the left",
"mode": "std"
}'
# Response (async — a task is created):
# { "code": 200, "msg": "success", "data": { "taskId": "clxxx", "state": "pending", "model": "kling-multi-elements" } }
# Poll every 10-15 s until completed (result files are kept 30 days)
curl "https://api.apimodels.app/v1/video/generations?task_id=TASK_ID" \
-H "Authorization: Bearer YOUR_API_KEY"
# { "code": 200, "data": { "state": "completed",
# "resultUrls": ["https://r2.apimodels.app/videos/clxxx.mp4"] } }A task moves through pending → processing → completed or failed. On completed, data.resultUrls[0] is the edited MP4; on failed, the reason is in data.failMsg and the charge is returned. Polling every 10-15 seconds is plenty.
Edit modes and prompt templates
In the prompt, <<<video_1>>> is the input video and <<<image_1>>> / <<<image_2>>> are the first and second items of image_urls. Replace [x] with what you mean, such as "the red umbrella".
| edit_mode | Prompt template | Reference images | selections |
|---|---|---|---|
addition | Using the context of <<<video_1>>>, seamlessly add [x] from <<<image_1>>> | image_urls: 1-2 | Optional |
swap | swap [x] from <<<image_1>>> for [x] from <<<video_1>>> | image_urls: 1 | Required |
removal | Delete [x] from <<<video_1>>> | image_urls: — | Required |
Crop each reference image to the subject you want added or swapped in before sending it: the API does not crop for you.
Selections: marking the element to change
Swap and removal have to tell Kling which thing in the frame to change. Pick a few moments and put a few points on the element in each of those frames: time is the second in the input video (or use frame_index to give the frame number), and x / y give the point as fractions 0-1 of the frame width and height, measured from the top-left corner. Up to 10 marked frames, up to 10 points per frame; if the element moves, mark it in several frames where it sits in different places. Addition can skip selections or use them to mark where the element goes.
"selections": [
{ "time": 1.0, "points": [ { "x": 0.52, "y": 0.40 }, { "x": 0.55, "y": 0.47 } ] },
{ "time": 3.2, "points": [ { "x": 0.60, "y": 0.43 } ] }
]
// time = seconds into the input video (or frame_index = the frame number instead)
// x, y = fractions 0-1 of the frame width and height, measured from the top-left corner
// (x 0.5, y 0.5 is the centre of the frame)
// limits = up to 10 marked frames, up to 10 points per frameThe result depends a lot on how well the element is marked: put the points on the element itself, not on the background. The playground on the website lets you pause the video and click on the frame, and writes the coordinates in this format for you.
Callback (callback_url)
To skip polling, pass callback_url in the create request. When the task reaches completed or failed we send an HTTP POST (JSON) to it. Failed deliveries are retried with backoff for up to 30 minutes, until your endpoint returns a 2xx. The URL must be publicly reachable; localhost and private addresses return a 400 at create time. Polling keeps working either way.
POST {your callback_url}
Content-Type: application/json
{
"code": 200,
"msg": "success",
"data": {
"taskId": "clxxx...",
"model": "kling-multi-elements",
"state": "completed", // or "failed"
"param": "<JSON string>", // your request, JSON.parse once
"resultJson": "<JSON string> | null", // {"resultUrls": ["https://...mp4"]}, JSON.parse once
"failCode": null,
"failMsg": null
}
}Parâmetros
| Field | Required | Type | Description |
|---|---|---|---|
| model | Yes | string | kling-multi-elements (kling-video-edit also works) |
| video_url | Yes | string | The video to edit, a public URL. MP4 or MOV, 2-5 s or 7-10 s, width and height each 720-2160 px, 24 / 30 / 60 fps. |
| edit_mode | Yes | string | addition, swap or removal. |
| image_urls | Depends on mode | string[] | Reference images, URL or base64. addition 1-2, swap exactly 1, removal none. Crop them to the subject first. |
| prompt | Yes | string | Up to 2,500 characters and must contain <<<video_1>>>; addition and swap also need <<<image_1>>>. Templates are above. |
| negative_prompt | No | string | What you do not want in the result. |
| selections | swap / removal: yes | object[] | [{ time or frame_index, points: [{ x, y }] }], x / y as 0-1 fractions from the top-left. Up to 10 frames, up to 10 points per frame. Optional for addition. |
| mode | No | string | std (default, 720p, $0.42 per 5 s) or pro (1080p, $0.70 per 5 s). |
| duration | No | integer | Output length, 5 or 10. Left out, it follows the input: a 2-5 s video gives 5 s and a 7-10 s video gives 10 s. 5 needs a 2-5 s input and 10 needs a 7-10 s input. |
| callback_url | No | string | We POST the result to this URL on completion; omit it and poll the GET endpoint instead. |
Limits
- Input length — Only 2-5 s or 7-10 s videos. Lengths such as 6 s or 11 s return a 400 at create time; trim them first.
- Input frame — MP4 or MOV, width and height each 720-2160 px, 24 / 30 / 60 fps.
- Marking — The result depends on how well the element is marked; points that land on the background can change the wrong thing.
- Success — Success is not 100%: an edit can fail, or miss the target element. Failed tasks are not charged; when an edit misses, adjust the selections or the prompt and retry.
- Retenção — Result files are deleted after 30 days, so download or re-host them promptly.
Erros
Parameter problems come back synchronously as a 400 at creation ({"code": 400, "msg": "..."}): no task is created and nothing is charged. We measure the input video length before the task is created. The msg strings below are the current wording (N is the actual number).
| msg | Causa / correção |
|---|---|
video_url is required (mp4/mov, 2–5 s or 7–10 s, 720–2160 px, 24/30/60 fps) | No input video was sent. |
edit_mode must be "addition", "swap" or "removal" | edit_mode only takes these three values. |
edit_mode "addition" needs 1–2 reference images in image_urls (got N) | Addition needs 1-2 reference images. |
edit_mode "swap" needs exactly 1 reference image in image_urls (got N) | Swap takes exactly 1 reference image. |
edit_mode "removal" takes no reference images; remove image_urls | Removal takes no images; drop image_urls. |
prompt is required; refer to the inputs as <<<video_1>>> and <<<image_1>>>, e.g. "Delete the cup from <<<video_1>>>" | No prompt was sent. |
prompt must be 2500 characters or fewer (got N) | The prompt is longer than 2,500 characters. |
prompt must refer to the input video as <<<video_1>>>, e.g. "Delete the cup from <<<video_1>>>" | The prompt has to name the input video as <<<video_1>>>. |
prompt must refer to the reference image as <<<image_1>>> | For addition and swap the prompt has to name the reference image as <<<image_1>>> (and <<<image_2>>> with two images). |
edit_mode "swap" needs selections: mark the element with [{ "time": 1.0, "points": [{ "x": 0.5, "y": 0.4 }] }] (x / y are 0–1 from the top-left) | Swap and removal need selections that mark the element to change (removal reports edit_mode "removal"). |
selections[N] needs time (seconds) or frame_index | Each selection needs time (seconds) or frame_index. |
selections[N].points: x and y must be fractions between 0 and 1 (from the top-left corner of the frame) | Coordinates are 0-1 fractions, not pixels. Divide pixel positions by the frame width and height. |
selections[N] has N points; at most 10 per frame | At most 10 points per frame. |
selections marks N frames; at most 10 | At most 10 marked frames. |
mode must be "std" (720p) or "pro" (1080p) | mode only takes std or pro. |
duration must be 5 or 10 (got N) | duration must be 5 or 10, or left out. |
The input video is N s; Kling multi-element editing accepts 2–5 s or 7–10 s videos | The input video is outside 2-5 s and 7-10 s (6 s or 12 s, for example). Trim it into one of the two ranges first. |
duration 5 needs a 2–5 s input video (this one is N s); use duration 10 or omit it | A 5-second output needs a 2-5 s input. |
duration 10 needs a 7–10 s input video (this one is N s); use duration 5 or omit it | A 10-second output needs a 7-10 s input. |
- 401: the API key is missing or invalid.
- 402: the balance does not cover this edit.
- Failures during generation (content safety rejection, upstream error, timeout) end in state failed with the reason in data.failMsg, and the charge is returned automatically.
Notas
- This edits an existing clip rather than generating one: to make a new clip, use Kling 3.0 Turbo or Kling 4.0.
- Only upload videos and images you have the rights to use.
Try it in the Playground. Use cases and worked price examples are on the Kling Multi-Elements model page.
Related
Perguntas frequentes
How much does Kling multi-element video editing cost?
Per 5 seconds of output: $0.42 in std (720p) and $0.70 in pro (1080p). A 5 s edit is $0.42 or $0.70, a 10 s edit $0.84 or $1.40. Only successful edits are charged.
Which edit_mode should I use, and how many images does each take?
addition puts an element from 1-2 reference images into the video; swap replaces a marked element with the one in exactly 1 reference image; removal deletes a marked element and takes no image. swap and removal need selections; for addition they are optional.
How do I mark the element in selections?
Give a list of { time, points } (or frame_index instead of time), where time is the second in the input video and each point's x and y are fractions 0-1 of the frame width and height from the top-left corner. Up to 10 frames and 10 points per frame.
What videos does Kling multi-element editing accept?
MP4 or MOV, 2-5 s or 7-10 s long, width and height each 720-2160 px, at 24, 30 or 60 fps. Other lengths return a 400 before anything is charged. Edits can still fail or miss the target, so success is not 100%; failed tasks are not charged.