Nodes/Comfyui-InputSwapper/πŸ”„ Input Swapper (2β†’2)
ComfyUI Node

πŸ”„ Input Swapper (2β†’2)

The one-toggle input router that kills logic-gate spaghetti

By allegiancerecords0-afkΒ·Created 5 months agoΒ·Updated 5 months agoΒ· 0
πŸ”„ Input Swapper (2β†’2)
  • input1
  • input2
  • output1
  • output2
β—„swapfalseβ–Ί

The name is the whole pitch: πŸ”„ Input Swapper (2β†’2) takes two inputs and two outputs, and one boolean flips which input lands on which output. That's it. No API calls, no model files, no dependencies, no hidden behavior. If you've ever stared at a workflow that needs to swap two signals - two checkpoints, two latents, two conditionings - and ended up building a pile of conditionals and reroutes to do it, this is the node that replaces the pile with a single toggle.

Its origin story is genuinely ComfyUI-flavored. The author was building a dual-sampler workflow with a mixture-of-experts setup where one model handles the early denoising steps and another takes over late, and they needed a clean way to switch the order of the models at runtime. Their words: "Before this node the best I could find was a series of overly complicated logic gates." So they shipped the simplest thing that could possibly work.

How the swap works

The mechanism is embarrassingly simple, which is exactly why it's reliable. Under the hood the node runs:

def execute(self, input1, input2, swap=False):
    if swap:
        return (input2, input1)   # swapped
    return (input1, input2)       # normal passthrough

No math, no resampling, no cloning - it's a pure pass-through router. When swap is off you get output1 = input1 and output2 = input2; flip the toggle and they cross. Both outputs always fire, so anything wired downstream keeps getting data either way. That "always fire" part matters more than it sounds: unlike a real multiplexer, you never have to worry about a dead branch starving a node on the other side of the graph.

The inputs and outputs

There are exactly three inputs, and only one of them is interesting.

  • input1 / input2 - wildcard (*) sockets. They'll accept literally anything ComfyUI can route: checkpoints, latents, conditioning, CLIP models, even other custom node types. The node doesn't care what flows through, which is the whole point of a generic router.
  • swap - the boolean toggle, default false. The author's tooltip says it all: "Toggle to invert the two inputs (1↔2)." In the UI it renders with "Normal" / "πŸ”„ Swapped" labels so it's obvious at a glance which state you're in.

The outputs are output1 and output2, both wildcard, and they wire straight into whatever consumed your inputs before - you're just rerouting, never retyping.

One thing worth knowing: because swap is a normal boolean input, you don't have to click it. You can drive it from another node (a logic node, a widget, whatever) and flip the routing programmatically mid-workflow.

Installing it

Easiest path is ComfyUI Manager - search for ComfyUI-InputSwapper (the pack title) and hit install. Or clone it manually:

cd ComfyUI/custom_nodes
git clone https://github.com/allegiancerecords0-afk/Comfyui-InputSwapper

Then restart ComfyUI. There's no requirements.txt and no pip step - the whole pack is one __init__.py, so install is genuinely clone-and-go. The category it shows up under in the node menu is ComfyUI-InputSwapper.

When you'd actually reach for it

The intended use case: a two-stage sampling graph where model A does early steps and model B does late steps, and you want to experiment with which model leads. Wire both models into the swapper, run, toggle, compare. That's a real workflow trick - sampler and scheduler choice reshape the denoising trajectory dramatically (the Karras vs linear conversation alone is a rabbit hole), and being able to A/B the order of two models with one click instead of rewiring the graph is genuinely useful.

Where it's not useful: as a general-purpose "smart" switcher. This node has no concept of which branch is better; it swaps on command and nothing else. If you want conditional routing based on a value, you want a proper logic/conditioning mux, not this.

Gotchas

Because the sockets are wildcard, it's easy to wire it in ways that don't make sense - the node won't stop you from swapping a latent with a text condition and then feeding that into a sampler that expects one specific type. The error shows up downstream, not at the swapper. That's the one real footgun, and it's inherent to any *-typed node. Also note the source file carries a comment suggesting you drop it straight into custom_nodes/ as a loose file - that's stale; clone the repo as a directory and you're set. For a node this small, that's the extent of the troubleshooting.

CategoryComfyUI-InputSwapper

Inputs (3)

NameTypeDefaultDescription
input1*β€”
input2*β€”
swapBOOLEANfalseToggle to invert the two inputs (1↔2)

Outputs (2)

NameTypeDescription
output1*β€”
output2*β€”