Analysis: Claude Code sessions re-send entire context every turn, driving hidden token costs
A developer analyzed three Claude Code sessions by parsing JSONL transcript files stored locally, revealing how AI coding assistants accumulate significant token costs over time. Because each API call is stateless, the full conversation history is re-transmitted on every turn, meaning a token added early in a session is effectively billed dozens of times before the session ends. Across 5,288 requests in three sessions, the analysis found 1.99 billion cache-read tokens against just 62 million cache-write tokens, a 32-to-1 ratio. Prompt caching discounts reduced estimated costs by around 86% compared to full input pricing, but the developer notes this is a discount on a recurring per-turn charge, not a one-time cost. Four automatic compactions triggered near the one-million-token context limit, each taking over 100 seconds, underscoring that context size is an ongoing expense rather than a sunk cost.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in