Available in
Marketplaces, most starred first
Tags
Add to README
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
By agiwhitelistv0.1.0MITIn 1 marketplace
Shows token cost and tool I/O sizes for your Claude Code sessions. A hook logs every tool call locally; token savings need the separate tokdiet proxy and ANTHROPIC_BASE_URL, not this plugin alone.
Trending plugins
7-day copy clicks
You run one by typing its /name in Claude Code.
1 critical · 2 cautions to review before installing
A hook runs before every tool call and can block or approve it
A hook runs when Claude uses the Bash tool
A hook runs when Claude writes or edits files
Static checks of hooks, mods, MCP servers and commands. Not a security audit.
1 marketplace, most starred first
token-usage, cost-tracking, context-compaction, token-metering, api-proxy, tool-logging, tokens, cost ·
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Your AI agent is paying to send the same file dump five times. tokdiet is a local proxy that sits between your agent and the model API, meters every token, puts your bloated context on a diet — and proves the answer didn't get worse.
ccusage that shrinks the bill — without losing quality.
🌐 Live demo (watch one request lose the weight): agiwhitelist.github.io/tokdiet 📝 Launch write-up + full benchmark methodology: I cut an AI agent's input tokens by 71% and quality held — here's the 66-task benchmark
Every "context optimizer" cuts tokens. The scary question is the one they can't answer:
"If I cut the context, does the model get dumber?"
So we measured it. A 66-task A/B benchmark across 6 categories on a real model (MiniMax‑M3), each task run twice — full context (baseline) vs through tokdiet (governed) — graded against the known answer, repeated ×3 and majority‑voted to cancel model noise:
baseline tokdiet
input tokens 5.07M → 1.46M −71%
quality (66 tasks) 64/66 63/66 ≈ parity (95–97%)
─────────────────────────────────────────────────────────
198 paired runs · LLM-judge 92% similarity · confirmed on a 2nd model (MiniMax-M2.5: −72%)
−71% tokens, quality on par with baseline. Real requests, real grading — not a mock. The ~1–2 task gap is model nondeterminism plus the model declining to echo a secret — not context loss; the hardest "needle buried in junk" adversarial cases pass, because tokdiet doesn't delete blindly — it pages cold context out recoverably and protects anything on‑topic. Reproduce it yourself: node bench/run.mjs (needs an API key in env).
| shows your bill | cuts the bill | proves quality held | |
|---|---|---|---|
eyeballing /cost, ccusage | ✅ | ❌ | ❌ |
manual /compact, hand-pruning context | ❌ | ✅ (blind) | ❌ |
| tokdiet | ✅ | ✅ | ✅ measured + auto safe-mode |
Everyone shows the bill or cuts it blind. tokdiet is the one that cuts it and proves the model didn't get dumber — and stops cutting the moment it might.
# 1. Start the proxy (and live dashboard) — no install needed
npx tokdiet start
# 2. Point your agent at the proxy instead of the real API
export ANTHROPIC_BASE_URL=http://localhost:7787
export OPENAI_BASE_URL=http://localhost:7787/v1
Now run your agent (Claude Code, Cursor, Codex, your own script) as usual. Traffic flows through tokdiet, gets metered and compacted, and is forwarded upstream unchanged in every way that matters.
Your API key stays with you. tokdiet reads x-api-key / Authorization only to forward them upstream. They are never written to SQLite and never written to any log. And it's fail‑open: if anything inside the governor errors, it falls back to transparent passthrough — the proxy will never break your request or surface its own 5xx.
Default ports: proxy
7787, dashboard7878. Override with--port/--dashboard-port.
tokdiet ships as a Claude Code plugin via its own marketplace:
/plugin marketplace add agiwhitelist/tokdiet
/plugin install tokdiet
What the plugin does — and what it doesn't. The plugin ships a lightweight
metering hook plus a /tokdiet command. The hook runs on every tool call
(PreToolUse + PostToolUse) and logs tool I/O byte sizes to
~/.tokdiet/tool-meter.log. It does not save tokens by itself — a plugin
can't set ANTHROPIC_BASE_URL for the Claude Code process, so it can't route
your traffic through the compacting proxy.
The actual token savings come from the proxy. Start it and point Claude Code at it (this is what gives you the ~−71% token reduction):
npx tokdiet start
export ANTHROPIC_BASE_URL=http://localhost:7787 # then launch Claude Code from this shell
Built from public signals: copy clicks on this site, GitHub stars and activity, the README and the manifest. Not a security audit or an endorsement.
npx claudepluginhub agiwhitelist/tokdiet --plugin tokdietPlugins from other owners that cover similar ground