Headroom: "up to 95% fewer tokens", tested on four agent turns
Headroom sits between an agent and the model and shrinks tool output before the model sees it. The headline number is real for logs. For everything else it is much smaller, and when the model needs a line it threw away, you pay twice.
What it is
Headroom can be used four ways: a compress() call in your own code, a proxy that speaks the OpenAI and Anthropic APIs, a wrapper that starts the proxy and points Claude Code at it, or an MCP server. Inside, a router picks a compressor for each piece of tool output. Logs keep the lines that matter, JSON arrays become a compact table, code is handled by syntax tree, and prose goes through a small language model.
The clever part is that nothing is thrown away for good. Dropped content is kept locally, and the proxy adds a retrieve tool the model can call to get it back. The proxy answers that call itself, so the client needs no changes.
There is an anonymous telemetry beacon, on by default, that reports compression ratios, counters, model names and the operating system. We turned it off. A paid Enterprise tier exists, with no published price, but nothing in the open-source path needs an account.
How we tested it
We installed the pinned package from PyPI in a container, with telemetry off, and ran it as a proxy in front of our own model gateway. The container exited when the demo finished, so nothing was left running.
We built four synthetic agent turns. Each had a user question, a tool call, and the tool's output as the newest message. We sent each one to the model directly and through Headroom, and counted the prompt tokens the provider reported.
| Scenario | Direct | Through Headroom | Same answer? |
|---|---|---|---|
| A 1,500-line log with one FATAL line | 54,051 | 1,767 (-97%) | yes |
| The same log, answer in an ordinary INFO line | 54,054 | about 1,800, then 55,898 | yes |
| 200 JSON code-search hits | 10,560 | 4,978 (-53%) | yes |
| 60 near-identical functions | 4,536 | 4,745 (+5%) | yes |
What happened in each
The log. 1,500 lines became 40: the FATAL line and its neighbours, a summary of what was left out, and a hash for getting the rest back. The model gave the same answer. This is the headline, and it is real.
The lookup. The line the model needed had been dropped as ordinary noise. The model called the retrieve tool, the proxy fetched the original and asked again, and the answer was right. But that took two calls, the second with the full log, so the turn cost more than sending the log directly and took longer.
The search results. The JSON became a CSV-like table with all 200 rows kept. That is a lossless reformat, and halving the tokens without losing anything is a good result.
The code. Headroom leaves file reads alone by design, so code was not compressed. The small increase is the retrieve tool's definition and a "be terse" note that the proxy adds to every request.
What worked
- Installing from PyPI took a few minutes, with no account and no key of its own.
- It worked as a transparent proxy in front of an existing gateway.
- The fetch-back works without any support in the client.
What did not
- "Up to 95%" is the best case. Repetitive logs, yes. JSON, about half. Source files and prose, nothing in our run: prose needs the small compression model, and its download failed for us.
- When a dropped detail is needed, you pay more, not less, and wait for a second call.
- Telemetry is on by default.
- We did not try the Claude Code wrapper, because it edits your real Claude Code settings and installs another MCP server. The proxy uses the same engine.
The verdict
6 / 10. Headroom does one thing very well. If your agents read large, repetitive logs, such as CI output, incident sweeps or server logs, put it in front of the model and expect most of those tokens to go. For JSON it is a tidy saving. For code-heavy sessions on a flat subscription it adds a little and saves nothing. We removed it for now, and kept the pinned setup so we can bring it back the day we have big logs to chew through.