Nodes/WAS Node Suite v3/Model Index Switch
ComfyUI Node Runs on cloud

Model Index Switch

Twenty-six model slots, and only the one you pick loads

By WASasquatch·Created 3 years ago·Updated 4 days ago· 1,844
Model Index Switch
  • index
  • input_a
  • input_b
  • input_c
  • input_d
  • input_e
  • input_f
  • input_g
  • input_h
  • input_i
  • input_j
  • input_k
  • input_l
  • input_m
  • input_n
  • input_o
  • input_p
  • input_q
  • input_r
  • input_s
  • input_t
  • input_u
  • input_v
  • input_w
  • input_x
  • input_y
  • input_z
  • output
  • resolved_index
  • count
out_of_rangewrap

Model Index Switch passes one of up to twenty-six loaded models onward, chosen by a number. Wire a dozen checkpoints into slots input_a through input_l, drive index from a widget or a value, and the graph uses whichever one the number points at. It's the "pick a model with a counter" node, and it's built for the lazy-loading workflow trick that makes it actually practical: only the chosen input gets evaluated, so a node with twelve checkpoints wired in only ever loads one.

It's part of WAS Node Suite's logic/switch family (WAS Suite/Logic/Switch), alongside the two-way Model Switch and the suite's typed switches - part of v3's push to give ComfyUI real control flow over model-loading.

How it works

An index and a row of optional sockets. The sockets take anything a loader answers - MODEL, VAE, CLIP, CLIP_VISION, CONTROL_NET, UPSCALE_MODEL, STYLE_MODEL, and the rest of the loader types - and the first connection fixes the type, so you can't accidentally mix a VAE and a diffusion model across slots. index counts from 0, negatives count from the end (-1 = last slot), and decimals truncate. Two details make the index predictable:

  • Unconnected slots aren't counted. With only slots A, B, and C wired, index 0 is slot A. You don't have to fill the alphabet to use the node.
  • out_of_range decides what an index past the end does: wrap cycles back around, clamp holds at the last slot, error stops the prompt. When a counter from a loop drives the index, wrap is usually what you want so the run never dies on an off-by-one.

The important claim in the tooltip deserves emphasis: only the chosen input is evaluated. In ComfyUI's lazy execution model, a loader sitting on an unselected branch never runs, so those eleven other checkpoints are just menu entries - they consume no VRAM until the index points at them. That's the difference between a "model switcher" you'd actually use and a graph that OOMs on load.

What comes out

output - the selected input, typed to whatever was connected, ready for a sampler or anything downstream. Plus two helpful wires: resolved_index (the slot actually read, after wrap or clamp) and count (how many slots are connected, so the index runs 0..count-1). If you're driving the index from a counter, wiring count into a compare is how you stop the loop before it walks off the end.

Installing it

Standard WAS Node Suite v3 install:

cd ComfyUI/custom_nodes
git clone https://github.com/WASasquatch/was-node-suite-comfyui.git

or ComfyUI Manager → "WAS Node Suite v3", restart. ComfyUI 0.14.0+, Python 3.10+, no pip installs.

Where people get burned

The classic mistake is assuming the node is a model loader - it isn't. You still need a loader per checkpoint; this node just picks which loaded result passes through. Second, wiring slots out of order then expecting index 0 to be input A: index 0 is the first slot actually connected, so if you wire B first, B becomes slot 0. And the lazy-loading only works when the unselected loaders genuinely sit unconnected from anything else - if a loader feeds both this node and somewhere else, it loads regardless, and the "only one model" promise quietly dies. Use dedicated loaders per branch and you're fine.

CategoryWAS Suite/Logic/Switch

Inputs (28)

NameTypeDefaultDescription
indexINT,NUMBER,FLOAT0-99999999–99999999Slot to pass on, from 0. Negative counts from the end: -1 = last. A decimal is truncated: 2.7 = 2.
out_of_rangeCOMBOwrapIndex outside 0..count-1. With 3 slots and index 4: `wrap` = slot 1, `clamp` = slot 2, `error` stops the prompt.
input_aoptCOMFY_MATCHTYPE_V3One candidate for the index. Takes MODEL, VAE, CLIP, CLIP_VISION, CONTROL_NET, UPSCALE_MODEL, STYLE_MODEL and the other loader types. The first connection fixes the type; an unconnected slot is not counted, so index 0 is the first slot actually wired.
input_boptCOMFY_MATCHTYPE_V3One candidate for the index. Takes MODEL, VAE, CLIP, CLIP_VISION, CONTROL_NET, UPSCALE_MODEL, STYLE_MODEL and the other loader types. The first connection fixes the type; an unconnected slot is not counted, so index 0 is the first slot actually wired.
input_coptCOMFY_MATCHTYPE_V3One candidate for the index. Takes MODEL, VAE, CLIP, CLIP_VISION, CONTROL_NET, UPSCALE_MODEL, STYLE_MODEL and the other loader types. The first connection fixes the type; an unconnected slot is not counted, so index 0 is the first slot actually wired.
input_doptCOMFY_MATCHTYPE_V3One candidate for the index. Takes MODEL, VAE, CLIP, CLIP_VISION, CONTROL_NET, UPSCALE_MODEL, STYLE_MODEL and the other loader types. The first connection fixes the type; an unconnected slot is not counted, so index 0 is the first slot actually wired.
input_eoptCOMFY_MATCHTYPE_V3One candidate for the index. Takes MODEL, VAE, CLIP, CLIP_VISION, CONTROL_NET, UPSCALE_MODEL, STYLE_MODEL and the other loader types. The first connection fixes the type; an unconnected slot is not counted, so index 0 is the first slot actually wired.
input_foptCOMFY_MATCHTYPE_V3One candidate for the index. Takes MODEL, VAE, CLIP, CLIP_VISION, CONTROL_NET, UPSCALE_MODEL, STYLE_MODEL and the other loader types. The first connection fixes the type; an unconnected slot is not counted, so index 0 is the first slot actually wired.
input_goptCOMFY_MATCHTYPE_V3One candidate for the index. Takes MODEL, VAE, CLIP, CLIP_VISION, CONTROL_NET, UPSCALE_MODEL, STYLE_MODEL and the other loader types. The first connection fixes the type; an unconnected slot is not counted, so index 0 is the first slot actually wired.
input_hoptCOMFY_MATCHTYPE_V3One candidate for the index. Takes MODEL, VAE, CLIP, CLIP_VISION, CONTROL_NET, UPSCALE_MODEL, STYLE_MODEL and the other loader types. The first connection fixes the type; an unconnected slot is not counted, so index 0 is the first slot actually wired.
input_ioptCOMFY_MATCHTYPE_V3One candidate for the index. Takes MODEL, VAE, CLIP, CLIP_VISION, CONTROL_NET, UPSCALE_MODEL, STYLE_MODEL and the other loader types. The first connection fixes the type; an unconnected slot is not counted, so index 0 is the first slot actually wired.
input_joptCOMFY_MATCHTYPE_V3One candidate for the index. Takes MODEL, VAE, CLIP, CLIP_VISION, CONTROL_NET, UPSCALE_MODEL, STYLE_MODEL and the other loader types. The first connection fixes the type; an unconnected slot is not counted, so index 0 is the first slot actually wired.
input_koptCOMFY_MATCHTYPE_V3One candidate for the index. Takes MODEL, VAE, CLIP, CLIP_VISION, CONTROL_NET, UPSCALE_MODEL, STYLE_MODEL and the other loader types. The first connection fixes the type; an unconnected slot is not counted, so index 0 is the first slot actually wired.
input_loptCOMFY_MATCHTYPE_V3One candidate for the index. Takes MODEL, VAE, CLIP, CLIP_VISION, CONTROL_NET, UPSCALE_MODEL, STYLE_MODEL and the other loader types. The first connection fixes the type; an unconnected slot is not counted, so index 0 is the first slot actually wired.
input_moptCOMFY_MATCHTYPE_V3One candidate for the index. Takes MODEL, VAE, CLIP, CLIP_VISION, CONTROL_NET, UPSCALE_MODEL, STYLE_MODEL and the other loader types. The first connection fixes the type; an unconnected slot is not counted, so index 0 is the first slot actually wired.
input_noptCOMFY_MATCHTYPE_V3One candidate for the index. Takes MODEL, VAE, CLIP, CLIP_VISION, CONTROL_NET, UPSCALE_MODEL, STYLE_MODEL and the other loader types. The first connection fixes the type; an unconnected slot is not counted, so index 0 is the first slot actually wired.
input_ooptCOMFY_MATCHTYPE_V3One candidate for the index. Takes MODEL, VAE, CLIP, CLIP_VISION, CONTROL_NET, UPSCALE_MODEL, STYLE_MODEL and the other loader types. The first connection fixes the type; an unconnected slot is not counted, so index 0 is the first slot actually wired.
input_poptCOMFY_MATCHTYPE_V3One candidate for the index. Takes MODEL, VAE, CLIP, CLIP_VISION, CONTROL_NET, UPSCALE_MODEL, STYLE_MODEL and the other loader types. The first connection fixes the type; an unconnected slot is not counted, so index 0 is the first slot actually wired.
input_qoptCOMFY_MATCHTYPE_V3One candidate for the index. Takes MODEL, VAE, CLIP, CLIP_VISION, CONTROL_NET, UPSCALE_MODEL, STYLE_MODEL and the other loader types. The first connection fixes the type; an unconnected slot is not counted, so index 0 is the first slot actually wired.
input_roptCOMFY_MATCHTYPE_V3One candidate for the index. Takes MODEL, VAE, CLIP, CLIP_VISION, CONTROL_NET, UPSCALE_MODEL, STYLE_MODEL and the other loader types. The first connection fixes the type; an unconnected slot is not counted, so index 0 is the first slot actually wired.
input_soptCOMFY_MATCHTYPE_V3One candidate for the index. Takes MODEL, VAE, CLIP, CLIP_VISION, CONTROL_NET, UPSCALE_MODEL, STYLE_MODEL and the other loader types. The first connection fixes the type; an unconnected slot is not counted, so index 0 is the first slot actually wired.
input_toptCOMFY_MATCHTYPE_V3One candidate for the index. Takes MODEL, VAE, CLIP, CLIP_VISION, CONTROL_NET, UPSCALE_MODEL, STYLE_MODEL and the other loader types. The first connection fixes the type; an unconnected slot is not counted, so index 0 is the first slot actually wired.
input_uoptCOMFY_MATCHTYPE_V3One candidate for the index. Takes MODEL, VAE, CLIP, CLIP_VISION, CONTROL_NET, UPSCALE_MODEL, STYLE_MODEL and the other loader types. The first connection fixes the type; an unconnected slot is not counted, so index 0 is the first slot actually wired.
input_voptCOMFY_MATCHTYPE_V3One candidate for the index. Takes MODEL, VAE, CLIP, CLIP_VISION, CONTROL_NET, UPSCALE_MODEL, STYLE_MODEL and the other loader types. The first connection fixes the type; an unconnected slot is not counted, so index 0 is the first slot actually wired.
input_woptCOMFY_MATCHTYPE_V3One candidate for the index. Takes MODEL, VAE, CLIP, CLIP_VISION, CONTROL_NET, UPSCALE_MODEL, STYLE_MODEL and the other loader types. The first connection fixes the type; an unconnected slot is not counted, so index 0 is the first slot actually wired.
input_xoptCOMFY_MATCHTYPE_V3One candidate for the index. Takes MODEL, VAE, CLIP, CLIP_VISION, CONTROL_NET, UPSCALE_MODEL, STYLE_MODEL and the other loader types. The first connection fixes the type; an unconnected slot is not counted, so index 0 is the first slot actually wired.
input_yoptCOMFY_MATCHTYPE_V3One candidate for the index. Takes MODEL, VAE, CLIP, CLIP_VISION, CONTROL_NET, UPSCALE_MODEL, STYLE_MODEL and the other loader types. The first connection fixes the type; an unconnected slot is not counted, so index 0 is the first slot actually wired.
input_zoptCOMFY_MATCHTYPE_V3One candidate for the index. Takes MODEL, VAE, CLIP, CLIP_VISION, CONTROL_NET, UPSCALE_MODEL, STYLE_MODEL and the other loader types. The first connection fixes the type; an unconnected slot is not counted, so index 0 is the first slot actually wired.

Outputs (3)

NameTypeDescription
outputCOMFY_MATCHTYPE_V3The selected input, typed to whatever was connected.
resolved_indexINTSlot actually read, from 0, after wrap or clamp.
countINTConnected slots. The index runs 0..count-1.