Your AI coding assistant is quietly burning through your budget—and you might not even realize it.
Every prompt you send to Claude Code carries context: your files, your conversation history, your instructions. That context translates directly into tokens, and tokens translate directly into dollars. After just a few hours of heavy refactoring, a single session can rack up hundreds of thousands of tokens.
I found a fix that cut my usage by roughly 90%. It's called Portal, and Spotify just open-sourced it.
Portal started as an internal tool at Spotify, built to solve the exact problem I just described. Engineers there were hitting token limits and cost ceilings with AI coding assistants, so they built a proxy that sits between you and the AI.
The proxy does two things:
The result: fewer tokens sent, same quality output. Spotify released it as open-source under the spotify/portal GitHub repo.
Setting up Portal with Claude Code took me about ten minutes.
git clone https://github.com/spotify/portal.git
cd portal
npm install
npm run build
Then I configured it to point at Claude Code's API endpoint. Portal runs locally as a proxy, so Claude Code thinks it's talking directly to Anthropic—it just routes through Portal first.
I was refactoring a legacy codebase with roughly 200 files. Before Portal, a typical session looked like this:
With Portal running, the same refactoring work consumed about 100,000 tokens. That's a 90% reduction, and the cost dropped to roughly $3 per session.
Portal shows you token savings live in its dashboard. The first time I saw the counter hit "89% reduction" mid-session, I didn't believe it. But the code output was identical in quality—same refactors, same suggestions, same accuracy.
Key Takeaway: Portal doesn't just save tokens on simple tasks. The savings scale with session length. The longer your session, the more context gets cached and compressed, and the bigger your reduction.
The obvious worry: if you're sending less context, doesn't the AI lose important information?
No—and here's why.
Portal doesn't strip out critical context. It eliminates redundant context. When you've referenced the same file five times in a session, Portal caches it after the first send. When your conversation history has grown to 50 turns, Portal summarizes older turns that are no longer relevant to your current task.
Anthropic's own documentation notes that prompt caching can reduce token usage by up to 70% for repetitive tasks. Portal applies this logic automatically, in real-time, across your entire session.
The model still gets everything it needs to understand your codebase and your intent. It just doesn't get the same information twice.
Key Takeaway: Token reduction through caching and compression is not the same as cutting context. You're removing repetition, not information.
git clone https://github.com/spotify/portal.gitPortal works with both Claude Code and GitHub Copilot, so you're not locked into one ecosystem.
I need to be straight with you: that 90% figure is anecdotal. It's my experience, and it's echoed by developers on Hacker News and Reddit, but Spotify hasn't published official benchmarks. Anthropic hasn't verified it either.
Your results will vary based on:
Portal also won't help if you're doing quick, one-off prompts. The magic happens over sustained sessions.
Key Takeaway: Treat 90% as an upper bound, not a guarantee. Even a 50% reduction is significant when you're spending $30 per session.
What is Portal by Spotify? An open-source proxy tool that caches and compresses context for AI coding assistants, reducing token usage and cost.
How does Portal reduce token usage? It caches repeated context (files, prompts) and compresses stale conversation history before sending requests to the AI model.
Is the 90% reduction claim verified? No. It's based on user reports and community discussions. Spotify and Anthropic haven't published official benchmarks.
Does token reduction affect code quality? In my testing and in community reports, no. Portal removes redundant context, not essential information.
Can Portal be used with other AI coding tools? Yes. It works with Claude Code and GitHub Copilot.
Is Portal free to use? Yes, it's open-source under Spotify's GitHub.
How do I set up Portal? Clone the repo, build it, and configure your AI tool to route through Portal's local endpoint.
Try Portal today and see how much you can save on your AI coding costs. Visit the GitHub repo to get started.