Extensions/ComfyUI-Kling-Direct
ComfyUI Extension

ComfyUI-Kling-Direct

Full-featured Kling AI integration for ComfyUI - Video, Image, Audio generation

By IxMxAMAR·Created 5 months ago·Updated 2 months ago· 4
IxMxAMAR/ComfyUI-Kling-Direct
Nodes42
On cloudLocal install
CategoryKling AI/Video, Kling AI/Config
Stars4
Updated2 months ago

Nodes (42)

Kling Advanced Lip Sync

Lip-Sync That Knows Which Face to Move

Kling AI/Video
Kling API Health Check

Why Isn't My Kling Workflow Running? Check Here First

Kling AI/Config
Kling Aspect Ratio Picker

The Tiny Node That Stops Kling From Stretching Your Image

Kling AI/Config
Kling AI Asset Upload

Getting Your Media Into Kling's Vault, On Purpose

Kling AI/Config
Kling Text to Audio

Type 'Rain on a Tin Roof' and Get the Sound

Kling AI/Audio
Kling AI Authentication

One Node to Unlock Every Other Kling Node

Kling AI/Config
Kling Avatar Generation

Your Still Image, Talking and Moving

Kling AI/Video
Kling Camera Control

Hand-Steering Kling's Motion

Kling AI/Config
Kling Camera Preset

Cinematic Camera Moves Without Learning What a Dutch Angle Is

Kling AI/Config
Kling AI Cloud Uploader

The Upload Node That Asks You to Read the Fine Print

Kling AI/Config
Kling Cost Estimator

How Many Credits Is That Render Going to Eat?

Kling AI/Config
Kling Effect Templates

See Every Video Effect Kling Actually Offers, Right Now

Kling AI/Effects
Kling AI Element

Packing a Kling Character ID So You Can Reuse It

Kling AI/Config
Kling Fast Video Saver

Save the Video Without Loading It Into VRAM

Kling AI/Config
Kling Image Extend

Outpainting Your Image Into a Wider World

Kling AI/Image
Kling Image Generation

Text-to-Image With Kling's Hosted v3, Right in the Graph

Kling AI/Image
Kling Image Omni

Generate With a Reference Image, by Mentioning It in the Prompt

Kling AI/Image
Kling Image Recognize

Ask Kling What's in the Image, Get a Description Back

Kling AI/Image
Kling Image to Video

Kling Image-to-Video, Done Direct

Kling AI/Video
Kling Keyframe Video (Start+End)

Animating Between Keyframes

Kling AI/Video
Kling Lip Sync

Kling lip-sync without leaving ComfyUI

Kling AI/Video
Kling Lip Sync (URLs)

The URLs-only shortcut

Kling AI/Video
Kling Motion Control

Kling motion transfer

Kling AI/Video
Kling AI Multi-Shot

One character, six consistent shots — Kling's answer to character drift

Kling AI/Image
Kling Raw File Loader

Get any file out of ComfyUI's input folder as a plain path

Kling AI/Config
Kling Raw File Saver

Save a file from a URL or path without loading it into a tensor

Kling AI/Config
Kling Region Selector

The one node that fixes 'why does my Kling API call 401'

Kling AI/Config
Kling Task Status

Peek at a running Kling job without polling or paying twice

Kling AI/Config
Kling Text to Video

Kling's flagship text-to-video, dropped straight into your ComfyUI graph

Kling AI/Video
Kling Text to Speech

A voice for your silent clip without running a TTS model

Kling AI/Audio
Kling TTS Advanced

Kling TTS with the training wheels off — and the honest truth about 'advanced'

Kling AI/Audio
Kling AI Upscale

Kling's upscaler for image or video, targeted by task ID

Kling AI/Effects
Kling Video Effects

Make two people hug, kiss, or heart each other — with one effect name

Kling AI/Effects
Kling Video Extend

Append seconds to a finished Kling video — by task ID, not re-render

Kling AI/Video
Kling Video Loader

Load a local video as frames, path, and audio in one shot

Kling AI/Config
Kling Video Omni

References in, video out, all in one prompt

Kling AI/Video
Kling Video to Audio

Pull (or generate) the audio from any video, no local decode needed

Kling AI/Audio
Kling Video to File (MP4)

Turn an IMAGE batch into a real .mp4, without VideoHelperSuite

Kling AI/Config
Kling Virtual Try-On

Kling's Kolors virtual try-on

Kling AI/Image
Kling Voice Catalog

Dump every Kling TTS voice to JSON — before you pick one

Kling AI/Config
Kling Voice Clone

Give Your Kling TTS an Actual Human Voice

Kling AI/Audio
Kling Voice Selector

The Kling Voice Picker That Costs Nothing

Kling AI/Config
Readme

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

  1. Get a Kling access key + secret key at https://app.klingai.com/global/dev (requires KYC activation on a new account).
  2. Drop in the Kling AI Authentication node, paste the keys (they're masked). Or set the env vars KLING_ACCESS_KEY / KLING_SECRET_KEY and leave the fields blank.
  3. Wire the auth output 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:

  • singaporehttps://api-singapore.klingai.com (default; global accounts)
  • chinahttps://api.klingai.com
  • ushttps://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_tail for 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, @video1 prompt syntax.
  • Video Extend — append N more seconds to a previous Kling video by video_id.
  • Lip Sync — standard lip-sync, audio2video or text2video (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 Effectshug, 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 .mp4 via 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_tensor pre-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; LipSync voice_speed omitted in audio2video; 1106 moved to permanent (was useless retries); high-quality torchaudio resampling.
  • UX: ComfyUI cancellation propagates within ~1 s; ProgressBar wired; long-task polling backoff extended with jitter; Retry-After HTTP-date support.
  • +10 new nodes (see "v2.1 new" tags above).
  • 49 testspython -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_public before the node will run.
  • Set KLING_ALLOW_INTERNAL_HTTP=1 to 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.