← Reddit

Open-source layer that cuts ~87% of your Claude Code / API token usage - quality-neutral, measured on real billed tokens

Reddit · naruto_uzumaki00 · July 5, 2026
An open-source layer reduces Claude Code and API token usage by approximately 87% while maintaining output quality through prefix caching, tail compression, retrieval techniques, and local model cascading. The tool functions as an MCP plugin for Claude Code that returns only relevant code slices instead of whole files, and as an API proxy compatible with OpenAI and Anthropic implementations. Testing on heavy computational tasks reduced token consumption from 26,573 to 3,343 for Claude Opus and from 16,875 to 2,232 for GPT-5.5 without quality degradation.

Detailed Analysis

A developer has released an open-source token-reduction layer aimed at Claude Code and API-based Claude usage, claiming an 87.4% reduction in input tokens for Opus 4.8 (from 26,573 to 3,343 tokens) and 86.8% for GPT-5.5, while reportedly holding quality steady at 3/3 on internal test suites. The tool, published under Apache-2.0 licensing at github.com/AryanGonsalves/trl-token-reduction, works two ways: as an MCP plugin for Claude Code and Codex that returns targeted code slices via functions like retrieve_code and explain_symbol rather than dumping entire files into context, and as a vendor-compatible proxy for API users that requires only swapping the base_url while retaining their existing API key. The underlying mechanism combines four techniques—prefix caching, tail compression with a numeric-integrity guard, retrieval-based context narrowing, and cascading routing that sends simpler tasks to smaller local models instead of the flagship model.

This addresses a increasingly salient pain point in the Claude Code ecosystem: Anthropic's shift to token-based billing means that inefficient context management directly translates into higher costs and faster consumption of weekly usage caps. Common inefficiencies the tool targets—agents grepping and reading whole files when only a few lines matter, resending full conversation history on every turn, and routing trivial queries to the most expensive model—are well-documented sources of waste in agentic coding workflows. By intercepting and restructuring what actually gets sent to the model, rather than modifying the model itself, the approach is model-agnostic and could in principle apply to any LLM provider, which explains the OpenAI-compatible proxy design alongside the Anthropic-specific MCP plugin.

The developer's transparency about limitations is notable and lends some credibility to an otherwise bold claim: the README reportedly acknowledges that test suites were small and favorable, and that static embeddings failed to outperform simple keyword-based retrieval in some cases—an admission that tempers the headline numbers and suggests the results may not generalize robustly across diverse codebases or task types. The inclusion of a browser extension for claude.ai (still pending Web Store review) is presented as a secondary feature, with the author explicitly framing the API/Claude Code integration as the primary value proposition.

This release fits into a broader trend of third-party tooling emerging around Claude Code and agentic coding assistants generally, as developers seek to optimize cost and latency without waiting for first-party solutions from Anthropic, OpenAI, or other model providers. As usage-based and cap-based pricing models become standard for AI coding tools, a growing ecosystem of context-compression, caching, and model-routing middleware is likely to develop—mirroring earlier trends in traditional software infrastructure where proxies, caching layers, and load balancers emerged to optimize expensive backend calls. Whether this particular project scales beyond its initial benchmarks will depend on independent verification across larger, more diverse codebases, but it reflects growing community sophistication in treating token consumption as an engineering problem worth solving at the infrastructure layer rather than leaving entirely to model providers.

Read original article →