Feature: Per-tool model routing to optimize cost and latency
Resolved 💬 4 comments Opened Feb 19, 2026 by karlenHackForGood Closed Apr 5, 2026
Problem
When using Claude Code with expensive models (Opus 4.6), every tool call — including simple, mechanical ones — runs on the same high-cost model. Many tools don't need the reasoning power of a frontier model:
- Playwright/Browser tools (screenshot, snapshot, click, navigate) — these are mechanical interactions that just need to follow instructions, not reason deeply
- File reads — reading a file doesn't require advanced reasoning
- Simple bash commands — running
git status,ls,npm install, etc. - MCP tool calls — many MCP tools just fetch data or perform simple actions
Currently, the only options are:
- Use an expensive model for everything (wasteful for simple tool calls)
- Use a cheap model for everything (insufficient for complex reasoning)
- Manually switch models mid-session with
/model(tedious and breaks flow)
Proposed Solution
Allow users to configure model routing per tool or tool category in settings.json or .claude/settings.json:
{
"model": "opus", // default model for reasoning/planning
"toolModels": {
// Route specific tools to cheaper/faster models
"mcp__playwright__*": "haiku", // all Playwright tools
"Bash": "sonnet", // bash commands
"Read": "haiku", // file reads
"Glob": "haiku", // file searches
"Grep": "haiku", // content searches
"mcp__figma-remote-mcp__*": "sonnet" // Figma tools
}
}
How it would work
- The main conversation uses the primary model (e.g., Opus) for reasoning, planning, and code generation
- When a tool call is made, if the tool matches a
toolModelspattern, the response processing for that tool's output uses the specified cheaper model - The context/conversation history remains unified — only the model used for processing tool results changes
Alternative: Tool category presets
{
"toolModelPresets": {
"browser": "haiku", // all browser/Playwright tools
"filesystem": "haiku", // Read, Glob, Grep, Write, Edit
"shell": "sonnet", // Bash
"mcp": "sonnet" // all MCP tools
}
}
Why This Matters
- Cost: Opus is ~5x more expensive than Sonnet and ~60x more than Haiku. A session with heavy browser testing or file exploration can burn through credits on tool calls that don't benefit from Opus-level reasoning
- Latency: Cheaper models respond faster. Browser interaction loops (click → snapshot → click) would be significantly snappier with Haiku
- No quality loss: A screenshot inspection, file read, or
git statusexecution produces the same result regardless of which model processes it
Current Workarounds (all suboptimal)
| Workaround | Downside |
|---|---|
| /model sonnet before tool-heavy work | Manual, breaks flow, easy to forget to switch back |
| CLAUDE_CODE_SUBAGENT_MODEL | Only applies to Task subagents, not direct tool calls |
| Just use Sonnet for everything | Loses Opus reasoning quality for complex tasks |
Environment
- Claude Code CLI
- Primary model: Opus 4.6
- Tools that would benefit from routing: Playwright MCP, Figma MCP, filesystem tools, Bash
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