ComfyUI Node

Recast Model

Forcing a type on the model wire

By bobmagicii·Created 2 years ago·Updated 2 years ago· 1
Recast Model
  • model
  • MODEL

Recast Model is the MODEL-flavored member of the Typecaster family, and like the rest of them it's a pure pass-through: MODEL in, the same MODEL out, zero math in between. Its only job is to give the graph a concrete type so a connection that should work actually loads.

To see why that's ever needed, remember how ComfyUI resolves connections: nodes declare input and output types, and the browser wires sockets that match. A MODEL output feeds a MODEL input, and a KSampler's MODEL socket is happy. The snag comes from the "anything" habit some custom-node authors have - declaring a wildcard input that accepts several types and only discovering which one it holds at execution time. When such a dynamic output feeds a typed socket, the graph can't always resolve the type on first load. The result is the classic, maddening pattern: the workflow opens with a dead link, and it only sorts itself out (or fails loudly) once you queue a job.

The author's README puts the whole idea in one code-flavored sentence - emptyLatent = (Latent)emptyLatent; - a cast in the programming sense: change the declared type, keep the value. Recast Model is the cast you drop onto the model wire, usually between a router/switcher with a wildcard output and a KSampler (or a LoRA loader, or a model patcher) that wants a typed MODEL. The graph sees an explicit MODEL from the moment it loads, and the link resolves without the queue-and-fail dance. onRun is literally return (model,).

The whole interface

One input, one output, no widgets, no settings, no state.

  • model (MODEL) - in.
  • MODEL - out.

Installing it

It ships in ComfyKit Custom Nodes (bobmagicii/comfykit-custom-nodes). In ComfyUI Manager, search "ComfyKit Custom Nodes"; or manually:

cd ComfyUI/custom_nodes
git clone https://github.com/bobmagicii/comfykit-custom-nodes

Restart ComfyUI. There's no requirements.txt and nothing to download - the pack is plain Python over ComfyUI's core modules.

What to keep in mind

The cast changes the label, never the data - so it can't rescue a MODEL that's actually the wrong object for the job (say, a Flux model fed where an SDXL one belongs; ComfyUI won't complain about that either way). And if the red link persists after the cast, double-check the destination genuinely wants MODEL and not a step removed - some nodes want a full bundle or a different type entirely. The same mental model covers the other five typecasters in this pack (CLIP, Conditioning, Latent, Image, VAE): pick the one that matches the socket you're fighting, and you've added the safest possible node to the graph.

Categorybobmagicii

Inputs (1)

NameTypeDefaultDescription
modelMODEL

Outputs (1)

NameTypeDescription
MODELMODEL