Claude Code model router
Tokdiet
Local streaming reverse proxy between AI coding agents (Claude Code, Cursor, Codex) and model APIs (Anthropic, OpenAI, Gemini, MiniMax). Meters every token + USD cost, compacts bloated context to cut pay-per-token API spend, and runs shadow-eval to prove quality held. ccusage-style metering + live local dashboard.
Install
/plugin marketplace add agiwhitelist/tokdietFound in the project README. Check it for setup steps after installing.
git clone https://github.com/agiwhitelist/tokdiet.gitFrom the README
tokdiet 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 The proof (this is the whole point) 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: −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). How it compares 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. Quick start 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…
Details
- Repository
- agiwhitelist/tokdiet
- Website
- agiwhitelist.github.io/tokdiet
- Language
- TypeScript
- License
- MIT
- Last updated
- 18 June 2026
- Topics
- ai-gatewayanthropicccusageclaude-codeclicontext-compressioncontext-engineeringcost-optimizationcost-trackinggeminillmllm-gateway
FAQ
What is Tokdiet?
Local streaming reverse proxy between AI coding agents (Claude Code, Cursor, Codex) and model APIs (Anthropic, OpenAI, Gemini, MiniMax). Meters every token + USD cost, compacts bloated context to cut pay-per-token API spend, and runs shadow-eval to prove quality held. ccusage-style metering + live local dashboard. It is a model router for Claude Code, from agiwhitelist/tokdiet on GitHub.
How do I install Tokdiet?
Run /plugin marketplace add agiwhitelist/tokdiet inside Claude Code, then follow the setup in the README.
Is Tokdiet popular?
agiwhitelist/tokdiet has 32 GitHub stars and 2 forks. It was last updated on 18 June 2026.
More model routers & proxies
Claude Gateway
260xMaxMa/claude-gateway
Turn Claude Code into a voice-enabled, multi-channel assistant that runs tasks in parallel
Claude N Codex API Proxy
28jimmc414/claude_n_codex_api_proxy
Claude Code and Codex API Routing Proxy
Yoshi
31compozy/yoshi
Context-pruning proxy for Claude Code and Codex: Jev judges which history is still needed, measured not claimed. POC here now, heading soon into https://github.com/compozy/compozy
CCR Rust
29RESMP-DEV/ccr-rust
Universal AI coding proxy. Use Claude Code, Codex CLI, or any tool with DeepSeek, GLM, MiniMax, and more—without rate limits breaking your flow.
Claudegpt
33pilc80/claudegpt
Use ChatGPT/Codex OAuth in Claude Code without an API key
Antomix
27unclecode/antomix
Universal Claude Code Proxy | Bidirectional Anthropic ↔ OpenAI API Bridge
Browse the most popular Claude Code mods, all model routers & proxies, or the skills and MCP server directories.