DataSet_OpenAIChatImageBatch
Caption a Whole Batch of Images in One Queue Run
- images
- STRING
DataSet_OpenAIChatImageBatch is the same vision-captioning trick as DataSet_OpenAIChatImage, except it takes a list of images and captions them all in one go, returning a list of captions. Where the single-image node is for one-off work, this is the one you wire into an actual dataset pipeline - feed it a batch, get a batch of captions back, save them all.
This is the node that makes the "auto-caption a training folder" workflow real: instead of running the graph once per image and babysitting it, you load a folder of images, caption them in one queue run, and write the caption files. It's the difference between "scripted by hand" and "actually convenient."
How the list input works - read this part
The node sets INPUT_IS_LIST, which changes how ComfyUI treats its inputs. Instead of a single image tensor, images arrives as a list of individual images, and the node loops over it, captioning each one and appending the result to an answers list. So wire it up the way you'd feed a batch: load multiple images so they arrive as a list, and the node chews through them sequentially.
The practical corollary: this is a sequential loop over however many images you hand it, each one a separate paid GPT-4o API call. 100 images = 100 calls, one after another. Don't queue a 5,000-image folder and expect it back in a minute - budget for it.
Inputs and output
Same family as the single-image node:
- images - the batch of IMAGE tensors.
- image_detail -
loworhigh; detail level per image, affects cost. - prompt - the caption instruction, multiline. The same prompt applies to every image, so make it generic-but-specific: "Describe the subject, pose, clothing, and background."
- model - defaults to
gpt-4o, the only sensible vision choice in the list. - api_url - OpenAI-compatible base URL override.
- token_length - response cap, default 1024.
Output is a STRING list of captions, one per input image, in order. Keep the order straight - you'll pair caption i with image i on the save side.
The key situation
OPENAI_API_KEY from the environment, as with every chat node in this pack:
export OPENAI_API_KEY=sk-...
Restart after setting it. Errors come back as strings rather than crashing the queue, so if a run silently produces junk, check the key first.
Installing
Pack standard:
cd ComfyUI/custom_nodes
git clone https://github.com/daxcay/ComfyUI-DataSet.git
cd ComfyUI-DataSet && pip install -r requirements.txt
Restart. The openai package comes from requirements.txt; nothing else is needed.
Worth flagging: this node hasn't been updated since the pack's last major refresh (Jan 2025), and there are newer, fancier batch captioners around. But it still works fine and it's right here in a pack you may already have installed. For a quick, no-fuss folder captioning run - load batch, caption, save - it's perfectly serviceable, just keep an eye on the bill and spot-check a couple of captions before you trust the whole batch.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| image_detail | COMBO | high | 2 options: low, high |
| prompt | STRING | — | |
| model | COMBO | gpt-4o | 8 options: gpt-4o, gpt-4, gpt-4-32k, gpt-3.5-turbo, gpt-4-0125-preview, gpt-4-turbo-preview, +2 |
| api_url | STRING | https://api.openai.com/v1 | — |
| token_length | INT | 1024 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |