Spotify's Portal Reduces Claude Code Token Usage by 90%
Key point
By leveraging Spotify's Portal AiKA Modes to route repetitive I/O tasks to low-cost models, token usage for Claude Code was reduced by 90%.
Details
A significant portion of AI coding agent tasks involves simple I/O operations, such as reading files or generating boilerplate, rather than reasoning. Using high-cost frontier models for these tasks is inefficient, and Gartner predicts that AI coding costs will exceed the average developer salary by 2028.
AiKA Modes, included in Spotify's Portal, were designed to address this issue. These are declarative agents that run in ephemeral runtimes like AWS Lambda, requiring only the definition of models and instructions without the need for infrastructure management or API key configuration.
Two Modes and Routing Strategy
The author created two modes, bulk-reader and code-writer, to distribute tasks.
- bulk-reader: Uses Gemini 2.5 Flash for questions requiring the reading of multiple files, returning only concise, structured answers.
- code-writer: Handles predictable output tasks that follow existing patterns, such as test files or configuration scraping.
These modes are routed through a Claude Code plugin called shunt. This plugin uses Hooks to intercept Claude's direct execution and redirect it to Portal mode calls when file sizes exceed a threshold (default 350 lines) or when commands attempting to read large files are detected. This allows high-cost models to focus exclusively on complex problems requiring genuine reasoning.
This summary was generated automatically by AI. Check the original for the author's claims and context. Copyright belongs to the original author.
Our guide explains how the AI works. Report summary errors, attribution issues, or removal requests via Contact.