Nifty Dynamic Prompt
Wildcards and random prompt variation with a real seed
- prompt_actions
- prompt
- template
- seed
Batch generation gets boring fast when every image uses the same prompt. Dynamic prompting fixes that with wildcards - __style__, {red|blue|green}, weighted choices - that resolve to a different concrete prompt on every run. Nifty Dynamic Prompt brings that to ComfyUI via the well-worn dynamicprompts library, and it adds the thing most other implementations skimp on: a seed that makes the variation reproducible.
How it works
The node has two socketless text boxes doing the main work:
- template - your dynamic prompt with wildcard syntax.
A portrait of __subject__ in {cinematic|studio} lighting, {##.##} lensresolves differently each run. - prompt - a manual override. If it has text, it's passed through directly and the generator is skipped. Clear it to re-generate from the template.
Then three controls: enabled (off = pass everything through untouched), seed (deterministic - same template + same seed always gives the same resolved prompt), and a prompt_actions widget with a "New Prompt" button plus a "Random on Queue" toggle, so you can force a re-roll or get a fresh prompt every time you hit queue.
Outputs: prompt (the resolved string), template (the original, passed through - handy for chaining or saving), and seed (the seed, passed through so you can log which prompt came from which seed).
Wildcards live in text files, one option per line, in your ComfyUI user folder at user/default/wildcards/ - create it if it doesn't exist. __style__ loads style.txt; __artists/painters__ digs into a subfolder. The syntax is the dynamicprompts library's, which is the same wildcard/choice syntax that's been floating around the community since the A1111 days - weighted variants {a|b|2::c}, ranges, combinatorial expansion all work.
Why the seed matters
Without determinism, "random prompt" is a black box - you can't reproduce the image that had the good lighting. With it, you can log the seed alongside the output and rerun any single variant exactly. That's the feature that separates this from a bare wildcard processor, and it's the one to reach for if you're building character reference libraries or style sweeps where you want a repeatable result per iteration.
Install
Part of Nifty Nodes for ComfyUI. Manager: search "Nifty Nodes for ComfyUI" → Install → restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/Stibo/comfyui-nifty-nodes
Restart ComfyUI. This one has a real dependency: the dynamicprompts library, which is in the pack's requirements.txt, so Manager installs it for you. If you installed manually, run pip install -r requirements.txt from the pack folder. Without the library, the node degrades gracefully - the template passes through unchanged - but you get no variation. No model files needed.
Gotchas
The wildcard folder path is fixed: user/default/wildcards/, not your models folder - a common first-miss. And the prompt override beats the template every time; if you type in the wrong box, you'll "fix" the node and watch it stop varying. Determinism note: the seed is combined with the template to produce the result, so changing the template changes what a given seed yields. That's by design - it's the whole template, not just a per-wildcard index, that the seed locks in.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | — | |
| template | STRING | — | |
| enabled | BOOLEAN | true | — |
| seed | INT | 00–1125899906842624 | — |
| prompt_actions | NIFTY_DYNAMIC_PROMPT_ACTIONS | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| prompt | STRING | — |
| template | STRING | — |
| seed | INT | — |