<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: agiwhitelist</title>
    <description>The latest articles on DEV Community by agiwhitelist (@agiwhitelist).</description>
    <link>https://dev.to/agiwhitelist</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3989836%2F90c35d9b-9676-4297-9877-252131ac3cf3.png</url>
      <title>DEV Community: agiwhitelist</title>
      <link>https://dev.to/agiwhitelist</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/agiwhitelist"/>
    <language>en</language>
    <item>
      <title>I cut an AI agent's input tokens by 71% and quality held — here's the 66-task benchmark</title>
      <dc:creator>agiwhitelist</dc:creator>
      <pubDate>Wed, 17 Jun 2026 22:08:31 +0000</pubDate>
      <link>https://dev.to/agiwhitelist/i-cut-an-ai-agents-input-tokens-by-71-and-quality-held-heres-the-66-task-benchmark-2b97</link>
      <guid>https://dev.to/agiwhitelist/i-cut-an-ai-agents-input-tokens-by-71-and-quality-held-heres-the-66-task-benchmark-2b97</guid>
      <description>&lt;p&gt;I cut a coding agent's input tokens by &lt;strong&gt;71%&lt;/strong&gt; — from 5.07M down to 1.46M across a 66-task run — and quality stayed within model noise (63 vs 64 of 66 tasks solved).&lt;/p&gt;

&lt;p&gt;This post is the benchmark, the failures, the honesty caveats, and the code. No "revolutionary." Just numbers you can reproduce.&lt;/p&gt;

