Kling 4.0 Video Edit

kwaivgi/kling-v4.0/video-edit

Edit video using a prompt and optional reference images; output 720p or 1080p, with original sound preserved by default.

Examples

Kling 4.0 Video Edit Examples 1

Parameters

NameTypeDefaultConstraintsDescription
prompt *Prompttextarea—≤ 5000 charsDescribe the edit you want applied to the video - change a subject, the setting, the weather or the style. Refer to the video as @Video1 and to reference images as @Image1, @Image2, ... in array order.
imagesReference imagesimage_upload—image/* · 0–10 itemsOptional reference images (up to 10) for a subject, object or style to bring into the edit.
keep_original_soundKeep original soundbooleantrue—Keep the source video's original sound. Turn off to generate new synchronized audio.
resolutionResolutionselect720p720p | 1080pOutput resolution.
durationDurationselect—3 ~ 30 · step 1 · 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | …Output duration in whole seconds, 3–30. Omit to follow the source video, up to 30 seconds.
aspect_ratioAspect ratioselect—16:9 | 9:16 | 1:1 | 21:9Output aspect ratio. Omit to follow the source video.

Output fields

FieldTypeDescription
videosarray<string>Generated video URLs.

API

Call this model through one unified REST API. Get a key on the API Keys page.

cURL
# 1) Submit — returns { "task_uuid": "..." }
curl -X POST "https://www.namifusion.com/api/v1/marketplace/run/kwaivgi/kling-v4.0/video-edit" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "input": {
    "prompt": "A cinematic portrait, dramatic rim light, shallow depth of field",
    "keep_original_sound": true,
    "resolution": "720p"
  }
}'

# 2) Poll until status is "completed", then read the output URLs
curl "https://www.namifusion.com/api/v1/marketplace/run/tasks/TASK_UUID" \
  -H "Authorization: Bearer YOUR_API_KEY"
Python
import time, requests

API_KEY = "YOUR_API_KEY"
HEADERS = {"Authorization": f"Bearer {API_KEY}"}

# 1) Submit
resp = requests.post(
    "https://www.namifusion.com/api/v1/marketplace/run/kwaivgi/kling-v4.0/video-edit",
    headers=HEADERS,
    json={
        "input": {
            "prompt": "A cinematic portrait, dramatic rim light, shallow depth of field",
            "keep_original_sound": True,
            "resolution": "720p"
        }
    },
)
resp.raise_for_status()  # 401/402/429/5xx stop here instead of polling a bad task
task = resp.json()

# 2) Poll until a terminal state (completed / failed / cancelled).
#    This model is allowed up to 1800s server-side.
deadline = time.time() + 1860
while task.get("status") not in ("completed", "failed", "cancelled"):
    if time.time() > deadline:
        raise TimeoutError(f"still {task.get('status')} — keep the task_uuid and poll later")
    time.sleep(3)
    poll = requests.get(f"https://www.namifusion.com/api/v1/marketplace/run/tasks/{task['task_uuid']}", headers=HEADERS)
    poll.raise_for_status()
    task = poll.json()

print(task["status"], task.get("output"))
JavaScript
const API_KEY = "YOUR_API_KEY";
const HEADERS = { Authorization: `Bearer ${API_KEY}` };

// 1) Submit
const resp = await fetch("https://www.namifusion.com/api/v1/marketplace/run/kwaivgi/kling-v4.0/video-edit", {
  method: "POST",
  headers: { ...HEADERS, "Content-Type": "application/json" },
  body: JSON.stringify({
    "input": {
      "prompt": "A cinematic portrait, dramatic rim light, shallow depth of field",
      "keep_original_sound": true,
      "resolution": "720p"
    }
  }),
});
if (!resp.ok) throw new Error(`submit failed: ${resp.status} ${await resp.text()}`);
let task = await resp.json();

// 2) Poll until a terminal state (completed / failed / cancelled).
//    This model is allowed up to 1800s server-side.
const deadline = Date.now() + 1860 * 1000;
while (!["completed", "failed", "cancelled"].includes(task.status)) {
  if (Date.now() > deadline) throw new Error(`still ${task.status} — keep the task_uuid and poll later`);
  await new Promise((r) => setTimeout(r, 3000));
  const poll = await fetch(`https://www.namifusion.com/api/v1/marketplace/run/tasks/${task.task_uuid}`, { headers: HEADERS });
  if (!poll.ok) throw new Error(`poll failed: ${poll.status}`);
  task = await poll.json();
}

console.log(task.status, task.output);

Documentation

Kling 4.0 · Video Edit

Edit an existing video using a text instruction and optional image references. Specify what should change and what motion or composition should be preserved.

Inputs

  • prompt: required string.
  • video: required single video-URL string, not an array. Source video must be at least 3 seconds; footage beyond 30 seconds is trimmed.
  • images: optional image-URL array, at most 10.
  • keep_original_sound: boolean, default true. Set false to generate new synchronized audio.
  • resolution: "720p" (default) or "1080p".
  • duration: optional integer from 3 through 30. If omitted, it follows input duration, rounded up to whole seconds and capped at 30; there is no fixed 5-second default.
  • aspect_ratio: optional "16:9", "9:16", "1:1" or "21:9". Omit to follow the source video; do not send "auto".

Limits and references

Refer to the source as @Video1. @Image1, @Image2 and later image references follow images array order. This endpoint does not accept a videos array or audio-reference uploads.

List price and initial credit charge

720p: $0.094 per counted second. 1080p: $0.141 per counted second.

Let D be output seconds and V = ceil(min(total input-video seconds, 30)). With video input, cost = rate × (D + max(D, V)). At 720p, D=5 and an 8.2-second input give V=9 and a cost of $1.316; the initial charge is 131.60 credits.

If duration is omitted, D=V. When D=V=5, cost is $0.94 at 720p or $1.41 at 1080p. The effective $0.188/$0.282 per output second is not a general formula for unequal input and output lengths.

1 USD = 100 Nami credits. Round the total charge upward to 0.01 credit: credits = ceil(cost_usd × 10000) / 100. These are list prices; no promotional discount is applied.

Reference images, aspect ratio and audio-preservation settings add no separate charge.

MaaS mapping

video remains a single string in MaaS; images remains an array. Preserve omission of duration and aspect_ratio when following the input. All other named fields retain their names in MaaS. Send duration as an integer and keep_original_sound as a boolean where supported. Array order is preserved.

Nami API

Send a POST request with Authorization: Bearer YOUR_NAMI_API_KEY and Content-Type: application/json to:

https://www.namifusion.com/api/v1/marketplace/run/kwaivgi/kling-v4.0/video-edit

Example request body:

{
  "input": {
    "video": "https://example.com/source-video.mp4",
    "images": [
      "https://example.com/jacket-reference.jpg"
    ],
    "prompt": "Change the jacket in @Video1 to match @Image1. Preserve the original subject motion, camera movement and background.",
    "keep_original_sound": true,
    "resolution": "720p"
  }
}

Replace example.com URLs with publicly accessible media URLs. Use the returned task_uuid to poll GET https://www.namifusion.com/api/v1/marketplace/run/tasks/{task_uuid} with the same authorization. On success, read generated video URLs from output.videos.

Related models

VT Lip Sync
Video to VideoNamiFusion

VT Lip Sync

VT Lip Sync synchronizes mouth movements for a translated video by using the translated target video, translated audio, translated subtitle timing, and the original source video with its original subtitle timing.

from $0.200 / per run
Kling Omni Video O3
Video to VideoKling

Kling Omni Video O3

Kling Omni Video O3 Reference-to-Video generates creative videos using character, prop, or scene references from multiple viewpoints. Extracts subject features and creates new video content while maintaining identity consistency across frames. Supports audio generation. Ready-to-use REST API, best performance, no cold starts, affordable pricing.

from $0.378 / per run
Kling Omni Video O3
Video to VideoKling

Kling Omni Video O3

Kling Omni Video O3 Reference-to-Video generates creative videos using character, prop, or scene references from multiple viewpoints. Extracts subject features and creates new video content while maintaining identity consistency across frames. Supports audio generation. Ready-to-use REST API, best performance, no cold starts, affordable pricing.

from $0.630 / per run
Kling 3.0 Standard
Video to VideoKling

Kling 3.0 Standard

Kling 3.0 Standard Motion Control transfers motion from reference videos to animate still images. Upload a character image and a motion clip (dance, action, gesture), and the model extracts the movement to generate smooth, realistic video. Ready-to-use REST inference API, best performance, no cold starts, affordable pricing.

from $0.378 / per run
seedance-2-0 reference-to-video
Video to VideoDoubao

seedance-2-0 reference-to-video

The "Reference-to-Video" feature of Seedance 2.0 is the ultimate solution for visual stylistic unity. It precisely extracts artistic styles, lighting tones, or compositional intents from reference materials and seamlessly integrates them into newly generated videos, ensuring a highly consistent visual language for your creative series.

from $0.4413 / per run
black-forest-labs/flux-3/video-upscale
Video to VideoBlack Forest Labs

black-forest-labs/flux-3/video-upscale

From $0.79 for 1 second at default creativity=1; $0.55/second at creativity=0. Billed by input duration, rounded up to whole seconds. FLUX Video Upscale enhances MP4 videos with source-faithful or creative detail reconstruction, configurable 1.5x to 3x scaling, and improved visual clarity for video restoration, social content, ads, and production workflows. Ready-to-use REST inference API, best performance, no coldstarts, affordable pricing.

from $0.790 / per run
black-forest-labs/flux-3/video-extend-draft
Video to VideoBlack Forest Labs

black-forest-labs/flux-3/video-extend-draft

FLUX 3 Video Extend Draft quickly continues a required input video into a draft clip with prompt-guided next-scene motion, optional synchronized audio, and flexible 5-20 second duration for rapid iteration.

from $0.600 / per run
black-forest-labs/flux-3/video-extend
Video to VideoBlack Forest Labs

black-forest-labs/flux-3/video-extend

FLUX 3 Video Extend continues input videos into new 5-20 second clips, using prompt guidance to control the next action, camera movement, visual style, motion continuity, and optional synchronized audio at 720P / 1080P output. Ready-to-use REST inference API, best performance, no coldstarts, affordable pricing.

from $2.05 / per run