TOO Any Swap
Flip between two models, images, or prompts with one checkbox
- a
- b
- a
- b
TOO Any Swap is the untyped big brother of the pack's INT swap: two inputs, two outputs, one boolean that crosses them. Uncheck swap, it's a pass-through; check it, and whatever's on a comes out of the b socket and vice versa. The difference is that this one doesn't care what type of data you feed it.
That's what makes it useful. Because both inputs are the wildcard * type, you can swap a MODEL against another MODEL, an IMAGE against an IMAGE, a CONDITIONING against a CONDITIONING - anything. Wire two checkpoint loaders into it and a checkbox decides which model the sampler runs. Two CLIP text encoders, one swap. Two reference images, one swap. It's the cheapest A/B testing rig ComfyUI has: keep both variants in the graph, flip a single boolean, and never edit a widget again.
How it works. The wildcard trick is the whole mechanism. The node declares its sockets as the special * type - the one type in ComfyUI that accepts a connection from anything - so the type checker never complains no matter what you plug in. The runtime function is then trivial: return (b, a) if swap else (a, b). That's the same pattern the KB's plumbing essay calls the A/B switch: a manual routing valve with a selector, as opposed to the fallback switches (like rgthree's Any Switch) that just pass the first non-null input. This one is deliberately the manual kind.
Inputs and outputs. Required: a and b (both *), plus swap (BOOLEAN, default false). Outputs: a and b, both *, so whatever type flows in flows back out.
Install.
cd ComfyUI/custom_nodes
git clone https://github.com/tetsuoo-online/Comfyui-TOO-Pack
or via ComfyUI Manager ("Comfyui-TOO-Pack"), then restart. No dependencies.
Where people get burned. Because the sockets are *, ComfyUI won't stop you from wiring a model into a and an image into b - the node will happily swap them and dump garbage downstream. Type checking is your job here. And remember swap is a persistent state: check it once and it stays swapped until you uncheck it, so if a run "mysteriously" used the wrong model, that checkbox is the first place to look. It's a two-node pattern (int swap + this) that covers both typed and untyped routing, and for a few bucks of setup it saves a lot of re-wiring in a graph you iterate on.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| a | * | β | |
| b | * | β | |
| swap | BOOLEAN | false | β |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| a | * | β |
| b | * | β |