Blog › Token saving, part 7
We audited 5 open-source AI apps for wasted tokens: all 5 had a caching leak
Over ten days we read the LLM code of five popular open-source AI apps, line by line, looking for tokens paid for twice. Every one of them had a prompt-caching problem. In four, it was the same one: Claude was billed at full price on every call because nothing asked it to cache, or because the request went through a route that drops the cache marker. Two projects have already merged a fix.
Part 7 of a series on spending less per token. This post sums up parts 2 to 6; part 1 explains caching if you're new to it.
The scorecard
| Project | Biggest leak | Estimated saving | Status |
|---|---|---|---|
| GPT Researcher | Two prompts share a long context but differ by two quote marks in the first line, so the cache never hits | About $42 per 1,000 detailed reports, from a few characters | No issue filed |
| browser-use | Claude on OpenRouter or Bedrock: no caching, so every agent step re-bills the whole history, screenshots included | 55 to 72% of the Claude bill | Fixed, PR #6546, merged the day we reported it |
| mem0 | The same 8,400-token prompt on every memory save, never cached on Claude | 66% at 100,000 saves a month ($3,450 to $1,182) | Issue #8071 open; a contributor is working on it |
| nanobot | Claude on AWS Bedrock never cached; default model is a legacy Opus | 67% on Bedrock | Fixed, PR #6904, merged 2 December |
| Atomic Chat | Claude chats never cached; agent mode uses an endpoint that can't cache | 41 to 69% of the Claude bill | Issue #463 open |
Savings are our estimates for the example workloads in each post, at list prices; each post says what they rest on. We read the code and didn't run the apps.
Why it's almost always Claude
OpenAI and Gemini cache a repeated prompt prefix on their own. Claude doesn't: a request has to say where the cached part ends, with a cache_control marker (or a cachePoint on Bedrock). If nothing sets that marker, Claude bills the full prompt at the full input price on every call, and nothing errors or warns.
That makes the leak easy to miss. A team builds and tests on OpenAI, sees cache hits in its dashboards, adds Claude as one more provider, and the Claude bill quietly runs two or three times what it should. mem0 is the cleanest example: on OpenAI and Gemini its 8,400-token prompt is cached automatically, and on Claude it never is.
The marker gets lost on the way
Even projects that do ask Claude to cache often only ask on one route. The others drop the marker:
- Gateways. browser-use cached Claude on Anthropic's own API but not through OpenRouter. mem0 and nanobot had the same gap through LiteLLM or a custom gateway.
- Bedrock. AWS uses its own
cachePointblock, notcache_control. browser-use, mem0 and nanobot all skipped it. - The OpenAI-compatible endpoint. Atomic Chat's agent sends Claude requests in the OpenAI format to Anthropic's compatibility endpoint, and Anthropic's docs say prompt caching isn't supported there.
nanobot is a good example of how careful teams still miss it: its Anthropic and OpenRouter paths cache better than most code we've read, and Bedrock never did until this week.
Prompts that are almost the same
Automatic caching has its own trap. A cache only hits when the start of the prompt is byte-for-byte the same as before. GPT Researcher sends the same research context to several calls, but the first line of two prompts differs by two quote marks, so the long shared part after it is never read from cache. A timestamp, a request id or a reordered tool list at the top of a prompt does the same thing.
Stale defaults and wrong cost numbers
The second most common problem was a default that had aged:
- nanobot defaults to Claude Opus 4.5, which costs more than the current Opus 5.5.
- mem0's default Claude model is Sonnet 4.6, and its Bedrock default is Claude 3.5 Sonnet.
- GPT Researcher's built-in cost tracker was off by 2× to 10×, because prices and cache rates in it were out of date, and it used high reasoning effort on small jobs.
None of these is a bug. They are one-line settings that nobody revisits after a new model ships, and every user who keeps the default pays for it.
What happened after we reported them
We opened a GitHub issue with the fix for four of the five projects. browser-use merged a fix the same day, and nanobot merged one on 2 December. A contributor has picked up the mem0 issue, and the Atomic Chat issue went in on 2 December. Thanks to the maintainers who took these on; reading their code was a good education in how much care already goes into cost.
Check your own app in five minutes
- Send the same request twice and look at
cache_read_input_tokens(Claude) orcached_tokens(OpenAI) on the second response. Zero means you pay full price every time. - Do this on every route you support: direct API, OpenRouter, Bedrock, Vertex, LiteLLM, any OpenAI-compatible endpoint.
- Search your code for
cache_controlorcachePoint. If your app supports Claude and neither shows up, Claude isn't being cached. - Read the first few hundred tokens of your prompts. Anything that changes per request, such as a time, an id or a random order, goes at the end.
- Check the default model names against the provider's current list.
Or let an agent do it: the LLM cost audit skill is free, runs locally and is what we used for every audit in this series.
Then pay less for what's left
Caching cuts how many tokens you pay full price for; the gateway decides the price per token. Our price table compares SayGM and OpenRouter for every model in this series, checked daily. On Claude, Anthropic processes the prompt whichever gateway you use, so keep secrets and client data on direct routes.
Disclosure: we earn a reward if you sign up to SayGM through our links. Your price is the same.
Sources: the five audits linked above, browser-use PR #6546, nanobot PR #6904, mem0 issue #8071, Atomic Chat issue #463, Anthropic prompt caching docs, Anthropic OpenAI SDK compatibility.