Leverage brainstorm's intelligent model routing. Use when optimizing cost, selecting models for specific tasks, or understanding routing decisions.
Brainstorm routes each task to the optimal model using Thompson sampling across providers. Understanding the routing system lets you make better decisions about cost vs quality.
| Strategy | When | Tradeoff |
|---|---|---|
| quality-first | Complex reasoning, code generation, architecture | Higher cost, better results |
| cost-first | Simple queries, bulk operations, high volume | Lower cost, adequate quality |
| combined | General use (default) | Balanced |
| capability | Tasks requiring specific features (vision, long context) | Feature-driven |
| learned | After enough usage data | Thompson sampling optimization |
Before expensive operations, use cost_estimate to predict cost:
cost_estimate({ prompt: "the task description", strategy: "quality-first" })
For batch operations, prefer cost-first strategy to reduce spend.
Use set_routing_hint to override routing for the next request:
set_routing_hint({ model: "claude-haiku-4-5", reason: "simple search task" })
Each model has scores across 7 dimensions:
Use these when choosing models for specific tasks — a model with high toolSequencing is better for multi-step workflows than one with only high codeGeneration.
Every routing decision includes a fallback chain. If the primary model fails:
The --events flag shows every routing decision and retry in real-time.