Context compression can raise Anthropic API costs

A billing review found that Anthropic's cache behavior was the main reason one provider charged more than expected. For an earlier section to be reused, its messages must remain exactly the same; a change can prevent the request from using cheaper .

Tools that compress context therefore do not always save money. If a tool later reloads the removed information, a step sometimes called , it can spend more tokens than it saved during that session.

Changing the context or the order of information can also break cache reuse and move the request onto more expensive regular tokens. In every case examined, losing the cache cost much more than saved.

Key points

  • Messages in a reused section must remain exactly the same for the cache to apply.
  • Reloading context can consume more tokens than the tool originally saved.
  • Changing context or information order can replace cheaper with regular tokens.
  • In the examined cases, the cost of losing cache reuse exceeded the savings.
Read original