Nodes/ComfyUI-Text-Utility/Parse Prompt (Custom)
ComfyUI Node

Parse Prompt (Custom)

Feed A1111-style prompts (--seed 123 --steps 28) into ComfyUI, with only the pins you need

By watarika·Created 2 years ago·Updated 10 months ago· 3
Parse Prompt (Custom)
    • *
    • *
    • *
    • *
    • *
    • *
    • *
    • *
    • *
    • *
    • *
    • *
    • *
    • *
    • *
    • *
    • *
    • *
    • *
    • *
    • *
    • *
    • *
    text
    tags

    If you ever used Automatic1111's "Prompts from file or textbox", you know the format: a prompt line that carries the generation settings right on it, like masterpiece, best quality --seed 123 --steps 28 --cfg 7 --width 832 --height 1216. One line, the prompt and the recipe. Parse Prompt (Custom) brings that format into ComfyUI - and unlike its sibling node, it only shows the outputs you actually add. The graph stays clean, which is the whole point.

    How it works

    Under the hood is a shell-style tokenizer. Anything before the first -- becomes the main prompt. Each --tag value is parsed and type-converted: ints for seed/steps/width/height/batch_size/n_iter/subseed and friends, floats for cfg_scale and subseed_strength, booleans for restore_faces/tiling/do_not_save_*, strings for everything else. --prompt and --negative_prompt keep consuming tokens until the next --, so multi-word values work. If the input contains no -- at all, the entire string is just the prompt.

    The engine is forgiving on purpose: an unclosed quote or a missing value doesn't crash - it prints a warning to the console and falls back to treating the text as a prompt. There's even a 100,000-character cap so a giant string can't hang the server.

    The interesting half is the frontend. A small JavaScript file gives the node a "Tag to Add/Remove" dropdown plus Add Output and Remove Output buttons that add and remove real output sockets on the node. Your choices are stored in a hidden tags widget that's serialized into the workflow, so you load it on another machine and the same pins come back.

    Inputs and outputs

    • text (STRING, forceInput, multiline) - the prompt string. forceInput means the field is meant to be wired from another node (like a file loader) rather than typed.
    • tags (STRING, optional) - hidden bookkeeping; you don't set it by hand.
    • Outputs: dynamic, typed to match each tag. New nodes start with just prompt (STRING); you add the rest.

    Wire the values where they belong: seed → KSampler, width/height → Empty Latent Image, steps/cfg → KSampler, prompt/negative_prompt → the CLIP encoders. It's the fastest bridge when you're porting a stack of A1111 prompts or you keep your generation recipes as plain text.

    Where people get burned

    • The -- marker is the trigger. If your prompt text genuinely contains a double hyphen, the line gets re-interpreted instead of staying literal.
    • Values are one token unless they're --prompt/--negative_prompt; anything multi-word needs quotes, because it's shell-style splitting.
    • Unknown or mistyped tags don't error - they come back as empty strings. A typo means a silent empty output, not a loud failure.

    Installing

    It ships with the ComfyUI-Text-Utility pack. ComfyUI Manager → search "ComfyUI-Text-Utility" → Install → restart, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/watarika/ComfyUI-Text-Utility
    

    No pip dependencies, no models. The frontend bits load automatically from the pack's js/ folder - if the Add/Remove buttons don't appear after a fresh install, a full ComfyUI restart (not just a refresh) usually fixes it.

    Categorytext

    Inputs (2)

    NameTypeDefaultDescription
    textSTRING
    tagsoptSTRING

    Outputs (23)

    NameTypeDescription
    **
    **
    **
    **
    **
    **
    **
    **
    **
    **
    **
    **
    **
    **
    **
    **
    **
    **
    **
    **
    **
    **
    **