
claude-code-routing
Spotify's 90% Claude Code routing setup, rebuilt for plain Claude Code and measured on 4 real tasks. A cheap model does the reading and the boilerplate.
Install with your AI
Paste into Claude Code, Cursor, or any agent — it reads the repo and wires the tool into your project.
Install and set up claude-code-routing (git-clone project) into my current project. Found on https://claudeers.com/claude-code-routing Repo: https://github.com/ToolMonsters/claude-code-routing Homepage/docs: https://toolmonsters.github.io/claude-code-routing/ Detected install method: git-clone → git clone https://github.com/ToolMonsters/claude-code-routing Category: skills. Platforms: cli, api, mobile. Read the repo's README for exact setup and env vars, then install it and wire it into my project. Claudeers Health Verdict: active; community-verified: false. Confirm the source before running anything.
git clone https://github.com/ToolMonsters/claude-code-routing
// compatibility
| Platforms | cli, api, mobile |
|---|---|
| Operating systems | — |
| AI compatibility | claude |
| License | MIT |
| Pricing | open-source |
| Language | HTML |
Claude Code Routing
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/
What's inside
| 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. |
Install
git clone https://github.com/ToolMonsters/claude-code-routing
cd claude-code-routing && ./install.sh
It 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.
What I measured
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. |
What that means
- 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.
Known gaps
- 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.
Reproduce
benchmark/run.sh opus # ~ $6-7, clones psf/requests into benchmark/work
Built by Yonathan Cohen · Tool Monsters · [email protected]
// faq
What is claude-code-routing?
Spotify's 90% Claude Code routing setup, rebuilt for plain Claude Code and measured on 4 real tasks. A cheap model does the reading and the boilerplate.. It is open-source on GitHub.
Is claude-code-routing free to use?
claude-code-routing is open-source under the MIT license, so it is free to use.
What category does claude-code-routing belong to?
claude-code-routing is listed under skills in the Claudeers registry of Claude-compatible tools.
// embed badge
[](https://claudeers.com/claude-code-routing)
// retro hit counter
[](https://claudeers.com/claude-code-routing)
// reviews
// guestbook
// related in Claude Skills
An agentic skills framework & software development methodology that works.
💫 Toolkit to help you get started with Spec-Driven Development
AI coding assistant skill (Claude Code, Codex, OpenCode, Cursor, Gemini CLI, and more). Turn any folder of code, SQL schemas, R scripts, shell scripts, docs,…