Any Switch
The don't-care-about-types router every workflow ends up with
- input_01
- input_02
- input_03
- input_04
- input_05
- output
Somewhere around your twentieth node you hit the question ComfyUI doesn't ask for you: "I have two different things feeding this one socket, which one is live right now?" Most switch nodes dodge it by demanding a specific type. Any Switch's whole trick is that it doesn't care what you wire in.
The node is an index-based router. You drop up to five inputs on it - an image, a latent, a string, a model, a weird hybrid of all of them - and the index widget decides which one comes out the other side. It works because the inputs are declared with ComfyUI's wildcard * type, the escape hatch that accepts any socket, and the backend is told to skip type-checking (the source returns True from VALIDATE_INPUTS, which is the standard convention for any-type nodes). Under the hood it just collects every non-empty input_01 through input_05 and returns the one at index, clamped so it never errors if you point past the last wired input.
The inputs that matter
index- the selector, an integer from 0 up. 0 is the first connected input.input_01throughinput_05- the candidates. Leave the ones you're not using disconnected.
Output is a single output socket that carries whatever type the selected input had. If nothing is connected you get None out, which downstream optional inputs read as "not connected" - that's the standard first-non-null pattern the whole plumbing layer runs on.
Where this differs from the node you might be thinking of: rgthree's much-loved Any Switch is a fallback switch - no selector, it just passes the first non-null input. This one is a manual valve with a dial. If you want "whichever branch is actually doing something wins," you want rgthree's. If you want to flip between two model loaders or two image sources from one integer, this is the one. The honest downside: because the type is only known at runtime, ComfyUI can't draw the wire colors or warn you before execution. You wire blind. That's the price of "any."
Where it fits
This is pure plumbing, and that's fine - it's exactly the repetition-fighting, graph-simplifying layer that comfyui-node-plumbing describes. One integer driving which of five image sources flows into a sampler is a lot more readable than five separate bypassed branches. It also plays well with the rest of Steaked-nodes, which is a grab-bag of image tools, so having one generic router on hand for whatever you're compositing keeps the graph tidy.
Install
It ships in Steaked-nodes, a small one-author pack. Install the whole pack once and you get all 20-ish nodes:
cd ComfyUI/custom_nodes
git clone https://github.com/StealthNinja1O1/Steaked-nodes
Restart ComfyUI. Or find Steaked-nodes in ComfyUI Manager → Install Custom Nodes. The only dependencies are torch, numpy and Pillow - all already in your ComfyUI environment, so there's nothing extra to download and no model files.
Gotchas
Two things bite people. First, inputs that aren't connected are skipped entirely, so if you expect index 3 to be "nothing," you can't - the node only counts what's actually wired, and index 3 becomes whatever the third connected input is. Second, there's no visual type indicator; if you rewire inputs to different types and forget to bump index, you'll get a silent type mismatch downstream that can look like a broken model rather than a broken switch. Keep an eye on the index when you change the graph.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| index | INT | 00–999 | — |
| input_01opt | * | — | |
| input_02opt | * | — | |
| input_03opt | * | — | |
| input_04opt | * | — | |
| input_05opt | * | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| output | * | — |