Nodes/KIE.ai Nodes Next/Kling 4.0 Keyframe To Video
ComfyUI Node

Kling 4.0 Keyframe To Video

Your prompt has to name the frames it uses

By felipederosilva·Created 2 months ago·Updated 3 days ago· 3
Kling 4.0 Keyframe To Video
  • first_frame_url
  • keyframe_urls
  • last_frame_url
  • video
  • url
  • all_urls_json
  • task_id
  • raw_json
  • credits_consumed
  • credits_left
◄promptThe girl in @first_frame walks out, passes the street in @keyframe_1, and arrives at the party in @last_frame►
◄duration5►
◄resolution720p►
◄aspect_ratioauto►
◄timeout_seconds1200►
◄callback_url►

Kling's keyframe mode is the most useful trick in AI video right now and the most awkward one to explain: you hand it a first frame, a last frame, and optionally a few middle frames, and it animates the path between them. But the prompt isn't a scene description, it's a script that references the images by name - @first_frame, @keyframe_1, @last_frame. Get the names wrong and the request is rejected outright.

What it is

KIE_Next_kling_4_0_keyframe_to_video_d37112a2 is one of the per-model nodes the KIE Next pack generates from KIE's catalog, a thin client over KIE's Kling 4.0 endpoint. The video isn't rendered locally - Kling is a closed model, so there was never a local option - and this node is how it gets into your graph.

Why you'd reach for it: local video tops out around five seconds of native context and eats your afternoon, while keyframing is the one thing that fixes the "it looks great but it went somewhere else" problem. You draw the destination. That's a different workflow from prompting text-to-video and praying.

How it works

Same pipeline as every generated node in the pack: build the documented request, upload any connected media and substitute the returned URLs, create the task, poll until timeout_seconds (1200 by default), then download the first result into a VIDEO object. Credits spent appear on the node face; the task ID comes out as a socket.

The @ mentions are the interesting part. The node's own tooltip is emphatic: mention only frames you actually supplied, every mention must match an asset in the request, and matching is "longest-match against declared names". So the safest prompt is one that uses the documented names exactly as written.

The inputs that matter

prompt is required, up to 10,000 characters. Something like the pack's default - "The girl in @first_frame walks out, passes the street in @keyframe_1, and arrives at the party in @last_frame" - is the shape you want: subject, motion, and the frame references carrying the geography.

The frame sockets are first_frame_url, keyframe_urls and last_frame_url, all native IMAGE inputs. keyframe_urls accepts a batch, in chronological order, up to eight images - but see duration below, because the count you can actually use is capped.

duration (3–30 seconds, default 5) does double duty. KIE documents it as also capping the total frame count: 3s → 4 frames, 4s → 5, 5s → 6, 6s → 7, 7s → 8, 8s → 9, and 9s or longer → 10 frames. So if you wire in six keyframes and leave duration at 5, you've asked for seven frames on a budget of six. Raise the duration or drop a frame.

resolution is 720p or 1080p. aspect_ratio (auto, 16:9, 9:16, 1:1, 21:9) only applies when you supply no frames at all - it's a text-to-video leftover. With any frame connected, the output follows the first frame's ratio and the setting is ignored.

Outputs

video is a ComfyUI VIDEO, which is a fussier type than IMAGE - the pack ships KIE • Preview Video and KIE • Save Video under KIE Next / Utility / Media for exactly this. Preview plays it in the node and keeps the file under output/KIE-Previews; Save writes to output/KIE-Videos and returns a saved_file value that KIE • Persistent Load Video can pick up in a later workflow.

url is the provider link, task_id is what KIE • Reuse Completed Image/Video/Audio wants, all_urls_json and raw_json are for when something looks off, and credits_consumed/credits_left tell you the damage. This isn't an output node, so nothing executes until the video is consumed downstream.

Installing it

ComfyUI Manager → search "KIE.ai Nodes Next", or:

comfy node install kie-ai-nodes-next

Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/felipederosilva/ComfyUI-KIE-Nodes-Next
pip install -r requirements.txt

Restart, then Settings → KIE.ai Nodes Next → Connection and paste your KIE.ai key. The pack validates it before saving, shows only a masked fingerprint afterwards, and keeps it out of workflow JSON. Env-var keys aren't supported.

Dependencies are requests, Pillow, numpy, PyYAML. No weights, no VRAM floor - the GPU is Kling's.

Where people get burned

The mention mismatch. A leftover @keyframe_2 in a prompt when you only supplied one keyframe is a hard rejection, not a graceful ignore. Trim the prompt when you trim the frames.

Duration versus frame budget. Covered above, and it's the one people notice last: the clip comes back shorter or the request looks wrong, because the frame list exceeded what the duration allows.

Cost per attempt. Every one of these is a paid job, and video is where the credits go. Iterate cheap at 720p and short, then do the final at 1080p. If you queued one and it failed on validation, you lost nothing - the pack's local preflight checks the documented fields before upload - but a successful run that you hate still costs full price. Right-click → KIE Next · Check inputs & model controls inspects the cached documented limits without submitting anything.

CategoryKIE Next/Video/Kling

Inputs (9)

NameTypeDefaultDescription
promptSTRINGThe girl in @first_frame walks out, passes the street in @keyframe_1, and arrives at the party in @last_frameVideo description. Required. Maximum 10000 characters. Use `@first_frame`, `@keyframe_1`, `@keyframe_2`, …, `@last_frame` to mention frames that you uploaded in this request. You can only mention frames that are actually provided. Every `@` mention must match an asset included in this request, otherwise the request is rejected. Mentions use longest-match against declared names. If the matched name ends with a letter, digit, or underscore, the next character cannot be a letter, digit, or underscore.
durationoptINT53–30Output video duration in seconds. Integer from 3 to 30. Default: `5`. Also caps the total number of frames (first + middle + last): - 3 s → 4 frames - 4 s → 5 frames - 5 s → 6 frames - 6 s → 7 frames - 7 s → 8 frames - 8 s → 9 frames - 9 s or longer → 10 frames
resolutionoptCOMBO720pOutput resolution. `720p` or `1080p`. Default: `720p`.
first_frame_urloptIMAGEFirst-frame image URL. Mention it in the prompt as `@first_frame`.
keyframe_urlsoptIMAGEMiddle-frame image URLs, in chronological order. Up to 8 images, also limited by `duration`. Mention them in the prompt as `@keyframe_1`, `@keyframe_2`, ….
last_frame_urloptIMAGELast-frame image URL. Mention it in the prompt as `@last_frame`.
aspect_ratiooptCOMBOautoOutput aspect ratio. Only used when no frame is provided (text-to-video); default is `16:9`. If any frame is provided, the output follows the first frame's aspect ratio.
timeout_secondsoptINT120030–7200—
callback_urloptSTRINGOptional KIE callback URL. Leave empty for normal ComfyUI use.

Outputs (7)

NameTypeDescription
videoVIDEO—
urlSTRING—
all_urls_jsonSTRING—
task_idSTRING—
raw_jsonSTRING—
credits_consumedFLOAT—
credits_leftFLOAT—