Prompt Router
The switcher that reads its own wires — route between connected prompts
- text
- index
Every ComfyUI workflow eventually needs the same thing: "I want to flip between these three prompts without re-wiring the graph." The naive version is a text input you manually overwrite, which is exactly how you end up with three workflows when one would do. PromptRouter is the proper answer - up to 10 string inputs, one dropdown, and it intelligently names the choices for you.
The trick that makes it good
Most switch nodes make you label your inputs by hand. PromptRouter doesn't need to, because it inspects the actual graph at runtime. Connect a node called "position", another called "background", and the dropdown fills itself with 0: position, 1: background, 2: lighting - the title of each connected source node, prefixed by its index. Rename a node and the dropdown updates; disconnect one and it disappears. It even survives save/reload and undo/redo, since the selection is stored in the workflow.
On execution it outputs the selected input's text plus its index (useful if you want to drive other logic with the choice). If a connected node is bypassed, the output is an empty string rather than an error.
The inputs and outputs
selected- the dropdown itself. The internal_sub_selectedand_value_selectedfields are wiring for the advanced features below; you don't touch them.input_0throughinput_9- connectable STRING inputs, revealed one at a time as you fill them.- Outputs:
text(the routed value) andindex(the 0-based slot number).
Sub-routers and deep integration
This is where PromptRouter gets clever. If one of the connected sources is another PromptRouter, it's marked with a ▶ and selecting it reveals a second dropdown listing the child's options. Parent and child stay in sync both ways, and multiple parents sharing one child all update together. Sub-routing is limited to one level deep, which is honestly enough.
Even better, when a connected source is a PromptOptionPicker, PromptLayoutFiller, or PromptPresetSelector, it gets a ◆ marker, and selecting it reveals a third dropdown populated from that node's own options or presets. Change the picker's selection and the router reflects it; change it in the router and it pushes back into the source node. It works through one level of sub-router too, so you can build a whole control panel out of routers and pickers.
Installing it
It's part of ComfyUI-RE-CustomUtils. ComfyUI Manager → search the pack, or:
cd ComfyUI/custom_nodes
git clone https://github.com/relhamdi/ComfyUI-RE-CustomUtils
Restart ComfyUI. No extra dependencies to pip install, no models to fetch.
Known quirks worth knowing
The author documents two gotchas, and both are real:
- Getters. If you connect a value-getter node (the invisible kind that just retrieves a setter's value) to the router, the getter's name appears in the dropdown but the router reads the wrong node and hands you an empty string. The fix: link the getter through an ordinary string node before connecting it to the router. It's a one-node workaround once you know it.
- Stale sub-router lists. If a child router's connections change while it's selected in the parent, the parent's dropdown may lag until you reconnect or touch it. Annoying, but a refresh is one click away.
For a beginner the ◆/▶ indicator system takes a minute to click, but it's the difference between a bare switch and a real prompt-selection control surface. That's what you're paying for here.
Inputs (13)
| Name | Type | Default | Description |
|---|---|---|---|
| selected | STRING | -- | Select the active input. |
| _sub_selected | STRING | -- | Internal use only. |
| _value_selected | STRING | -- | Internal use only. |
| input_0opt | STRING | — | |
| input_1opt | STRING | — | |
| input_2opt | STRING | — | |
| input_3opt | STRING | — | |
| input_4opt | STRING | — | |
| input_5opt | STRING | — | |
| input_6opt | STRING | — | |
| input_7opt | STRING | — | |
| input_8opt | STRING | — | |
| input_9opt | STRING | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |
| index | INT | — |