Kling Reference to Image
Kling Reference to Image
- auth
- subject_image_1
- subject_image_2
- subject_image_3
- subject_image_4
- scene_image
- style_image
- image
- url
- task_id
When you generate a character image locally, you're usually fighting three things at once that the graph has no way to separate: who the character is, what's behind them, and what it's rendered like. IP-Adapter, ControlNet, LoRAs, prompt weighting - every tool in the stack is some attempt to pull those three knobs apart. This node just makes them three different inputs.
It runs kling-v2-1 against /v1/images/multi-image2image, and it's the image-side counterpart to Multi-Image to Video.
The inputs
subject_image_1 is required, with the tooltip you'll see on every Kling reference node in this pack: crop to the subject first, because Kling does not crop. subject_image_2 through subject_image_4 are optional further views of the same person or object - more angles, better identity lock.
scene_image and style_image are each a single optional image, and they do what they say: the scene the subject is placed into, and the look it's rendered in. Keeping them separate from the subject is the entire point. Give it a portrait, an empty street at dusk, and a film-still you like the grade of, and the reference structure tells the model which is which.
prompt is a text description. It's listed as required with an empty default, and the code sends nothing when it's blank, so you can genuinely leave it empty and let the reference images drive - but a sentence about lighting and composition usually earns its keep.
aspect_ratio has eight options - 16:9, 9:16, 1:1, 3:2, 2:3, 4:3, 3:4 and 21:9 - which is a wider set than most nodes in this pack offer, and worth using. n generates between 1 and 9 images in one call.
Outputs
image is an IMAGE batch. If n is greater than one, every returned image is concatenated into that single batch, so a downstream save or preview node will iterate over all of them. url is the Kling-hosted link for the first image only - if you asked for nine and want to grab them individually off Kling's CDN, this output won't do it. task_id is the job id for tracing on Kling's side. The node raises if a succeeded task comes back with no image URLs rather than returning an empty batch.
Installing
cd ComfyUI/custom_nodes
git clone https://github.com/IxMxAMAR/ComfyUI-API-Toolkit
cd ComfyUI-API-Toolkit
pip install -r requirements.txt
requests and PyJWT for Kling; no weights, no VRAM. Manager → "API Toolkit" if you'd rather not touch a terminal. Keys live on the Kling AI Authentication node (KLING_ACCESS_KEY / KLING_SECRET_KEY, or KLING_API_KEY), and if the Kling nodes don't appear at all, the dependency that failed is PyJWT - each service in this pack loads or skips independently.
The honest read on when to use it
This is a strong fit for the thing local workflows are worst at: a specific subject in a specific scene with a specific look, first try. It's also the cleanest way to build a consistent set of images for one character - lock the subject images, vary the scene and style images, and you get a coherent set without a LoRA.
Where it's the wrong tool: n: 9 on an experimental prompt is nine images of billable API spend, so get to one good image first. And it's a closed, filtered service - the reference images you upload leave your machine, which for a face or a client asset is a decision, not a detail.
Crop the subject images. It bears repeating because it's the most common complaint about every Kling reference node in this pack. Sticking a full-body photo in subject_image_1 when you want a headshot gives the model a lot of information you didn't mean to give it.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| auth | KLING_AUTH | — | |
| prompt | STRING | Text description of the image. | |
| subject_image_1 | IMAGE | Subject reference image. Crop to the subject first: Kling does not crop. | |
| aspect_ratio | COMBO | 1:1 | Output image aspect ratio. |
| n | INT | 11–9 | Number of images to generate (1-9). |
| subject_image_2opt | IMAGE | — | |
| subject_image_3opt | IMAGE | — | |
| subject_image_4opt | IMAGE | — | |
| scene_imageopt | IMAGE | Scene reference image. | |
| style_imageopt | IMAGE | Style reference image. |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| url | STRING | — |
| task_id | STRING | — |