A cheap model does the reading and the boilerplate. Claude keeps the thinking.
This is a plain Claude Code rebuild of the setup a Spotify product manager published in September 2026, Portal by Spotify cut my Claude Code token usage by 90%. Theirs runs on Portal and Gemini Flash. This one needs nothing but the claude CLI you already have, and uses Haiku.
Not affiliated with Spotify. I rebuilt it, then measured it. The numbers are below, including the ones that don't flatter it.
Page: https://toolmonsters.github.io/claude-code-routing/
| Piece | What it does |
|---|---|
bin/code-write |
Haiku writes predictable code (tests, type stubs, config) from a spec plus a reference file, straight to disk. Claude never reads the reference or the output. |
bin/bulk-read |
Sends whole files to Haiku in one call and returns dense bullets with line numbers. The files never enter Claude's context. |
hooks/block-big-reads.sh |
PreToolUse hook. Stops any full read over 350 lines (Read, cat, head, tail, less, more) and points Claude to the two scripts. Targeted reads pass. |
skills/code-write, skills/bulk-read |
Tell Claude when and how to call the scripts. |
benchmark/ |
The 4 scenarios, the runner and the analysis, so you can reproduce every number. |
git clone https://github.com/ToolMonsters/claude-code-routing
cd claude-code-routing && ./install.shIt copies the scripts, hook and skills into ~/.claude and adds the hook to ~/.claude/settings.json (a backup is written first). Restart Claude Code.
Settings: BLOCK_MIN_LINES (default 350) · CHEAP_MODEL (default haiku) · CLAUDE_BIN if claude is not on your PATH.
Claude Code 2.1.270, Opus 5, on psf/requests. Four tasks, each run once without the setup and once with it. Total cost includes the Haiku calls. One run per cell, so treat small gaps as noise.
| Task | Without | With | Result |
|---|---|---|---|
| S1 Inventory of all 110 classes and functions across 3 files | $0.75 | $0.71 | 110/110 both. Neither run opened a file. |
| S2 Every raise and except in 2 files (1,155 + 625 lines) | $0.74 | $0.85 | Same answer. Without: 2 full file reads. With: ranged reads instead. |
| S3 Write pytest tests matching a 3,094-line test file | $0.96 | $1.22 | Worse. 17 tests → 11, 90s → 243s. |
| S4 Write a type stub for a 1,184-line module | $0.82 | $0.59 | 28% cheaper and better: 51 of 57 functions covered vs 42. 54s → 164s. |
- The hook never fired. Zero blocked reads across the 4 tasks. Without the setup, Claude read big files in full in 2 of 4 tasks. With it installed, Claude avoided full reads on its own (search,
sed -n, ranged reads), so there was nothing left to block. - bulk-read was never called. Claude always found a cheaper path itself. On S2 the with-setup run cost more.
- code-write is the part that pays, on boilerplate. On S4 Claude never opened the module, Haiku wrote the stub, and it came out cheaper and more complete. On S3, which needed judgment about an existing test style, it cost more and did worse.
- Spotify's 90% measures file tokens that stop entering Claude's context. That is a real number. In these 4 tasks, the reading side barely moved the bill. The writing side is where the money was, and it costs time.
- A ranged read (
offset/limit) passes the hook regardless of size. In S2 Claude read 545 lines at once through that door. - The cheap model's cost is billed in separate
claude -pcalls, so it does not show in the session's/cost. The scripts print it to stderr. - Do not route debugging, architecture or anything subtle to the cheap model. Spotify found the same: their worker missed a thread-safety bug Claude caught in seconds.
benchmark/run.sh opus # ~ $6-7, clones psf/requests into benchmark/workBuilt by Yonathan Cohen · Tool Monsters · hello@toolmonsters.com