翻篇收录说明
翻篇网页快照

AI Coding Agent Token Bill: Where the Money Goes | condense.chat

https://condense.chat/blog/ai-coding-agent-token-bill/

最近抓取:2026-12-03 03:20:39(北京时间)

最近内容变化:2026-12-03 03:20:39(北京时间)

这是最近一次有效抓取的文本快照,不含网页脚本、图片和动态交互内容。实际网页可能已更新。

访问原网页

页面简介

Where an agent session spends money, and where condense takes it back. A real coding session, priced cache-aware, comes in 72% under baseline.

正文摘录

BlogThe anatomy of a token bill: where an AI coding agent spends moneyWhere an agent session actually spends money, and where condense takes it back. Measured cache-aware on 18,333 real turns.condense team · Jul 3, 2026 · Updated Nov 21, 2026 · Deep divetl;drCoding agents get expensive because every turn re-sends the whole, growing session history: the model re-reads the same old context hundreds of times.Almost none of that is the raw input people price in their head. Most of the bill is cache reads and cache writes.condense saves money by shrinking what gets written to the cache and re-read from it, before the cost compounds. On real sessions that removes about two thirds of the bill.Most of the bill is re-reading old context67.7%of spend is cache readsRaw input, the tier everyone prices in their head, is 0.2%.condense shrinks that history before it compounds72.3%of one session’s bill removedA real 938-turn session: Sonnet $154 becomes $43, Opus $771 becomes $214.And the saving holds across all our spend66%of total spend removedDollar-weighted across every session size, losses included.condense vs headroom, live: nearly 3× the bill removedWe built minmax-bench to settle the comparison people actually ask for, condense against headroom, in real life instead of in marketing copy: an open harness that replays the same real session live through both tools at once, reads back real provider usage, cache tiers included, and prices every arm identically. No synthetic prompts, no self-reported numbers; the bill is the bill. Here is the shipped proxy, right now, against claude-haiku-4-5, on one real session run to full depth: 2,909 request points, average chain ~179k tokens. The headroom arms cover the same session’s first ~1,600 points, the depth their runs reached. For what each tool compresses, see rtk vs Headroom vs condense and token compression tools compared.Each arm scored on its own replayed points: condense $56.69 → $35.52 at full depth; headroom $17.66 → $15.22 and headroom-kompress $17.63 → $17.31 at their ~1,600-point depth.Head to head: condense removes nearly three times the bill headroom’s best mode does: 37.3% against 13.8%. At the shallower ~1,600-point depth where the headroom arms ran, condense stands at 28.0%, still twice headroom’s best. Headroom’s default keeps its cache clean but caps there, because it never touches the accumulated history that dominates the bill; its deeper kompress mode busts the cache and keeps 1.8 cents of every dollar.Bucket the same run by chain depth and the curve is one headroom has no read side to follow: the deeper the chain, the bigger the cut:chain bucketbill savedtokens saved32–100k18.8%49.9%100–200k32.4%51.0%200–400k40.4%53.3%400k+53.4%66.1%all · $56.69 → $35.5237.3%53.8%Longer evals are still running toward the 66%+ the design measures offline, and we will publish them the same way as these.And the harness reads your own ~/.claude sessions directly. Point it at whatever you’ve got and watch the number climb with depth yourself:shellcopyuv run minmax-bench run -d claude-code:~/.claude/projects/*/*.jsonl \ --model claude-haiku-4-5 -s condense-asyncWhat you saveWe replayed a real coding session turn by turn, exactly as a harness would call the model, read back the provider’s real usage, cache tiers included, and priced every tier. The headline run is the kind of session the money actually lives in: a real coding session that peaked past 800k tokens of context, replayed to 938 turns with both models live.metricbaselinethrough condensesavedtotal bill (Sonnet)$154$43-72.3%total bill (Opus)$771$214-72.3%Savings compound with depth, because output share shrinks and re-read share grows as a session ages: the same giant saves roughly half its bill at 230 turns, 62% at 800, and 67–73% past 1,400.The ceilings are structural, not tuning gaps: the model’s own generation is never compressed, and the live edge must be written roughly raw once. By session size:session peak contextshare of real spendbill saved≥ 800k · giants85%66–72%~200–400k12%47–55%≤ 100k3%33–37%< 4k chains~0%negative, we lose moneyWeight those by where the dollars are and the machine removes 66% of total spend. The rest of the post is the why and the how: where an agent’s dollars actually go, and the machine that takes them back.You pay the model to re-read, not to answerA coding agent’s loop is simple: the harness sends the model the system prompt plus the entire conversation so far, the model replies with a short step, a tool runs, and the result is appended. Then everything is sent again. The reply is tiny; the history it drags along is not. By turn 150 of a real session the model has re-read the same early turns a hundred times.Providers know this and price input tokens in tiers. Here is claude-sonnet-4-5, per million input tokens:cache write, 1h$6.00 / Mcache write, 5m$3.75 / Minput, uncached$3.00 / Mcache read$0.30 / MAnthropic list prices per one million input tokens, claude-sonnet-4-5. Output is $15/M. The write tiers are 12.5× and 20× the read tier. Those two ratios are the whole economics of this post. For current Claude API prices, see the pricing guide.Where does a real bill actually land on these tiers? Twelve real coding sessions, 18,333 assistant turns, real billed usage, split by tier:tiershare of spendcache read67.7%cache write18.9%output13.2%input, uncached0.2%The token cache-hit rate across those sessions is 98.6%. In a working agent loop there are essentially no raw input tokens: everything the model reads was either just written to the cache or is being re-read from it. The bill is re-reads plus re-writes, and those are compaction’s two attack surfaces.Together the two surfaces cover ~85% of the bill. Output, the model’s own generation at $15/M, is the floor no proxy can touch on its own, and it is why every percentage in this post has a ceiling. It is not the end of the road, though: techniques like caveman or ponytail can buy additional output savings in combination, and rtk can do better on tool results that resist compression. All of them compose with condense. For the habits that shrink the same bill by hand, see how to reduce Claude Code token usage.How your bill shrinks without your agent noticingA detailed explainer of what happens to your traffic inside the proxy.The parts of a session, and which are safe to compressBefore the machinery, the vocabulary. A session with a coding agent is a trajectory: system messages, then a user’s intent, then a run of agent loops (the model observes, decides on an action, a tool executes it, the result comes back) until a final answer closes the task and the next user message opens another. Not all of it is equal:One trajectory, top to bottom; bar width is token mass. The skeleton (system, user messages, final answers) is preserved verbatim, always. The aged loop interior is fair game and packs to roughly 9% of its tokens. The recent loop and this turn stay raw: that is the working set the model is reasoning over.Our working hypothesis, and the bet the whole product makes: remove the information that is no longer necessary, intelligently, and the model’s trajectory does not change: it takes the same actions and lands on the same answer, just cheaper. The sharp edge is action repetition: drop the wrong span and the model re-runs tools it has already run, spending the savings twice over. This is one of the failure modes that drove us to train our own dedicated models instead of relying on truncation heuristics.The anatomy: edge, pending, sealedThe machine is organized around cache state itself. Every region of the request lives in one of three zones:The three zones of one request, left to right. Sealed spans only ever extend; nothing above breakpoint 1 is ever rewritten.Sealed: compacted spans that have paid their one-time rewrite and are frozen byte-identical forever behind breakpoint 1, held at the 1-hour cache tier. This is the stable prefix that re-reads at the cheap read tier for the rest of the session.Pending: the volatile middle, a verbatim safe zone of the last few thousand tokens, plus compacted spans baked but not yet adopted. The safe zone is the working set the model is actively reasoning over; over-compress it and you remove critical information the next action depends on. Cached at the 5-minute tier on purpose: a coming rewrite would kill a 1-hour write anyway.Edge: this turn’s brand-new tokens, not yet written to the cache. Whatever survives the edge becomes the next cache write.Helene 1 · works the edgeOur extractive model scores every token and keeps the survivors verbatim, a strict subsequence of what your agent actually saw, in tens of milliseconds, before the bytes are first written to the cache. A token Helene removes at ingest is a token you never pay to write and never pay to re-read, and it is the only thing that saves money in the cold 0–8k window where there is no history to compact yet (~20% from turn 1). Code, patches, and error output are never touched.Adeline 1 · works the sealOur abstractive rewriter takes whole settled agent loops (the tool_use/tool_result churn the session has moved past) and packs each into one short summary that keeps intents, file paths, identifiers, errors, and code. On real giant sessions the packs come out at roughly 9% of the original tokens, re-baked from the original bytes, never from Helene’s stripped ones. Once sealed, a pack renders byte-identically on every later turn.never rewritten:system promptuser messagesfinal answersnever split:tool_use / tool_result pairsDeciding when to compactThe proxy decides when a span is ready to compact: it classifies what the session has genuinely moved past and seals only that. The compaction itself is speculative and free: packs are baked asynchronously, and the bill only happens when a pack is adopted into the rendered request.Don’t trust us: rerun the benchmark and check the bill yourselfThe measurement pipeline is public: the cost-split study, the re