Kling 4.0 Video Edit API
kwaivgi/kling-v4.0/video-editKling 4.0 Video Edit transforms an existing 3–30 second video from a written instruction, restyling scenes, swapping objects or adding elements at 720p or 1080p. It keeps the original timing, people and camera path that you ask to preserve while applying the change across every frame.
Drag and drop files, paste from clipboard, or provide a URL. Required. One MP4, MOV or WebM source video, 3–30 seconds, up to 100 MB.
1/1 files added
Drag and drop files, paste from clipboard, or provide a URL. Up to 10 images, cited in the prompt as @Image1, @Image2…
Switch to JSON to add image-based kling_elements.
REST API
Quick Start
Make your first Kling 4.0 Video Edit request in three steps. The example turns an afternoon street into a snowy evening at the source length and returns a task_id.
Connect to the Vidgo API
Create an API key, keep it on your server, and send it in the Authorization header as a Bearer token.
- Endpoint
- POST
https://api.vidgo.ai/api/generate/submit - Authentication
- Authorization: Bearer VIDGO_API_KEY
Submit one generation task
Run the short example with video_url and an edit prompt; omit duration to match the source.
curl --request POST \
--url "https://api.vidgo.ai/api/generate/submit" \
--header "Authorization: Bearer $VIDGO_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"model": "kwaivgi/kling-v4.0/video-edit",
"input": {
"prompt": "Turn the afternoon street in this video into a snowy winter evening: settle a thin layer of snow on rooftops, cars and the pavement, add gently falling flakes and warm light in the shop windows. Keep the people, their movement and the camera path exactly as in the source. No text, no logos, no watermark.",
"resolution": "720p",
"video_url": "https://cdn.vidgo.ai/apis/models/kwaivgi/kling-v4.0/video-edit/v1/02/input-source.mp4"
}
}'Wait for the result
Use the returned task_id to check the same task until it reaches finished or failed. On success, read data.files[].file_url.
Track status
GET https://api.vidgo.ai/api/generate/status/{task_id}Poll every few seconds while the status is not_started or running, and stop on finished or failed. On success, read data.files[].file_url. For longer clips, lengthen the interval gradually or add callback_url to the submit request.
not_startedrunningfinishedfailed{
"code": 200,
"data": {
"task_id": "HSB8M64LBPQ54HHW",
"status": "not_started",
"created_time": "2026-11-05T07:05:29"
}
}{
"code": 200,
"data": {
"task_id": "HSB8M64LBPQ54HHW",
"status": "finished",
"files": [
{
"file_url": "https://cdn.vidgo.ai/apis/models/kwaivgi/kling-v4.0/video-edit/v2/01/output-01.mp4",
"file_type": "video"
}
],
"created_time": "2026-11-05T07:05:29",
"error_message": null,
"progress": 100
}
}Complete runnable example
Open this after the three-step flow is clear. It combines submission, polling, terminal-state handling and result extraction in one script.
set -euo pipefail
: "${VIDGO_API_KEY:?Set VIDGO_API_KEY in your environment}"
REQUEST_BODY=$(cat <<'JSON'
{
"model": "kwaivgi/kling-v4.0/video-edit",
"input": {
"prompt": "Turn the afternoon street in this video into a snowy winter evening: settle a thin layer of snow on rooftops, cars and the pavement, add gently falling flakes and warm light in the shop windows. Keep the people, their movement and the camera path exactly as in the source. No text, no logos, no watermark.",
"resolution": "720p",
"video_url": "https://cdn.vidgo.ai/apis/models/kwaivgi/kling-v4.0/video-edit/v1/02/input-source.mp4"
}
}
JSON
)
SUBMIT_RESPONSE=$(curl --silent --show-error --fail-with-body \
--request POST \
--url "https://api.vidgo.ai/api/generate/submit" \
--header "Authorization: Bearer $VIDGO_API_KEY" \
--header "Content-Type: application/json" \
--data "$REQUEST_BODY")
TASK_ID=$(printf '%s' "$SUBMIT_RESPONSE" | jq -r '.data.task_id // .task_id // empty')
if [ -z "$TASK_ID" ]; then
printf 'Submit response did not include task_id:
%s
' "$SUBMIT_RESPONSE" >&2
exit 1
fi
while true; do
STATUS_RESPONSE=$(curl --silent --show-error --fail-with-body \
--url "https://api.vidgo.ai/api/generate/status/$TASK_ID" \
--header "Authorization: Bearer $VIDGO_API_KEY")
STATUS=$(printf '%s' "$STATUS_RESPONSE" | jq -r '.data.status // .status // empty')
case "$STATUS" in
finished)
printf '%s' "$STATUS_RESPONSE" | jq -r '(.data.files // .files // [])[]?.file_url'
break
;;
failed)
printf '%s' "$STATUS_RESPONSE" | jq -r '.data.error_message // .error_message // "Generation failed"' >&2
exit 1
;;
not_started|running)
sleep 2
;;
*)
printf 'Unexpected task status: %s
' "$STATUS" >&2
exit 1
;;
esac
doneRequest Parameters
model and callback_url belong at the request root; generation parameters belong inside input.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| model | string | Yes | — | Fixed to kwaivgi/kling-v4.0/video-edit. |
| callback_url | string (URL) | No | — | A public HTTP(S) URL that receives the task result when it finishes. |
| input | object | Yes | — | Generation parameters: video_url and prompt, plus optional duration, resolution, reference_image_urls and image-based kling_elements. |
| input.prompt | string | Yes | — | Edit instruction, 1–26,000 characters. |
| input.video_url | string | Yes | — | Source video URL, 3–30 s, ≤100 MB; measured server-side. |
| input.reference_image_urls | string[] | No | — | ≤10 image URLs. |
| input.kling_elements | object[] | No | — | Image elements: element_input_urls (2–4). |
| input.duration | integer | No | source length | 3–30 s; omitted = source length. |
| input.resolution | string | No | 720p | 720p or 1080p. |
Response Fields
Submission returns the task identity immediately. Status responses add progress, output files or a failure message as the task advances.
| Field | Type | Description |
|---|---|---|
| code | integer | Application result code. Successful responses use 0 or 200. |
| message | string | Human-readable response or error message when present. |
| data.task_id | string | Task identifier used in the status endpoint path. |
| data.status | string | Current state: not_started, running, finished or failed. |
| data.created_time | string | Task creation time in date-time format. |
| data.progress | number | Completion percentage when the provider reports progress. |
| data.files[] | array | Generated output files returned after a successful task. |
| data.files[].file_url | string | Public URL of the generated video. |
| data.files[].file_type | string | Generated file type, such as video. |
| data.files[].watermark_url | string | null | Watermarked output URL when one is available. |
| data.error_message | string | null | Failure detail when status is failed. |
Task Lifecycle
Treat not_started and running as non-terminal states. finished and failed are terminal; stop polling when either is returned.
not_startedThe task has been accepted and is queued to start.
runningThe video is being generated. Keep polling the status endpoint.
finishedThe task is complete. Read the video URL from data.files[].file_url.
failedGeneration failed. Read data.error_message for details and stop polling.
Polling and Errors
- Authentication401 means the Bearer API key is missing or invalid. Check your key in the dashboard before retrying.
- Validation400 means a request field is invalid or belongs to another endpoint. Check video_url length (3–30 s) and that kling_elements are image-based.
- Polling intervalPoll every few seconds while the task runs, and lengthen the interval gradually for longer clips.
- Terminal statesPoll only while the status is not_started or running. Stop on finished or failed.
- Callback optionAdd callback_url at the request root to receive the final result without continuous polling.
Model Specifications
| Specification | Value | Description |
|---|---|---|
| Model | kwaivgi/kling-v4.0/video-edit | Model identifier for text-guided editing of an existing video. |
| Duration | 3–30 | Whole seconds; defaults to the source length. |
| Resolution | 720p | 1080p | Defaults to 720p. |
| Pricing | 17 / 25.5 credits/s | 720p / 1080p per billed second; billed seconds = output + max(output, source length). |
Related Models
Kling 4.0 Video Edit API FAQ
What is the Kling 4.0 Video Edit API?
Kling 4.0 Video Edit is a Kuaishou model for editing existing video with text instructions, released by Kling AI in October 2026. It takes a 3–30 second source clip and a prompt, plus optional reference images and image elements, and returns the edited video at 720p or 1080p with a stereo track. The model applies the requested change across the clip while keeping the motion, timing and camera path you ask it to preserve. You can call it programmatically or try it from the playground above.
How is Kling 4.0 Video Edit billed?
You pay 17 credits per billed second at 720p or 25.5 at 1080p. Billed seconds are the output length plus the longer of the output length or the source length, rounded up, so a 10-second edit of a 10-second source bills 20 seconds: 340 credits ($1.70) at 720p.
What happens to Kling 4.0 Video Edit pricing if I leave duration out?
The output matches the source, and the output length used for billing is the source length rounded up. A 7.4-second source therefore bills 8 + 8 = 16 seconds, 272 credits at 720p.
How long can the Kling 4.0 Video Edit source video be?
The source must run 3–30 seconds and be at most 100 MB. The server downloads and measures it before the task starts.
Can Kling 4.0 Video Edit use reference images?
Yes. Add up to 10 reference_image_urls, or image-based kling_elements with 2–4 images of one subject, and cite them in the prompt as @Image1 or @Element1 to show exactly what should appear.
How do I keep people and motion unchanged in Kling 4.0 Video Edit?
State it in the prompt alongside the change, for example "keep the people, their movement and the camera path exactly as in the source", and limit the instruction to the elements you want to alter.
Which resolutions does Kling 4.0 Video Edit output?
Choose 720p, the default, or 1080p. The output keeps the source framing, and the resolution selects the per-second rate.















