Spotify AI Routing Architecture for Claude Code
说明与用途
Spotify 通过将大型文件读取路由到更便宜的模型并本地处理模板,降低了 Claude Code 的令牌使用量 90%。
问题
High token consumption and costs when using Claude Code to read large code files.
结果
Spotify reduced Claude Code token consumption by ~90% by routing large file reads to a cheaper model and handling boilerplate generation locally.
工作流
- 1. Claude Code attempts to read a file.
- 2. Shunt intercepts the request and checks file size.
- 3. If file >350 lines, Shunt blocks the read and forwards the task to Bulk‑Reader Mode.
- 4. Bulk‑Reader (Gemini 2.5 Flash) reads the file, summarizes relevant parts, and returns a concise summary to Claude.
- 5. Claude performs deep reasoning on the summary.
- 6. For boilerplate code, Code‑Writer Mode generates and writes directly to disk without token‑heavy round‑trips.
证据
routing simple tasks away from high‑end AI models to smaller, cheaper models decreased token consumption on the primary model by approximately 90%
Lack of Reasoning for Hard Bugs: Smaller worker models can identify simple patterns but miss nuanced flaws, such as concurrency bugs
Network Delay: Delegating tasks to a secondary service introduces a latency penalty of 10 to 30 seconds per request
- 记录日期: 2026-09-19T01:31:21.486Z