Variables Injector
Change the subject without touching the prompt
- text
Variables Injector is the "same workflow, different subject" node. You write a prompt once with placeholders like !item, define what item is, and the node swaps them out before the text ever reaches the encoder. It's dumb string substitution on purpose - no templates, no regex, just !name → value. That simplicity is the feature: you can hand a workflow to someone who's never touched ComfyUI and tell them to change one string and nothing else.
How it works
The mechanism is easy to reason about. Connect string sources to Var1 through Var8, each holding name | value (like item | bag), write your prompt with !item, and the text output gets A woman holding a bag. Under the hood the Python just runs prompt.replace("!name", value) for each variable, splitting each var input on the first | and stripping whitespace. Up to eight variables, and the JS extension adds Var2–Var8 only as you connect them, so you never stare at a wall of unused inputs.
The inputs that matter
Var1(STRING, required) - your first variable, inname | valueformat. It's a forced input: connect a string node, you can't type a value into the node itself.prompt(STRING, multiline) - the template containing!placeholders.- Output:
text(STRING) - wire it into the CLIP Text Encode node's positive (or negative) prompt.
Where it shines
A/B testing a list of subjects without touching the graph, commission or client workflows where only the subject changes between runs, or keeping one canonical prompt template that a whole team reuses. The README's example is item | bag → "A woman holding a !item" → "A woman holding a bag", which tells you everything about the ambition level. If you need more power - computed values, conditionals, functions - that's rgthree's Power Puter or a String Function node's job. This is the twenty-line version, and for template substitution that's often exactly enough.
The fiddly bits
- Format is exact:
name | value, one pipe. If the pipe is missing the variable is silently skipped - no warning. - It's literal, case-sensitive find-and-replace.
!Itemwon't match!item, and a placeholder you never define stays in the output verbatim. - Every variable needs its own connected string node. It's mildly annoying at six variables, but it's the trade that keeps values editable without opening the node.
- Avoid using
!in your prompt for anything else. Any!somethingthat collides with a defined name gets replaced whether you meant it or not, because replacement is exact and unconditional.
Install
Install is the same as the rest of the Finetuners suite - no dependencies beyond ComfyUI itself, no models to download:
cd ComfyUI/custom_nodes
git clone https://github.com/FinetunersAI/ComfyUI_Finetuners_Suite
Restart ComfyUI and it shows up under the "finetuners" category. One trap: the README's install command references a stale finetunersTest repo - clone the Suite repo above (or install via ComfyUI Manager, which uses the right URL). When it loads you'll see a blue "ComfyUI Finetuners: Loaded" line in the console.
It's a small node, and it knows it. Reach for it when the alternative is editing prompts inside a crowded graph eight times a day.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| Var1 | STRING | — | |
| prompt | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |