How to route between models
By default an Agent uses one provider and model for every run. That is fine to start, but it leaves money and reliability on the table: easy requests pay frontier-model prices, and a single provider outage stops the agent. Model routing fixes both. You attach a model-routing node to the Agent’s model handle, and it decides which LLM serves each request.
There are two questions worth routing on:
- Cost vs capability — most requests are easy and a small, cheap model handles them well. Reserve a frontier model for the hard ones so you only pay for capability when you need it.
- Failover — providers get rate-limited and have outages. A backup model keeps the agent answering when your first choice is unavailable.
You do not have to choose one approach. A common setup routes by difficulty and falls back to a backup provider.
Wire a router to the Agent
Section titled “Wire a router to the Agent”Every model-routing node has a single model output, and the Agent has a model handle on the bottom edge of the node, third of its four icons:
- Build your agent first, following how to build an AI agent. Set a sensible default provider and model on the Agent node — that default is used whenever no router is connected.
- Add a routing node from the node picker (grouped under AI).
- Connect the routing node’s
modeloutput to the Agent’smodelhandle.


The Agent now consults the routing node at the start of each run instead of using its own provider and model. When the run starts, the canvas run view shows which model was selected and whether a failover or a router decision was involved.
You attach only one routing node per Agent. To combine behaviors, pick the node that covers your case (for example, Fallback chain already includes failover; LLM router already includes a default candidate).
Pattern: Auto (cheap → smart)
Section titled “Pattern: Auto (cheap → smart)”Send easy requests to a cheap model and hard ones to a frontier model, or skip the decision entirely and always run the cheapest candidate. There are three ways to pick.
By price alone — use a Cost router when you do not need per-request routing and want zero configuration beyond a list of candidates. It compares each candidate’s token price in the platform’s pricing table and picks one, with no rules to write and no extra LLM call:
- Add a Cost router and connect it to the Agent’s
modelhandle. - Add your candidate provider and model rows.
- Leave
tieroncheapest, or set it tosmartestto pick the highest-priced candidate instead, using price as a proxy for capability.
A candidate the pricing table does not cover is skipped. If no candidate can be priced, the Agent falls back to the provider and model set on the Agent node itself.
By request size — use a Rule router. It is deterministic and adds no extra LLM call, so it costs nothing to decide:
- Add a Rule router and connect it to the Agent’s
modelhandle. - First rule:
conditionType=token_threshold,tokenThreshold=4000,thresholdDirection=above, then a capable model (e.g.anthropic/claude-sonnet-4-6). - Last rule:
conditionType=default, then a cheap model (e.g.openai/gpt-4o-mini).
Small prompts take the cheap default; large prompts take the capable model. Tune the threshold to your traffic.
By request content — use an LLM router when size is not a good proxy for difficulty. A small classifier model reads the request and picks a candidate by label:
- Add an LLM router and connect it to the Agent’s
modelhandle. - Set
routerProviderandrouterModelto a small, cheap classifier. - Add candidates, for example
quick→ a cheap model andhard→ a frontier model. - Leave
routingPromptblank to let the router pick a label for the prompt, or set it to steer the decision.
The router call is cached per run, so repeating the same prompt in one run does not pay for a second decision.
Pattern: Fallback chain
Section titled “Pattern: Fallback chain”Keep the agent answering when a provider is rate-limited or down. Use a Fallback chain:
- Add a Fallback chain and connect it to the Agent’s
modelhandle. - First target: your preferred provider and model.
- Second target: a backup on a different provider.
The Agent tries the first target. If that call is rate-limited, the provider is overloaded, or it returns a server error, the Agent fails over to the next target. A request rejected for being too large is not retried on a backup, since a different model would reject it too. The run view reports the failover so you can see when a backup answered.
Combine cost routing with failover
Section titled “Combine cost routing with failover”These patterns stack conceptually: route by difficulty, and within each branch list a backup. In the current version a single routing node covers one behavior, so choose based on your priority. If reliability matters most, start with a Fallback chain. If cost matters most, start with a Cost router (always the cheapest priced candidate, no rules to write) or a Rule router or LLM router (per-request routing), and set each candidate to a model you trust to stay available.
Verify it
Section titled “Verify it”Run the flow with Run by hand and watch the canvas. The run view names the provider and model that served the request, and flags a failover or router decision. Run a short prompt and a long one (or two different intents) and confirm each lands on the model you expect.
Related
Section titled “Related”- Model routing — the routing node reference.
- Llm / Agent — the Agent node and its
modelhandle. - How to build an AI agent — build the agent first.
- Secrets — store the API keys your targets use.