Skip to content

Routing

Routing rules determine how jobs are matched to workers. You can route by provider, model, priority, tags, cost tier, or custom logic.

Without routing rules, jobs go to the first available worker that supports the requested provider.

Route by job complexity:

{
"routing": {
"tiers": {
"low": { "provider": "ollama", "model": "llama3.2" },
"medium": { "provider": "claude", "model": "haiku" },
"high": { "provider": "claude", "model": "sonnet" }
}
}
}

Dispatch with a tier:

Terminal window
modelreins job dispatch --tier low --prompt "Classify this text"

Match jobs to workers by tags:

{
"routing": {
"rules": [
{ "match": { "tag": "code-review" }, "workers": { "tag": "gpu-server" } },
{ "match": { "tag": "summarize" }, "workers": { "tag": "local" } }
]
}
}

Try providers in order:

{
"routing": {
"strategy": "fallback",
"chain": ["ollama", "claude", "openrouter"]
}
}

Enforce spend limits with automatic downgrade to local:

{
"routing": {
"budget": {
"weekly_limit_usd": 5.00,
"over_budget_provider": "ollama"
}
}
}

See Cost Optimization for strategies built on routing.