Caption Save Node
Write captions to disk without leaving the graph
This is the node that turns text flowing through the graph into actual files on disk - the "save your dataset" step in a captioning workflow. If you've got an LLM or captioning model generating captions inside ComfyUI and you want those as .txt files you can point a training script at, this is the terminal node that closes the loop.
Three inputs, no outputs:
captions- the text to save. Can be a single string or a list of strings (which is what the pack's other nodes hand you).output_dir- the folder to write into. It's created for you if it doesn't exist.prefix- the filename stem.
For every caption it writes a <prefix>_<N>.txt file, so with a prefix of batch1 you get batch1_0.txt, batch1_1.txt, and so on. If you run it again with the same prefix and folder, it scans for the highest existing number and starts one past it - so you don't clobber earlier output, which is exactly what you want when you're generating captions in waves.
Where it fits
In the pack's intended pipeline, this is the write-side counterpart to the caption machinery: an Ollama captioning node reads your images and emits captions, and Caption Save Node writes them out as one file per caption - the same layout the Caption Load Node reads back in, and the layout LoRA trainers expect (image file + sibling .txt). The caption-quality half - what a good caption actually says, tags versus natural language depending on your base model - is a training concern covered elsewhere, but the mechanical part is this node's whole job: get the text out of the graph and into the training folder.
Being an output node, it has no output ports and just does its thing when the workflow runs. The author's code even prints the target directory and the captions to the console, which is a handy free sanity check mid-run.
Gotchas
- Numbering is per-prefix. Same folder, different prefix, and the new prefix starts back at
_0. It doesn't continue the previous prefix's count. If you want one continuous series, keep the prefix the same. - It appends into the folder rather than cleaning it. Old files with the same prefix survive, and new runs pick up after them. Usually what you want; occasionally you'll end up with a folder full of stale captions if you changed your prompt logic mid-way. Clear the folder when you want a clean slate.
- No overwrite protection beyond the numbering. It writes
w, notw-with-overwrite, so collisions don't happen by construction.
Installing the pack
ComfyUI Manager: Custom Nodes Manager → search ComfyUI-LLMNodes → install. Or clone manually:
cd ComfyUI/custom_nodes
git clone https://github.com/LatentGEN/ComfyUI-LLMNodes
Then restart ComfyUI. This is a pure-Python utility node - the pack's requirements.txt is empty and it declares no dependencies, so nothing extra to install. Worth a caveat that the pack itself is brand new (late 2025, no README, no author footprint in the community): fine for a save-to-disk helper, but read the source before you build a production training pipeline on it.
Troubleshooting
- No files appear - check
output_diris an absolute path; a relative one lands relative to wherever ComfyUI is running from. - "Permission denied" or similar - the node creates the directory for you, but only where your OS account can write.
- Files numbered higher than you expected - the max-index scan picked up an old file with the same prefix. That's by design.
Simple, predictable, and it does the one thing - that's a good deal in the custom-node ecosystem.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| captions | STRING | — | |
| output_dir | STRING | — | |
| prefix | STRING | — |
Outputs (0)
No outputs