&lt;h2&gt;
  
  
  TL;DR
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;What it is:&lt;/strong&gt; &lt;code&gt;tokdiet&lt;/code&gt; — a local streaming reverse proxy that sits between your agent tools (Claude Code, Cursor, Codex, custom scripts) and the model APIs (Anthropic, OpenAI, Gemini, MiniMax, anything OpenAI/Anthropic-compatible).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The headline number:&lt;/strong&gt; input tokens &lt;strong&gt;5.07M → 1.46M = -71%&lt;/strong&gt;; quality &lt;strong&gt;63/66 vs 64/66&lt;/strong&gt; baseline ≈ parity. 198 paired runs. LLM-judge reports 92% similarity. Confirmed on a 2nd model at -72%.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Install:&lt;/strong&gt; &lt;code&gt;npx tokdiet start&lt;/code&gt; — proxy on &lt;code&gt;:7787&lt;/code&gt;, live dashboard on &lt;code&gt;:7878&lt;/code&gt;, loopback only.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Repo:&lt;/strong&gt; &lt;a href="https://github.com/agiwhitelist/tokdiet" rel="noopener noreferrer"&gt;https://github.com/agiwhitelist/tokdiet&lt;/a&gt; — MIT, TypeScript, Node 20+.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Honesty up front:&lt;/strong&gt; this is &lt;strong&gt;not lossless&lt;/strong&gt;. It's "within model noise." Only the dedup pass is loss-free; the rest is &lt;em&gt;recoverable&lt;/em&gt;, not deleted. And the dollar savings apply to &lt;strong&gt;pay-per-token API keys&lt;/strong&gt; — on a flat Claude subscription there's no per-token bill to cut.&lt;/li&gt;
&lt;/ul&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://assets.dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/agiwhitelist" rel="noopener noreferrer"&gt;
        agiwhitelist
      &lt;/a&gt; / &lt;a href="https://github.com/agiwhitelist/tokdiet" rel="noopener noreferrer"&gt;
        tokdiet
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      ccusage that shrinks the bill — without losing quality. Local proxy that meters tokens, compacts bloated LLM context, and proves quality didn't drop (−72% tokens, 0 regressions on real-model A/B).
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;tokdiet&lt;/h1&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Your AI agent is paying to send the same file dump five times.&lt;/strong&gt; &lt;code&gt;tokdiet&lt;/code&gt; is a local proxy that sits between your agent and the model API, meters every token, puts your bloated context &lt;strong&gt;on a diet&lt;/strong&gt; — and &lt;em&gt;proves&lt;/em&gt; the answer didn't get worse.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;ccusage that shrinks the bill — without losing quality.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;a rel="noopener noreferrer" href="https://github.com/agiwhitelist/tokdiet/assets/tokdiet-demo.svg"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fagiwhitelist%2Ftokdiet%2FHEAD%2Fassets%2Ftokdiet-demo.svg" alt="tokdiet — −71% tokens, quality = baseline"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/agiwhitelist/tokdiet/actions/workflows/ci.yml" rel="noopener noreferrer"&gt;&lt;img src="https://github.com/agiwhitelist/tokdiet/actions/workflows/ci.yml/badge.svg" alt="CI"&gt;&lt;/a&gt; &lt;a rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/b8cadaa967891081f8f165695470689986c028821dd8a040132f6e661795dc0d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c7565"&gt;&lt;img src="https://camo.githubusercontent.com/b8cadaa967891081f8f165695470689986c028821dd8a040132f6e661795dc0d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c7565" alt="license"&gt;&lt;/a&gt; &lt;a rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/508b1391e0fd9b2a0a355208d8cde75e3168f3cef23d6d6fc0b0ca38e0232174/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6e6f64652d25334525334432302d627269676874677265656e"&gt;&lt;img src="https://camo.githubusercontent.com/508b1391e0fd9b2a0a355208d8cde75e3168f3cef23d6d6fc0b0ca38e0232174/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6e6f64652d25334525334432302d627269676874677265656e" alt="node"&gt;&lt;/a&gt; &lt;a rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/069a0ee4c302a6b7eb628ce2e2890dec755caacdc0c26d6bc1f470551227e465/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f746f6b656e732d25453225383825393237302532352d73756363657373"&gt;&lt;img src="https://camo.githubusercontent.com/069a0ee4c302a6b7eb628ce2e2890dec755caacdc0c26d6bc1f470551227e465/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f746f6b656e732d25453225383825393237302532352d73756363657373" alt="status"&gt;&lt;/a&gt; &lt;a rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/78d3dfcd0e5f961ccee94442e14b7da0485b13016debbdec684a68b185710dfc/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7175616c6974792d253344253230626173656c696e652d73756363657373"&gt;&lt;img src="https://camo.githubusercontent.com/78d3dfcd0e5f961ccee94442e14b7da0485b13016debbdec684a68b185710dfc/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7175616c6974792d253344253230626173656c696e652d73756363657373" alt="quality"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;The proof (this is the whole point)&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;Every "context optimizer" cuts tokens. The scary question is the one they can't answer:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;"If I cut the context, does the model get dumber?"&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;So we measured it. A &lt;strong&gt;66-task&lt;/strong&gt; A/B benchmark across 6 categories on a &lt;strong&gt;real model&lt;/strong&gt; (MiniMax‑M3), each task run &lt;strong&gt;twice&lt;/strong&gt; — full context (baseline) vs through &lt;code&gt;tokdiet&lt;/code&gt; (governed) — graded against the &lt;strong&gt;known answer&lt;/strong&gt;, repeated ×3 and majority‑voted to cancel model noise:&lt;/p&gt;
&lt;div class="snippet-clipboard-content notranslate position-relative overflow-auto"&gt;
&lt;pre class="notranslate"&gt;&lt;code&gt;                       baseline      tokdiet
  input tokens          5.07M    →    1.46M       −71%
  quality (66 tasks)     64/66        63/66        ≈ parity (95–97%)
  ─────────────────────────────────────────────────────────
  198 paired runs ·&lt;/code&gt;&lt;/pre&gt;…&lt;/div&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/agiwhitelist/tokdiet" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;h2&gt;
  
  
  The problem: agent loops re-send the same junk forever
