Nodes/ComfyUI-KLingAI-API/Image Generator
ComfyUI Node

Image Generator

Text-to-image and face/subject-locked img2img from Kuaishou's cloud

By KlingAIResearch·Created 2 years ago·Updated 10 months ago· 174
Image Generator
  • client
  • image
  • image
model
prompt
negative_prompt
image_reference
image_fidelity0.5
human_fidelity0.5
image_num1
aspect_ratio
resolution

This is KLing AI's own text-to-image model showing up as a ComfyUI node - no local weights, no VRAM budget, just an API call to Kuaishou's servers. KLing (the video/image arm of Kuaishou, the company behind the Kwai short-video app) is one of the bigger closed Chinese image and video generators, in the same conversation as Google's Nano Banana or Midjourney rather than anything you'd run on your own 4090. The reason you'd reach for this node specifically instead of just using KLing's own web app is that it slots into a ComfyUI graph - you can pipe its output into local post-processing, or use it as the seed image for KLing's own video nodes further down the same pack.

How it works

Nothing runs on your machine. The node packages your prompt (and optionally a reference image) into a request, sends it to KLing's API, and polls until the image comes back - the polling cadence is set on the Client node this one plugs into, not here. Where it gets interesting is the reference-image path: give it an image and it stops being pure text-to-image and starts being identity-conditioned generation, closer to what you'd use IPAdapter or a face LoRA for locally, except KLing does the consistency modeling server-side.

The inputs and outputs that matter

Required: model - a straight version pick (kling-v1 through the newer kling-v2-1; higher numbers generally mean better prompt adherence and photorealism, at KLing's discretion, not yours) - and prompt, plain text, multiline.

The interesting knobs are optional:

  • image - a reference image. Without it you get plain text-to-image.
  • image_reference - None, subject, or face. This is the mode switch for how hard the reference image is enforced: face locks onto facial identity, subject is looser, holding the general subject rather than the exact face.
  • image_fidelity and human_fidelity (0–1 each) - how strictly the output sticks to the reference image overall vs. specifically to the human in it. Push these up when the model is drifting too far from your reference; pull them down if it's producing a stiff, over-copied result.
  • image_num (0–9) - batch count in one call.
  • aspect_ratio - the usual spread (16:9, 9:16, 1:1, 4:3, etc.).
  • negative_prompt and resolution are there too, self-explanatory.

Output is a single image - wire it straight into a Preview/Save Image node, or hand it to Image2Video/Effects downstream as the seed frame for a KLing video job.

Installing it

Through ComfyUI Manager: search ComfyUI-KLingAI-API, install, restart. By hand:

cd ComfyUI/custom_nodes
git clone https://github.com/KwaiVGI/ComfyUI-KLingAI-API
cd ComfyUI-KLingAI-API && pip install -r requirements.txt

No model downloads - there's nothing local to fetch. What you do need before anything works is a KLing AI API key (an access_key/secret_key pair) from KLing's own developer console, wired into a Client node upstream of this one. The README's one nice touch: if you don't want the key sitting in plain text inside a workflow you might share, you can drop it into the pack's config.ini instead and leave the Client node's fields blank.

Common issues

Since this is a metered API call, not a local model, most "it's not working" problems trace back to the account, not the node: a missing or expired key on the Client node, a key registered for the wrong area (KLing separates global and china accounts - a China-registered key won't authenticate against the global endpoint), or simply no remaining balance on your KLing account. If the node just seems to hang, that's the async poll working as intended - image jobs are usually fast, but there's no local progress bar, so give it a few seconds before assuming it's stuck. And because this bills your KLing account per call, it's worth testing prompts cheaply in KLing's own web UI first before wiring up a big batch through image_num.

CategoryKLingAI

Inputs (11)

NameTypeDefaultDescription
clientKLING_AI_API_CLIENT
modelCOMBO5 options: kling-v1, kling-v1-5, kling-v2, kling-v2-new, kling-v2-1
promptSTRING
negative_promptoptSTRING
imageoptIMAGE
image_referenceoptCOMBO3 options: None, subject, face
image_fidelityoptFLOAT0.50–1
human_fidelityoptFLOAT0.50–1
image_numoptINT10–9
aspect_ratiooptCOMBO7 options: 16:9, 9:16, 1:1, 4:3, 3:4, 3:2, +1
resolutionoptSTRING

Outputs (1)

NameTypeDescription
imageIMAGE