ComfyUI-Kling-Direct
Full-featured Kling AI integration for ComfyUI - Video, Image, Audio generation
Nodes (42)
Lip-Sync That Knows Which Face to Move
Why Isn't My Kling Workflow Running? Check Here First
The Tiny Node That Stops Kling From Stretching Your Image
Getting Your Media Into Kling's Vault, On Purpose
Type 'Rain on a Tin Roof' and Get the Sound
One Node to Unlock Every Other Kling Node
Your Still Image, Talking and Moving
Hand-Steering Kling's Motion
Cinematic Camera Moves Without Learning What a Dutch Angle Is
The Upload Node That Asks You to Read the Fine Print
How Many Credits Is That Render Going to Eat?
See Every Video Effect Kling Actually Offers, Right Now
Packing a Kling Character ID So You Can Reuse It
Save the Video Without Loading It Into VRAM
Outpainting Your Image Into a Wider World
Text-to-Image With Kling's Hosted v3, Right in the Graph
Generate With a Reference Image, by Mentioning It in the Prompt
Ask Kling What's in the Image, Get a Description Back
Kling Image-to-Video, Done Direct
Animating Between Keyframes
Kling lip-sync without leaving ComfyUI
The URLs-only shortcut
Kling motion transfer
One character, six consistent shots — Kling's answer to character drift
Get any file out of ComfyUI's input folder as a plain path
Save a file from a URL or path without loading it into a tensor
The one node that fixes 'why does my Kling API call 401'
Peek at a running Kling job without polling or paying twice
Kling's flagship text-to-video, dropped straight into your ComfyUI graph
A voice for your silent clip without running a TTS model
Kling TTS with the training wheels off — and the honest truth about 'advanced'
Kling's upscaler for image or video, targeted by task ID
Make two people hug, kiss, or heart each other — with one effect name
Append seconds to a finished Kling video — by task ID, not re-render
Load a local video as frames, path, and audio in one shot
References in, video out, all in one prompt
Pull (or generate) the audio from any video, no local decode needed
Turn an IMAGE batch into a real .mp4, without VideoHelperSuite
Kling's Kolors virtual try-on
Dump every Kling TTS voice to JSON — before you pick one
Give Your Kling TTS an Actual Human Voice
The Kling Voice Picker That Costs Nothing
ComfyUI-Kling-Direct
Full-featured ComfyUI custom-node pack for Kling AI's direct API. Video generation (text-to-video, image-to-video, lip-sync, advanced face-aware lip-sync, motion control, avatar, video extend, omni-video, effects), image generation (text-to-image, image-omni, image extend, virtual try-on, multi-shot, recognize, upscale), and audio (TTS, text-to-audio, voice cloning, video-to-audio).
42 nodes. 49 tests. Direct API — no third-party middleware.
Install
ComfyUI Manager → Install Custom Nodes → search "Kling Direct" → Install. Restart ComfyUI.
Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/IxMxAMAR/ComfyUI-Kling-Direct
The pack uses only stdlib + requests / Pillow / numpy / torch / opencv-python (already in ComfyUI).
Authentication
- Get a Kling access key + secret key at https://app.klingai.com/global/dev (requires KYC activation on a new account).
- Drop in the Kling AI Authentication node, paste the keys (they're masked). Or set the env vars
KLING_ACCESS_KEY/KLING_SECRET_KEYand leave the fields blank. - Wire the
authoutput into every other Kling node.
A new Kling API Health Check node verifies auth + connectivity in one click — is_healthy BOOLEAN + a status string. Use it to debug "why isn't my workflow running."
Region
Optional Kling Region Selector node sits between Auth and the rest of the workflow and switches the API base URL:
singapore—https://api-singapore.klingai.com(default; global accounts)china—https://api.klingai.comus—https://api-us.klingai.com- custom — paste a proxy / self-hosted gateway
Nodes
Video
- Text to Video — full Kling v3 / v2.5-turbo / v2.6 / v2-master / v1.6 with aspect ratio, duration, mode (pro/std), sound, cfg_scale, shot_type, optional camera control.
- Image to Video — image-driven generation, optional
image_tailfor end frame, camera control. - Keyframe Video (Start+End) (v2.1 new) — convenience wrapper for image-to-video that takes a start AND end image.
- Video Omni — Kling Omni model with multi-image / video references via
@image1,@video1prompt syntax. - Video Extend — append N more seconds to a previous Kling video by
video_id. - Lip Sync — standard lip-sync,
audio2videoortext2video(TTS) mode. - Lip Sync (URLs) (v2.1 new) — convenience wrapper for the URL-only case.
- Advanced Lip Sync — face-aware lip-sync with explicit face_index + volume.
- Motion Control — apply motion from a reference video to a still image.
- Avatar Generation — digital-human animation from an image + optional audio.
Image
- Image Generation — Kling v3 text-to-image, batch up to 9.
- Image Omni — image-conditioned generation with reference images.
- Image Extend — outpainting / aspect-ratio expansion.
- Virtual Try-On — Kolors clothing transfer.
- Multi-Shot — up to 6 consistent shots from a single prompt.
- Image Recognize — Kling vision model description.
Audio
- Text to Audio — ambient / SFX generation by text.
- Text to Speech (v2.1: now exposes voice_speed + voice_language) — quick TTS with a voice_id.
- TTS Advanced — full TTS with speed + language.
- Voice Clone — clone a voice from an audio sample; returns a reusable
voice_id. - Video to Audio — extract / generate audio from a video URL.
Effects
- Video Effects —
hug,kiss,heart, etc. on one or two images. - Effect Templates — fetch available templates JSON.
- AI Upscale — image or video upscaling.
Config / utilities
- Kling AI Authentication — access_key + secret_key + debug toggle.
- Region Selector (v2.1) — switch API endpoint.
- Camera Control — manual 6-axis camera input.
- Camera Preset (v2.1) — 15 cinematic presets (
orbit_left,dolly_in,zoom_in,pan_right, etc.) with intensity scaler. - Aspect Ratio Picker (v2.1) — closest valid Kling ratio for a given IMAGE.
- Cost Estimator (v2.1) — local credit estimate by model + duration + mode.
- Task Status (v2.1) — one-shot status check (no polling, no download) for async chaining.
- API Health Check (v2.1) — verify auth + connectivity.
- Voice Selector — preset voice dropdown.
- Voice Catalog (v2.1) — dump the full preset catalog as JSON.
- Element / Asset Upload — upload arbitrary assets to Kling materials API.
- Video Loader / Raw File Loader / Raw File Saver — local I/O helpers.
- Cloud Uploader — push media to catbox / litterbox / 0x0 / uguu / tmpfiles for URL-based Kling inputs. Requires explicit consent (see Security below).
- Fast Video Saver — stream-download a video URL to disk without loading into a tensor (OOM safe).
- Video to File (MP4) (v2.1) — write a ComfyUI IMAGE batch to
.mp4via cv2.VideoWriter.
v2.1 Highlights
- Security: JWT / API secret no longer leaks via exception tracebacks; SSRF + scheme guard on all downloads; cloud uploader requires explicit consent; path-traversal block on
task_id. - Memory:
load_video_to_tensorpre-allocates the final tensor — ~3× less peak RAM (was OOM on 600-frame 1080p videos). - Correctness: cv2 cap leak fixed on early-fail path; empty-waveform crash fixed;
time.monotonic()everywhere; LipSyncvoice_speedomitted inaudio2video;1106moved to permanent (was useless retries); high-qualitytorchaudioresampling. - UX: ComfyUI cancellation propagates within ~1 s;
ProgressBarwired; long-task polling backoff extended with jitter;Retry-AfterHTTP-date support. - +10 new nodes (see "v2.1 new" tags above).
- 49 tests —
python -m pytest tests/(all mocked, no real Kling calls).
See CHANGELOG.md for full details.
Security & Privacy
- API keys are masked in the Auth node and never logged.
- v2.1 ensures the signed JWT never appears in tracebacks even when the network errors out — safe to share your ComfyUI console log when reporting a bug.
- Cloud Uploader uploads to PUBLIC, unauthenticated paste-bin hosts. Anyone with the URL can view the file. Catbox & 0x0 are PERMANENT. You must tick
i_understand_uploads_are_publicbefore the node will run. - Set
KLING_ALLOW_INTERNAL_HTTP=1to allow downloads from loopback / RFC1918 hosts (off by default).
Tests
python -m pytest tests/
All 49 tests pass in ~6 seconds. Every HTTP method is mocked — no real Kling API calls are made.
License
MIT — see LICENSE.