Skip to content
Docs

Cost Model Router

Cost Model Router picks which model serves an Agent run by price. It compares each candidate’s blended token price (input plus output), the indicative price Publicus lists for that model on the AI models page, and selects the cheapest one, or the highest-priced one when you use price as a proxy for capability. The decision is deterministic and makes no extra model call. You find it on the node picker’s AI shelf.

The node has a single output handle, Model. Connect it to the Agent’s Model handle. An agent reads one model node, so this node and the other model providers are alternatives rather than a stack.

Each candidate row can name its own API key secret: a secret holding the key for that row’s provider. A row takes a secret, never a saved connection; name a connection on the Agent’s own credential field instead. A row without a secret uses the workspace key for its provider (see AI models), with the server’s key as the final fallback.

The Cost Model Router node's settings form, with the fields described below
The Cost Model Router node's settings form, with the fields described below
FieldTypeDefaultDescription
Candidates (candidates)list (required) — The provider+model candidates the router chooses between by price.
Provider (candidates[].provider)string (required) —
Model (candidates[].model)string (required) —
API key (candidates[].apiKey)string (optional) —
Base URL (candidates[].baseUri)string (optional) —
Temperature (candidates[].temperature)number (optional) —
Max tokens (candidates[].maxTokens)integer (optional) —
Tier (tier)string (optional) cheapest Which candidate to pick by blended token price: cheapest selects the lowest-priced model, smartest selects the highest-priced one as a capability proxy.

Set tier to cheapest to select the lowest-priced candidate, or smartest to select the highest-priced one. On a price tie, the earlier row wins, so the configured order breaks ties.

A candidate whose model has no listed price cannot be compared and is skipped. When no candidate is comparable, the agent falls back to the provider and model set on the Agent node itself.

The node emits no output of its own and never runs as a step in the flow. It hands the agent one provider and model, the candidate its price comparison selected. The agent asks when a run starts, and once per phase when the router is attached to a phase-tracking agent.

Always run the cheapest of two candidates:

  1. Add a Cost Model Router node and connect its Model handle to the Agent’s Model handle.
  2. Add candidate rows for openai / gpt-4o-mini and anthropic / claude-sonnet-4-6.
  3. Leave tier on cheapest.

The router compares the two blended prices and the agent runs on the cheaper model. Flip tier to smartest and the same rows select the pricier model instead.

  • The prices are the published list prices Publicus reads for each model, so the choice tracks those rather than your negotiated rates or your actual token mix.
  • The comparison ranks candidates relative to each other; it does not estimate or report what a run costs.
  • temperature and maxTokens on a candidate row are not applied by this router; use Rule Model Router or Fallback Chain Model when you need per-target sampling overrides.