Nodes/ComfyUI-KYNode/KY Caption Images Batch by openai-protocol local LLM services
ComfyUI Node

KY Caption Images Batch by openai-protocol local LLM services

Caption a whole dataset in one pass

By yorkane·Created 2 years ago·Updated 6 months ago· 10
KY Caption Images Batch by openai-protocol local LLM services
  • images
  • captions
protocolopenai
custom_model
model
ollama_model
system_promptYou are a movie scene director
caption_promptDescribe this image without any speculations
max_tokens200
temperature0.50
top_p0.90
frequency_penalty0.00
presence_penalty0.00
base_urlhttp://127.0.0.1:23333
api_keysk-0123456

The batch version of this pack's KY_OpenAICaptionImage, and the node's own description names the use case directly: "Caption multiple images using openai-protocol local LLM services (support MiniCPM-V)." Where the single-image version takes one IMAGE and returns one string, this one takes a whole IMAGE batch and returns a list of captions - one per image, in order - which is exactly the shape you want for building a LoRA training dataset's caption files without looping a single-image node over every file by hand.

What's different from the single-image version

Same underlying client, same protocol/model/ollama_model/base_url/api_key/sampling-parameter setup as KY_OpenAICaptionImage, and the same "You are a movie scene director" system_prompt default. The genuine difference in the schema: this version has no response_format option - it's text-only output here, no json_object mode - and the required input is images (plural), not a single image_in.

Where this earns its place in a real pipeline

Pair this directly with this pack's own KY_Load_Images_from_path: load an entire folder as a batch, feed that batch straight into this node, and you've got a full set of natural-language captions generated locally without a single external API call (assuming you're pointed at a local server, not a hosted one). That's a genuinely useful, low-friction path to building LoRA training captions if you'd rather write a good prompt for a VLM once than caption a hundred images by hand - the same underlying idea community workflows for tools like JoyCaption have been built around, just wrapped as one native node here instead of a separate custom node install.

Inputs and outputs

Required: images (IMAGE, the batch), plus the same protocol/custom_model/model/ollama_model/system_prompt/caption_prompt/max_tokens/temperature/top_p/frequency_penalty/presence_penalty/base_url/api_key set as the single-image node. One output: captions, a STRING explicitly marked as a list - one entry per image in the input batch.

Installing it

ComfyUI Manager: search ComfyUI-KYNode, install, restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/yorkane/ComfyUI-KYNode

Restart ComfyUI. Same requirement as the single-image node - a running OpenAI-protocol or Ollama server with a vision-capable model already loaded. Nothing ships bundled; this is an HTTP client, not an inference engine.

Common issues

Captioning a large batch means one HTTP request per image sent sequentially (or however this node internally paces it) to your local server - a genuinely large dataset can take a while, and a slow or overloaded local inference server will make this the bottleneck in your pipeline, not ComfyUI itself.

If captions comes back shorter than your input batch, that's worth investigating directly rather than assuming it's fine - check whether a request silently failed partway through rather than assuming every image was actually captioned; the schema gives no indication of per-item error handling.

Same model-capability caveat as the single-image version: confirm whatever you've picked in model/ollama_model/custom_model is genuinely a vision-language model your server has loaded, not a text-only model that'll caption based on nothing or error outright.

And remember KY_Load_Images_from_path's recursive default of true - if your batch came from that loader and included images you didn't mean to caption (from an unintended subfolder), that's an upstream filtering fix, not something this node can undo after the fact.

CategoryKYNode/LLM

Inputs (14)

NameTypeDefaultDescription
imagesIMAGE
protocolCOMBOopenai2 options: openai, ollama
custom_modelSTRING
modelCOMBO6 options: gpt-4o, gpt-4o-mini, chatgpt-4o-latest, gpt-4-turbo, OpenGVLab/InternVL3-8B, MiniCPM-V-2_6_awq
ollama_modelCOMBO6 options: aha2025/llama-joycaption-beta-one-hf-llava:Q8_0, qwen2.5vl:7b, qwen2.5vl:32b, XiaomiMiMo/MiMo-VL-7B-RL, openbmb/minicpm-o2.6, openbmb/minicpm-v2.6
system_promptSTRINGYou are a movie scene director
caption_promptSTRINGDescribe this image without any speculations
max_tokensINT200
temperatureFLOAT0.50
top_pFLOAT0.90
frequency_penaltyFLOAT0.00
presence_penaltyFLOAT0.00
base_urlSTRINGhttp://127.0.0.1:23333
api_keySTRINGsk-0123456

Outputs (1)

NameTypeDescription
captionsSTRING