Nodes/Comfyui-General-API-Node/Save Text (FeiMao-326)
ComfyUI Node

Save Text (FeiMao-326)

Persist prompts, LLM replies, and logs to the output folder

By FeiMao-326·Created 12 months ago·Updated 5 months ago· 0
Save Text (FeiMao-326)
    • text
    text
    filenameoutput.txt
    appendfalse

    ComfyUI is great at producing images and genuinely bad at remembering the text that made them. You generate 500 prompts through an LLM node, and when the run is over, the prompts are gone - living only inside a PNG's metadata if you're lucky. This node is the fix: it takes any text in your graph and writes it to a file in ComfyUI's output directory, so your prompts, captions, and logs survive the session.

    How it works

    Three inputs: text (the content to save, marked force-input so you can't accidentally leave it as a widget), filename (default output.txt), and append (a toggle, default off). The node resolves the output directory, joins your filename onto it, and writes.

    Two behaviors are worth knowing:

    • Subdirectories are auto-created. filename = prompts/scene_01.txt will create the prompts/ folder inside output/ for you. No manual mkdir.
    • append controls overwrite vs. accumulate. Off (default) overwrites the file each run. On, new content is appended with a trailing newline. That's the mode you want for batch runs where each iteration should add a line - the author's stated scenario is saving 1000 generated prompts during a batch production session.

    It writes UTF-8, which matters more than it sounds like for anyone working with Chinese or non-Latin prompt text - no mojibake in your saved files. And it's an output node, so it shows up in your history queue as a terminal point, and ComfyUI treats it as a graph end the same way Save Image is.

    The one output, text, just passes the input straight through - so you can chain a Save Text into the rest of the graph without breaking your flow. Save to disk and keep going in one wire.

    Where it fits

    The most common setup is at the end of an LLM-driven workflow: General API Node generates prompts → Save Text appends them to a file for later reuse, archiving, or feeding back into the next batch via the pack's Load Text. It's also the easiest way to export a caption set when you're assembling training data - pipe your captioner's output here instead of screenshotting the UI.

    Honest caveat: there's no path-escape checking, so filename is a plain join onto the output directory. Keep it to filenames and relative subpaths and you're fine. And unlike Save Image, there's no automatic counter - the overwrite behavior means a fixed filename in non-append mode is a deliberate "clobber this every run" choice.

    Inputs and outputs

    • text (STRING, force-input) - what to save.
    • filename (STRING) - target file, relative to the output folder; subpaths auto-created.
    • append (BOOLEAN) - overwrite or append each run.
    • text (STRING) - passthrough of the input.

    Installing

    It's one of the sixteen nodes in the FeiMao-326 pack. ComfyUI Manager (search "Comfyui-General-API-Node") or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/FeiMao-326/Comfyui-General-API-Node.git
    cd Comfyui-General-API-Node
    pip install -r requirements.txt
    

    Restart ComfyUI, then Add Node → FeiMao-326 → Save Text. The pack's dependencies are light (openai, numpy, Pillow, requests) and there are no model downloads.

    CategoryFeiMao-326

    Inputs (3)

    NameTypeDefaultDescription
    textSTRING
    filenameSTRINGoutput.txt
    appendBOOLEANfalse

    Outputs (1)

    NameTypeDescription
    textSTRING