- Published on
Portal by Spotify cut my Claude Code token usage by 90%
- Authors

- Name
- DeepHorus
A developer has achieved a remarkable 90% reduction in token usage for Claude Code by implementing a creative delegation strategy using Portal by Spotify's AiKA Modes. The solution addresses a growing pain point in AI-assisted development: the high cost of using frontier models like Claude for routine, input/output-heavy tasks that don't require advanced reasoning. By routing these tasks to cheaper models, significant savings are realized.
The core issue is that much of an AI coding agent's work involves reading multiple files, generating boilerplate code, or updating documentationātasks that consume thousands of tokens but involve minimal complex thought. As AI coding costs are projected to exceed the average developer's salary by 2028, with many engineering teams already spending $200 to over $2,000 per developer monthly on tokens, optimizing token usage has become a financial imperative.
The solution was built using AiKA Modes in Portal by Spotify. A Mode is a declarative agent running on an ephemeral runtime, where the user defines instructions, selects a model (like Gemini 2.5 Flash), sets parameters, and attaches tools, with no infrastructure management required. The developer created two key Modes: 'bulk-reader' for analyzing multiple files and 'code-writer' for generating boilerplate code.
These Modes act as specialized workers, handling specific, predictable tasks efficiently. The 'bulk-reader' Mode processes large file sets and returns concise, structured answers, while the 'code-writer' generates code that exactly matches existing project patterns and conventions. Both are instructed to output only the essential results, avoiding unnecessary prose.
The delegation is orchestrated through a Claude Code plugin named 'shunt'. This plugin uses PreToolUse hooks to automatically check conditions before Claude makes a tool call. For instance, if a file exceeds a set line count, the hook redirects the read operation to the cheaper 'bulk-reader' Mode via the Portal CLI.
This approach presents a pragmatic model for cost optimization in AI development. It allows expensive, powerful models to be reserved for complex reasoning and problem-solving, while offloading the bulk of routine I/O and code generation to more cost-effective alternatives.
The implications are substantial for development teams managing tight budgets. By implementing such a routing layer, organizations can maintain the quality of AI assistance for complex tasks while dramatically reducing their overall token expenditure. This strategy offers a scalable way to control costs as reliance on AI coding tools continues to grow.
Looking forward, this method highlights a potential evolution in AI development workflows toward more intelligent, cost-aware task delegation. As tooling and models continue to advance, the integration of specialized routers and agents could become a standard practice for efficient and economical AI-augmented software engineering.