whatisgithub

What is tokentamer?

borhen68/tokentamer — explained in plain English

Analysis updated 2026-05-18

103PythonAudience · developerComplexity · 3/5LicenseSetup · hard

In one sentence

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.

Mindmap

mindmap
  root((TokenTamer))
    What it does
      Intercepts API requests
      Compresses code context
      Injects prompt caching
    Tech stack
      Python
      Proxy server
    Use cases
      Lower AI coding costs
      Long coding sessions
    Audience
      Developers

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Reduce token costs for AI coding tools like Aider or Cursor by pointing them at the local proxy.

USE CASE 2

Keep the file you are actively editing intact while background files get compressed to outlines.

USE CASE 3

Add Anthropic prompt caching headers automatically to lower the cost of long Claude Code sessions.

What is it built with?

Python

How does it compare?

borhen68/tokentamerasz798838958/geniusfkoairulyone/simple-react-agent
Stars103103103
LanguagePythonPythonPython
Setup difficultyhardhardeasy
Complexity3/54/52/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · hard Time to first run · 1h+

Tools with hardcoded API URLs need a local SSL certificate and hosts file redirect to work.

Use, copy, modify, and distribute freely, including commercially, as long as you keep the copyright notice.

So what is it?

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.

Copy-paste prompts

Prompt 1
Walk me through changing Cursor's API base URL to point at TokenTamer's local proxy
Prompt 2
Explain how TokenTamer decides which parts of a file to compress and which to leave untouched
Prompt 3
Explain the certificate and hosts file setup needed to use TokenTamer with Claude Code
Prompt 4
Explain the tradeoffs of using alpha software like TokenTamer for a production coding workflow

Frequently asked questions

What is tokentamer?

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.

What language is tokentamer written in?

Mainly Python. The stack also includes Python.

What license does tokentamer use?

Use, copy, modify, and distribute freely, including commercially, as long as you keep the copyright notice.

How hard is tokentamer to set up?

Setup difficulty is rated hard, with roughly 1h+ to a first successful run.

Who is tokentamer for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.