ComfyUI Node

PVL Switch x15

Lazy branching that only runs what you pick

By pvlprk·Created about a year ago·Updated 8 months ago· 1
PVL Switch x15
  • input_default
  • input_1
  • input_2
  • input_3
  • input_4
  • input_5
  • input_6
  • input_7
  • input_8
  • input_9
  • input_10
  • input_11
  • input_12
  • input_13
  • input_14
  • input_15
  • output
switch_condition
case_1
case_2
case_3
case_4
case_5
case_6
case_7
case_8
case_9
case_10
case_11
case_12
case_13
case_14
case_15

Sooner or later every ComfyUI regular hits the same wall: you want to A/B two checkpoints, three LoRA stacks, or five prompts in one graph and flip between them with a single control instead of rewiring everything by hand. Core ComfyUI gives you some primitives for this, but nothing that both routes between typed values and skips the work. PVL_Switch_x15 does both, and the second half is the part that actually matters.

What it actually does

It's a string-keyed router. You type labels into case_1 through case_15, plug any value you like into input_1 through input_15, and set switch_condition to the label you want. Whatever input's case matches becomes the output. That part is boring. The interesting part is how the inputs are wired.

Every input in this node is lazy. ComfyUI doesn't evaluate an input until the node says it needs it, and PVL_Switch_x15's check_lazy_status only requests the one input whose case won. So if switch_condition matches case_3, then input_1, input_2, and input_415 never run at all. That's not just an efficiency win - it's what makes the node legal. Because inputs accept any type (*), you can feed a MODEL into input_1 and a STRING into input_2, switch between them, and ComfyUI won't choke, because the input you didn't pick is never validated or executed. A greedy switch that evaluated everything couldn't do that.

The inputs that matter

  • switch_condition - the selector. Compared to the case labels as an exact, case-sensitive string match. You can type it or wire a string in from another node (more on that below).
  • case_1case_15 - the labels. Plain string widgets; you type these, they don't accept wires.
  • input_default - the fallback. If switch_condition matches none of the fifteen cases, the output is input_default.

There's a single output, output, typed * - whatever you routed in comes out the other side, so it wires straight into a model loader, a prompt, a sampler, anything.

Where people get burned

The trap is the default path. If no case matches and input_default isn't connected, the node returns None, and whatever's downstream throws. Always wire input_default. It costs you nothing and turns the whole thing into a safe fallback instead of a landmine.

The other gotcha is exact matching. No trimming, no case folding, no partial matches. If you type "flux" in one place and "Flux" in the other, you've just sent everything to input_default. This trips up more people than it should.

One genuinely useful trick: switch_condition accepts a wired string. Drop a PVL_Txt node (same pack) or any text source into it and you get a dynamic selector - flip a single text value and the whole graph retargets.

Install

This node ships in pvlprk/comfyui-pvl-api-nodes, the pack the README titles "ComfyUI Assistant Node". The README is one paragraph about the OpenAI assistant node - don't let that fool you, the repo actually ships eighty-odd nodes, mostly fal.ai and Gemini API wrappers plus a pile of local utilities like this switch family (a 2-way boolean PVL_Switch, plus x5, x10, x15, and a PVL_Switch_Huge). The name is a lie; the pack is a general-purpose grab bag.

Easiest install is ComfyUI Manager - search ComfyUI Assistant Node. Or clone it manually:

cd ComfyUI/custom_nodes
git clone https://github.com/pvlprk/comfyui-pvl-api-nodes

Restart ComfyUI. There are no model downloads. The pack's requirements.txt is a long list (openai, fal-client, google-genai, diffusers, matplotlib…), but all of that exists for the API nodes - this switch just needs torch, which you already have.

One honest note: this is a single-author personal pack with zero community chatter behind it. It works, it's simple enough to verify by reading, but don't expect a support community. If you just need 2–5 options, the x5 sibling is less clutter - fifteen labeled inputs is a lot of graph to look at.

CategoryPVL_tools

Inputs (32)

NameTypeDefaultDescription
switch_conditionSTRING
case_1STRING
case_2STRING
case_3STRING
case_4STRING
case_5STRING
case_6STRING
case_7STRING
case_8STRING
case_9STRING
case_10STRING
case_11STRING
case_12STRING
case_13STRING
case_14STRING
case_15STRING
input_default*
input_1opt*
input_2opt*
input_3opt*
input_4opt*
input_5opt*
input_6opt*
input_7opt*
input_8opt*
input_9opt*
input_10opt*
input_11opt*
input_12opt*
input_13opt*
input_14opt*
input_15opt*

Outputs (1)

NameTypeDescription
output*