Routing
Routing rules determine how jobs are matched to workers. You can route by provider, model, priority, tags, cost tier, or custom logic.
Default behavior
Section titled “Default behavior”Without routing rules, jobs go to the first available worker that supports the requested provider.
Tiered routing
Section titled “Tiered routing”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:
modelreins job dispatch --tier low --prompt "Classify this text"Tag-based routing
Section titled “Tag-based routing”Match jobs to workers by tags:
{ "routing": { "rules": [ { "match": { "tag": "code-review" }, "workers": { "tag": "gpu-server" } }, { "match": { "tag": "summarize" }, "workers": { "tag": "local" } } ] }}Fallback chains
Section titled “Fallback chains”Try providers in order:
{ "routing": { "strategy": "fallback", "chain": ["ollama", "claude", "openrouter"] }}Budget routing
Section titled “Budget routing”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.