GPrompts
{random|sequential} prompt text, minus the ceremony
- text
- dynprompt
- computed_prompt
- seed
The oldest trick in prompt variety is the bracket: wrap {brown|blonde|black} inside a prompt, batch it, and each run rolls a different combination. GPrompts is that trick turned into a node - plus sequential selection, wildcard files, weighted options, and a small register system - with the author's own framing being "most of the dynamic prompt nodes out there were either too complicated or too limiting, so I wrote my own." The pitch is basically: simpler than the full Dynamic Prompts extension, more capable than a hand-rolled regex.
It's a text node. You feed it a template, it outputs a computed string, and you wire that into your CLIP text encoder just like a normal prompt.
The syntax, quickly
{ green | yellow | red }- pick one at random each run.{{ green | yellow | red }}- pick sequentially, cycling through all options across runs. Four queued images give you green, yellow, red, green.__hair_color__- pull fromComfyUI/models/wildcards/hair_color.txt(or.json).__hair__hairstyles__- nested path,models/wildcards/hair/hairstyles.txt.{{0 monkey|dog}}then{{0}}- store a pick in a register and recall it later. Sequential and random blocks have separate register banks, and they reset every generation.- JSON wildcards can be weighted:
{ "whatever": [ {"summer": 6}, {"spring": 4}, {"fall": 3}, {"winter": 1} ] }- summer shows up 6 out of 14 random picks.
There's also delimiter_style, which switches the whole syntax to < > / << >>. That's for when your prompt is itself JSON and you don't want a stray { confused with a block - in angle mode a block has to contain a | or a wildcard, so prose like "3 < 5 and x > 2" is never eaten.
How the moving parts work
Sequential blocks are computed up front: the node generates every combination of your {{ }} blocks, and each run picks iteration % total_combinations. Change the text and the combination list resets. Random blocks re-roll on every execution. Reproducibility comes from seed and iteration: if seed is above 0 it's combined with the current iteration before the RNG is seeded, so fixed seed + fixed iteration = same prompt.
iteration defaults to -1, meaning "advance automatically every run" - that's what drives the sequential cycling. Set it to a positive value to hold one iteration while you tune something else. (The code treats 0 as "use -1," a quirk of the UI refusing to display -1.)
Inputs and outputs
You type the template into text. Everything else is optional. seed and iteration you've met. computed_prompt is a read-only echo of the processed result - it shows up as a widget, and it's also your output.
Outputs: text (the computed prompt - wire it to CLIPTextEncode), computed_prompt (same text, but this is the one you feed to the pack's Save Image With Notes so it lands in the PNG metadata), seed, and dynprompt. About that last one: it's a DYNPROMPT object that other nodes can theoretically consume, and the author's own advice is effectively "ignore it, hardly anyone uses it." So ignore it.
Install
It's the flagship of the Gprompts pack, so installing it installs all four nodes:
cd ComfyUI/custom_nodes
git clone https://github.com/GadzoinksOfficial/comfyui_gprompts
restart, or use ComfyUI Manager and search "Gprompts". Only dependency is pillow, no models to download, MIT. Wildcards go in ComfyUI/models/wildcards/ - the node registers that folder with ComfyUI's filesystem on load, and the pack ships a sample_wildcards folder (artists, attire, weapons, and so on) you can copy in to see the syntax working.
Where people get burned
- A missing wildcard file silently becomes an empty string.
__typoed_wildcard__doesn't error - your options just vanish into nothing, so you get a prompt with a hole in it. If output looks truncated, check the filename. - Wildcard contents are cached per node instance. Edit a wildcard file mid-session and the node may keep serving the old list until you reload the workflow.
- Keep quotes out of
{ }options. The curly random pattern deliberately refuses to match anything containing"or{, which is what makes it JSON-safe - and also what makes options with commas awkward. Use the angle style or restructure if you hit it. - Seed is only honored above zero. Seed
0means "don't seed," so don't expect seed 0 to reproduce anything.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | Input text with dynamic blocks. Curly style: {option1|option2} random, {{option1|option2}} sequential. Angle style: <option1|option2> random, <<option1|option2>> sequential. __wildcard__ for wildcard files. Registers 0-9 reuse a chosen value: {{0 monkey|dog}} stores the pick, {{0}} recalls it (sequential and random banks are separate). | |
| delimiter_styleopt | COMBO | curly { } | Delimiters for dynamic blocks. 'curly { }' is the classic {a|b} / {{a|b}} syntax (now JSON-safe). 'angle < >' uses <a|b> / <<a|b>> instead, handy when the prompt itself is JSON. |
| seedopt | INT | 00–18446744073709550000 | Seed for random generation (combined with iteration for reproducibility) |
| iterationopt | INT | -1 | Iteration counter (-1 for auto-increment, 1+ for fixed iteration) |
| computed_promptopt | STRING | Output of the processed prompt (read-only) |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |
| dynprompt | DYNPROMPT | — |
| computed_prompt | STRING | — |
| seed | INT | — |