&lt;/h2&gt;

&lt;p&gt;If you've watched a long agent session, you've seen it. The model reads a file. Three turns later it reads the same file again, and the full dump rides along in context &lt;em&gt;every single turn&lt;/em&gt; after that. Stale tool output from step 2 is still being re-transmitted at step 40.&lt;/p&gt;

&lt;p&gt;The transcript grows monotonically. Every turn you pay to re-send the entire history, and most of that history is dead weight — re-pasted files and tool results nobody will look at again.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;ccusage&lt;/code&gt; is great at showing you this. It tells you the bill is climbing. It does not shrink the bill. I wanted the thing that shrinks it — without quietly making the agent dumber.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The frame I kept coming back to: &lt;strong&gt;ccusage that shrinks the bill — without losing quality.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Why I didn't just summarize the conversation
&lt;/h2&gt;

&lt;p&gt;The obvious fix is mid-conversation summarization: when context gets big, ask the model to compress the old turns into a paragraph and throw the originals away.&lt;/p&gt;

&lt;p&gt;This is the graveyard everyone walks into. It's lossy by construction. The summary drops the exact error string, the exact id, the exact line number — and then three turns later the model needs precisely the thing you threw away, and it can't get it back because it's gone.&lt;/p&gt;

&lt;p&gt;So in &lt;code&gt;tokdiet&lt;/code&gt;, &lt;strong&gt;mid-summarize is OFF by default.&lt;/strong&gt; It exists as an opt-in (and it costs money, because it's another model call), but it is never the thing that runs unless you ask for it. The defaults are built around &lt;em&gt;not&lt;/em&gt; destroying information.&lt;/p&gt;

&lt;h2&gt;
  
  
  How it works
&lt;/h2&gt;

&lt;p&gt;It's a streaming reverse proxy. SSE responses are proxied incrementally, so tokens still stream to your agent live — you don't sit and wait for a buffered blob.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;request ─► interceptor ─► meter ─► budget ─► compactor ─► quality guard ─► model API
                                                  │
                                                  └─► store (SQLite) + dashboard :7878
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The mental model is &lt;strong&gt;context as virtual memory.&lt;/strong&gt; Hot content — recent turns, pinned blocks, anything relevant to the current question — stays &lt;em&gt;resident&lt;/em&gt; in the request. Cold content — stale, redundant tool output — gets &lt;strong&gt;paged out&lt;/strong&gt; to a local SQLite store as a recoverable stub. It's kept by id, not deleted. (Paging it back in on demand is on the roadmap.)&lt;/p&gt;

&lt;p&gt;Two strategies do the real work, safest first:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// 1. Dedup — LOSS-FREE&lt;/span&gt;
&lt;span class="c1"&gt;// Re-pasted blocks: keep the freshest copy verbatim,&lt;/span&gt;
&lt;span class="c1"&gt;// replace the earlier copies with a marker. Catches&lt;/span&gt;
&lt;span class="c1"&gt;// near-duplicates too, not just byte-identical ones.&lt;/span&gt;

&lt;span class="c1"&gt;// 2. Elision — RECOVERABLE&lt;/span&gt;
&lt;span class="c1"&gt;// Page out the bulk of OLD tool results. Keep a preview +&lt;/span&gt;
&lt;span class="c1"&gt;// the salient lines (errors, ids, KEY=VALUE, URLs, paths,&lt;/span&gt;
&lt;span class="c1"&gt;// numbers). Store the full body for recovery. Recent,&lt;/span&gt;
&lt;span class="c1"&gt;// pinned, and question-relevant results are kept intact.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Dedup is the free lunch — if the same file is in context five times, four copies are pure waste and removing them changes nothing. Elision is where the bulk of the savings come from, and it's the part that has to be measured, because "keep the salient lines" is a judgment call.&lt;/p&gt;

&lt;h2&gt;
  
  
  The benchmark
&lt;/h2&gt;

&lt;p&gt;I didn't want to ship a vibes claim, so I built an A/B harness.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Methodology:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;66 tasks&lt;/strong&gt;, across &lt;strong&gt;6 categories&lt;/strong&gt;, on a real model (&lt;strong&gt;MiniMax-M3&lt;/strong&gt;).&lt;/li&gt;
&lt;li&gt;Each task is run &lt;strong&gt;twice&lt;/strong&gt;: once with full context (baseline), once routed through &lt;code&gt;tokdiet&lt;/code&gt; (governed).&lt;/li&gt;
&lt;li&gt;Both runs are graded against the &lt;strong&gt;known correct answer&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Every task is repeated &lt;strong&gt;×3 and majority-voted&lt;/strong&gt; to cancel model nondeterminism.&lt;/li&gt;
&lt;li&gt;That's &lt;strong&gt;198 paired runs&lt;/strong&gt; total.&lt;/li&gt;
&lt;li&gt;A separate &lt;strong&gt;LLM judge&lt;/strong&gt; scores output similarity between baseline and governed.&lt;/li&gt;
&lt;li&gt;Then re-run on a &lt;strong&gt;second model (MiniMax-M2.5)&lt;/strong&gt; to check it wasn't an artifact of one model.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Results:&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Metric&lt;/th&gt;
&lt;th&gt;Baseline (full context)&lt;/th&gt;
&lt;th&gt;Governed (tokdiet)&lt;/th&gt;
&lt;th&gt;Delta&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Input tokens&lt;/td&gt;
&lt;td&gt;5.07M&lt;/td&gt;
&lt;td&gt;1.46M&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;-71%&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Tasks solved&lt;/td&gt;
&lt;td&gt;64 / 66&lt;/td&gt;
&lt;td&gt;63 / 66&lt;/td&gt;
&lt;td&gt;-1 task (≈ parity)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Output similarity (LLM judge)&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;92%&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2nd model (MiniMax-M2.5) tokens&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;-72%&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Reproduce it yourself:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;node bench/run.mjs   &lt;span class="c"&gt;# needs an API key in your env&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  About that 1-task gap — being honest
&lt;/h2&gt;

&lt;p&gt;Baseline solved 64; governed solved 63. I am not going to call that "zero quality loss," because that's not what the data says and overclaiming is how trust dies.&lt;/p&gt;

&lt;p&gt;Here's what the gap actually is. Across 198 runs with ×3 majority voting, the difference lands inside model nondeterminism — the same prompt doesn't always produce the same grade. Part of the gap was also the model &lt;strong&gt;declining to echo back a secret value&lt;/strong&gt;, which is a behavior change, not a context-loss bug.&lt;/p&gt;

&lt;p&gt;The thing I cared most about — the hardest &lt;strong&gt;"needle buried in junk"&lt;/strong&gt; adversarial cases, where the one fact you need is hidden in a wall of stale output — those &lt;strong&gt;pass.&lt;/strong&gt; That's the test that would have caught elision throwing away something load-bearing, and it didn't.&lt;/p&gt;

&lt;p&gt;So: &lt;strong&gt;within model noise. ≈ parity. Quality held.&lt;/strong&gt; Not lossless.&lt;/p&gt;

&lt;h2&gt;
  
  
  The quality-guarantee mechanism
&lt;/h2&gt;

&lt;p&gt;The reason I'll say "quality held" with a straight face is that there's machinery watching for the opposite, and it can pull the brakes on itself.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Shadow-eval&lt;/strong&gt; — re-runs a sampled fraction of compacted requests (5% by default) against the uncompacted baseline and scores divergence on a 0 (identical) to 100 (unrelated) scale. This is the measurement, not a guess.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Quality budget&lt;/strong&gt; — a hard ceiling on measured degradation (default 2%). As it approaches the ceiling, the compactor restricts itself to its safest strategies.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Safe-mode&lt;/strong&gt; — if rolling degradation exceeds the budget, the offending strategy is disabled, per-strategy.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Savings stop before quality does.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That's the whole design philosophy in one line. Shadow-eval costs money (it's a re-run), which is why it's sampled — that's a real tradeoff, not a free feature.&lt;/p&gt;

