FL GPT Captions
Bulk-caption a folder of images with GPT-4 Vision
- images
- message
- output_directory
Bulk image captioning through GPT-4 Vision - point it at a folder or feed it an image batch, and it writes a caption .txt file next to every image, at whatever concurrency batch_size allows. This is the node for building a captioned dataset for LoRA training, or just getting text descriptions of a pile of generations without doing it one image at a time.
The mechanism
Accepts input as either a directory path (input_directory) or a live IMAGE batch from earlier in the graph - pick whichever matches your workflow, not both meaningfully at once. Processes asynchronously in chunks sized by batch_size, sending each image to the chosen vision model with request_prompt as the instruction and system_prompt setting overall behavior, then saves each caption as a text file in output_directory.
Inputs and outputs that matter
model gives three choices: gpt-4o-mini, gpt-4o, or gpt-4-vision-preview - note gpt-4-vision-preview is an older, deprecated-adjacent OpenAI model name at this point, gpt-4o is the modern default for vision work and gpt-4o-mini the cheap/fast option. system_prompt defaults to "a helpful assistant that describes images accurately and concisely" - tune it to steer caption style, e.g. toward Danbooru-tag style versus natural-language sentences. request_prompt defaults to "Describe this image in detail," the actual per-image instruction. output_directory is where captions land, and overwrite controls whether an existing caption for the same image gets replaced or skipped.
max_tokens (1-4096) caps caption length, temperature (0-2, default 0.7) controls variability, and detail (auto/low/high) is OpenAI's own vision-input detail parameter - controlling how closely the model actually looks at the image. High costs more tokens and gets finer detail, low is cheaper and coarser, auto lets the API decide. batch_size (1-20) sets how many images process concurrently.
Outputs: message (status/summary of the run) and output_directory (echoing back where everything got saved - handy for chaining into a downstream node that needs that path).
Installing it
ComfyUI Manager: search Fill-Nodes, install, restart. Manually: cd ComfyUI/custom_nodes && git clone https://github.com/filliptm/ComfyUI_Fill-Nodes, then restart.
Where people get burned
This node has no api_key field on it at all - it retrieves OPENAI_API_KEY from the environment exclusively. If you're used to this pack's other GPT nodes exposing an on-node key widget, don't go looking for one here; set the environment variable before launching ComfyUI instead.
And overwrite defaults to false, which means re-running a captioning pass over a folder you've already captioned silently skips every image that already has a caption file. If you changed request_prompt or system_prompt and want fresh captions on the same folder, turn overwrite on - otherwise you'll end up with a mix of old and new captions with no indication which is which.
Inputs (11)
| Name | Type | Default | Description |
|---|---|---|---|
| model | COMBO | 3 options: gpt-4o-mini, gpt-4o, gpt-4-vision-preview | |
| system_prompt | STRING | You are a helpful assistant that describes images accurately and concisely. | — |
| request_prompt | STRING | Describe this image in detail. | — |
| output_directory | STRING | — | |
| overwrite | BOOLEAN | false | — |
| max_tokens | INT | 3001–4096 | — |
| temperature | FLOAT | 0.70–2 | — |
| detail | COMBO | 3 options: auto, low, high | |
| batch_size | INT | 51–20 | — |
| imagesopt | IMAGE | — | |
| input_directoryopt | STRING | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| message | STRING | — |
| output_directory | STRING | — |