Reduce token costs for AI coding tools like Aider or Cursor by pointing them at the local proxy.
Keep the file you are actively editing intact while background files get compressed to outlines.
Add Anthropic prompt caching headers automatically to lower the cost of long Claude Code sessions.
| borhen68/tokentamer | asz798838958/geniusfkoai | rulyone/simple-react-agent | |
|---|---|---|---|
| Stars | 103 | 103 | 103 |
| Language | Python | Python | Python |
| Setup difficulty | hard | hard | easy |
| Complexity | 3/5 | 4/5 | 2/5 |
| Audience | developer | developer | developer |
Figures from each repo's GitHub metadata at analysis time.
Tools with hardcoded API URLs need a local SSL certificate and hosts file redirect to work.
TokenTamer is a proxy server that sits between an AI coding tool and the AI API it calls, such as OpenAI or Anthropic. When your coding agent sends a large amount of code to the AI for analysis, TokenTamer intercepts the request, compresses the code context, and forwards a smaller version to the API. The goal is to reduce the number of tokens billed, which lowers cost. The compression works by parsing source code and replacing function bodies with their outlines: signatures, class names, and import statements remain intact, but the interior of functions that are not currently being edited get stripped out. The idea is that background files the agent is not actively modifying do not need to be sent in full. The file or files the agent is currently working on are left completely untouched. For tools like Claude Code, which re-read the same files many times during a session, TokenTamer tracks which version of a file was read most recently and keeps only that one intact. Earlier reads of the same file get compressed down to the skeleton version. It also injects Anthropic's prompt caching headers into outbound requests, which can substantially reduce the cost of long sessions because cached input tokens are billed at a much lower rate. Setup depends on which tool you are using. For Aider and Cursor, you change the API base URL in your tool's settings to point at the proxy running locally. For Claude Code and Codex CLI, which have the API URL hardcoded, the setup is more involved: you generate a local SSL certificate, tell your operating system to trust it, and redirect the real API domains to point at your own machine via a hosts file entry. A cleanup procedure for undoing all of this is included in the README. The README is clear that this is alpha software. The cost savings figures come from tests with synthetic payloads, not from measured real-world sessions. Some limitations include no savings for sessions where a file is only read once, and no multi-session caching yet. The project is MIT licensed.
A proxy server that sits between your AI coding tool and the AI API, compressing code context before sending it, to cut token costs on large sessions.
Mainly Python. The stack also includes Python.
Use, copy, modify, and distribute freely, including commercially, as long as you keep the copyright notice.
Setup difficulty is rated hard, with roughly 1h+ to a first successful run.
Mainly developer.
This repo across BitVibe Labs
Verify against the repo before relying on details.