&lt;h2&gt;
  
  
  A specific note for Claude Code users
&lt;/h2&gt;

&lt;p&gt;This one matters and I've seen it trip people up.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;proxy&lt;/strong&gt; is what saves tokens. You point your agent at it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx tokdiet start
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;ANTHROPIC_BASE_URL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;http://localhost:7787
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;OPENAI_BASE_URL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;http://localhost:7787/v1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There's also a Claude Code plugin (&lt;code&gt;/plugin marketplace add agiwhitelist/tokdiet&lt;/code&gt;, then &lt;code&gt;/plugin install tokdiet&lt;/code&gt;) — &lt;strong&gt;but the plugin is a metering hook only.&lt;/strong&gt; It cannot set &lt;code&gt;ANTHROPIC_BASE_URL&lt;/code&gt; for the Claude Code process, so &lt;strong&gt;the plugin alone does not save tokens.&lt;/strong&gt; It gives you metering and the dashboard. If you want the savings, route through the proxy. I'd rather tell you that now than have you install the plugin and wonder why nothing shrank.&lt;/p&gt;

&lt;p&gt;The proxy is &lt;strong&gt;cache-aware&lt;/strong&gt; (it never rewrites a &lt;code&gt;cache_control&lt;/code&gt; prefix, so it won't break your prompt cache) and &lt;strong&gt;thinking-safe&lt;/strong&gt; (it never mutates signed/thinking blocks, so it won't trigger a 400). Both are regression-tested.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where this is and isn't worth it
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Pay-per-token keys&lt;/strong&gt; (MiniMax, Anthropic API, OpenAI): the -71% is a real dollar cut.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Flat Claude subscription:&lt;/strong&gt; there are no per-token charges to shrink, so the value is the metering, the budgets, and the dashboard — not your bill.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Keys&lt;/strong&gt; are forwarded only. They are &lt;strong&gt;never&lt;/strong&gt; written to SQLite or any log. Loopback bind only. Fail-open: if the proxy hiccups, your request still goes through.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Known limits:&lt;/strong&gt; the default judge is a heuristic (the LLM judge is opt-in); shadow-eval costs money and is sampled; session inference is heuristic; page-fault recovery is limited for streaming; cost figures are estimates.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Try it in 60 seconds
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx tokdiet start
&lt;span class="c"&gt;# proxy on :7787, dashboard on :7878 (loopback only)&lt;/span&gt;

&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;ANTHROPIC_BASE_URL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;http://localhost:7787
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;OPENAI_BASE_URL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;http://localhost:7787/v1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run your agent as usual, then open &lt;code&gt;http://localhost:7878&lt;/code&gt; and watch the tokens and USD tick — including what got deduped vs paged out.&lt;/p&gt;

&lt;h2&gt;
  
  
  Break it, please
&lt;/h2&gt;

&lt;p&gt;The benchmark is only as good as the tasks in it. If you have a transcript where elision throws away something the model actually needed — an adversarial "needle in junk" case that fails — that's the most useful bug report I can get. Open an issue with the transcript and I'll add it to the suite.&lt;/p&gt;

&lt;p&gt;Repo (stars and issues welcome): &lt;a href="https://github.com/agiwhitelist/tokdiet" rel="noopener noreferrer"&gt;https://github.com/agiwhitelist/tokdiet&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;One question for the comments:&lt;/strong&gt; what's your worst context-bloat offender — re-pasted files, or stale tool output that never ages out?&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>ai</category>
      <category>typescript</category>
      <category>showdev</category>
    </item>
  </channel>
</rss>
