# I built a tool that cuts Anthropic API costs by 67% and it finds the waste before you spend

> Source: <https://dev.to/remo12262/i-built-a-tool-that-cuts-anthropic-api-costs-by-67-and-it-finds-the-waste-before-you-spend-3oe7>
> Published: 2026-06-24 08:25:31+00:00

I was building AI apps on top of Anthropic's API and kept hitting the same problem: costs were higher than expected, and I had no idea where the waste was coming from.

Most monitoring tools tell you what you already spent. I wanted something that tells you what you are about to waste before the request is sent.

So I built token-saver.

What it does

Four things, in order of when they help you:

- Static Analyzer — scans your Python source code before you run it
tsave scan chatbot.py
It finds patterns like API calls inside loops, uncached system prompts, full documents passed on every request, expensive models used for simple tasks. No API key needed. It reads your code like a linter reads style.
- Token Counter + Cost Estimator — uses the official Anthropic count_tokens API, not tiktoken (which undercounts Claude tokens by 15-20%)
- Semantic Compressor — doesn't just truncate. Scores each message by relevance to the current task, keeps the recent context intact, summarizes the rest. Result: 67% token reduction on real conversations.
- Usage Tracking — every call tracked, monthly projections included.

Real benchmark

ScenarioBeforeAfterReductionMulti-turn chatbot (50 turns)12,400 tokens4,100 tokens66.9%RAG pipeline18,200 tokens5,600 tokens69.2%Batch classifier8,500 tokens2,800 tokens67.1%

At 1,000 requests/day on Sonnet 4.6, that is roughly $200-$400/month saved.
