Headroom (headroom-ai)
Compress tool outputs, logs, JSON and chat history before each LLM call, so the model sees fewer input tokens and the same facts. Runs in-process, in Python, with no API key and no model download. Originals are cached locally and retrievable.
Measured: 21–57% fewer input tokens on four agent scenarios, 90%+ on repeated JSON arrays and log lines, little on prose. Numbers and how to reproduce them: https://docs.headroomlabs.ai/docs/benchmarks and the "Proof" section of https://github.com/headroomlabs-ai/headroom
Use it from a Python app that calls an LLM
pip install headroom-ai
from headroom import compress
result = compress(messages, model="gpt-4o") # OpenAI or Anthropic message dicts
result.messages # same shape as the input, fewer tokens
result.tokens_before, result.tokens_after, result.tokens_saved
Pass result.messages to your existing client call instead of messages.
Nothing else changes. Error lines, stack traces, first and last items and
statistical outliers are kept; repeated and low-information items are dropped.
Zero-network check, no provider key needed:
HEADROOM_OFFLINE=1 python -c "from headroom import compress; log='\n'.join(f'INFO step {i} ok' for i in range(3000))+'\nFATAL disk full'; r=compress([{'role':'user','content':'What failed?'},{'role':'assistant','content':None,'tool_calls':[{'id':'c1','type':'function','function':{'name':'logs','arguments':'{}'}}]},{'role':'tool','tool_call_id':'c1','content':log}], model='gpt-4o'); print(r.tokens_before, '->', r.tokens_after, 'FATAL kept:', 'FATAL' in str(r.messages))"
Prints on the order of 20000 -> 95 FATAL kept: True. HEADROOM_OFFLINE=1
blocks every connection Headroom would make on its own: the update check, model
and pricing-table downloads, and the anonymous usage beacon the proxy and MCP
server send by default (HEADROOM_BEACON=off turns off only the beacon).
FastAPI example with a POST /chat endpoint:
https://docs.headroomlabs.ai/docs/fastapi
Use it around a coding agent (no code changes)
uv tool install --python 3.13 "headroom-ai[all]" # CLI in its own env; pip install "headroom-ai[proxy]" also works
headroom wrap claude # also: codex, grok, copilot, cursor, aider, opencode, cline, continue, goose, openhands, openclaw, vibe, omp, zcode
headroom proxy --port 8787 # or run the proxy and point any client at it
Other entry points
- OpenAI, Anthropic, LiteLLM, LangChain, Agno, Strands, CrewAI, AutoGen adapters: https://docs.headroomlabs.ai/docs (Integrations)
- MCP server (
headroom_compress,headroom_retrieve,headroom_stats): https://docs.headroomlabs.ai/docs/mcp - TypeScript SDK (
npm install headroom-ai, needs the proxy running): https://www.npmjs.com/package/headroom-ai - Full docs index for agents: https://docs.headroomlabs.ai/llms.txt
- Source and issues: https://github.com/headroomlabs-ai/headroom
Extras: [proxy] adds the HTTP proxy and headroom wrap, [mcp] the MCP
server, [ml] the Kompress text model (torch), [all] everything. The base
install is enough for compress(). Requires Python 3.11+.
Apache 2.0. The import and CLI name is headroom; the PyPI distribution named
headroom is a different project.
Metadata
Release files for headroom-ai 0.43.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| headroom_ai-0.43.0.tar.gz | 3.5 MB | With provenance | Details for headroom_ai-0.43.0.tar.gz |
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| headroom_ai-0.43.0-cp310-abi3-win_amd64.whl | CPython 3.10 | abi3 | Windows x86-64 | Details for headroom_ai-0.43.0-cp310-abi3-win_amd64.whl |
| headroom_ai-0.43.0-cp310-abi3-manylinux_2_28_x86_64.whl | CPython 3.10 | abi3 | Linux glibc 2.28+ x86-64 | Details for headroom_ai-0.43.0-cp310-abi3-manylinux_2_28_x86_64.whl |
| headroom_ai-0.43.0-cp310-abi3-manylinux_2_28_aarch64.whl | CPython 3.10 | abi3 | Linux glibc 2.28+ ARM64 | Details for headroom_ai-0.43.0-cp310-abi3-manylinux_2_28_aarch64.whl |
| headroom_ai-0.43.0-cp310-abi3-macosx_11_0_arm64.whl | CPython 3.10 | abi3 | macOS 11.0+ ARM64 | Details for headroom_ai-0.43.0-cp310-abi3-macosx_11_0_arm64.whl |
| headroom_ai-0.43.0-cp310-abi3-macosx_10_12_x86_64.whl | CPython 3.10 | abi3 | macOS 10.12+ x86-64 | Details for headroom_ai-0.43.0-cp310-abi3-macosx_10_12_x86_64.whl |
Total release size: 82.2 MB
Release files / headroom_ai-0.43.0.tar.gz
| Download URL | headroom_ai-0.43.0.tar.gz |
|---|---|
| Size | 3.5 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f188bbfbc3de589ace57151bb932894b3427f9158b9d8b5054c296f57e2e0b66
|
|
BLAKE2b-256 checksum How to use checksums |
96b06f4018a8b7e4b4365bc4b0b51e784cfea79cd57391ce7f8ef67431ce06e1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.
Transparency logRelease files / headroom_ai-0.43.0-cp310-abi3-win_amd64.whl
| Download URL | headroom_ai-0.43.0-cp310-abi3-win_amd64.whl |
|---|---|
| Size | 15.8 MB |
| Tags | CPython 3.10 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
30dfcfd2590e96e4a94be914f4fcd27c71eec27e79bb3619b0d928c0c31d16f7
|
|
BLAKE2b-256 checksum How to use checksums |
d88834010c97d332cf07c0c0f588c6061b993299fe7ae42ffbf15c6c132a0aa8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.
Transparency logRelease files / headroom_ai-0.43.0-cp310-abi3-manylinux_2_28_x86_64.whl
| Download URL | headroom_ai-0.43.0-cp310-abi3-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 15.8 MB |
| Tags | CPython 3.10 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
d79dac75742beb2569a293dedc22a219910f0d65102db5986fd311dfb30d7dd6
|
|
BLAKE2b-256 checksum How to use checksums |
43a1d9b02a18bfa74390b2d0ea1fc84de74f303277528ba6d35a5b453ee098e8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.
Transparency logRelease files / headroom_ai-0.43.0-cp310-abi3-manylinux_2_28_aarch64.whl
| Download URL | headroom_ai-0.43.0-cp310-abi3-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 15.7 MB |
| Tags | CPython 3.10 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
387b24a97081f1e7bd8180d1e2d6d6c99a55fc57d181ff6b74cc9e7eed3f6581
|
|
BLAKE2b-256 checksum How to use checksums |
4e0b8eb0a580ac639c2c7248710a26338edc4c98a2a89182a4b555ae358bd593
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.
Transparency logRelease files / headroom_ai-0.43.0-cp310-abi3-macosx_11_0_arm64.whl
| Download URL | headroom_ai-0.43.0-cp310-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 15.7 MB |
| Tags | CPython 3.10 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
d96d6aeed218396f87b50f180408cea3d51715bcd9c6dc980953eb58982b11d7
|
|
BLAKE2b-256 checksum How to use checksums |
b3af4370826ac00df5a348b08def5cc20ef9b80fe7676d92f313ff6feca5ab82
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.
Transparency logRelease files / headroom_ai-0.43.0-cp310-abi3-macosx_10_12_x86_64.whl
| Download URL | headroom_ai-0.43.0-cp310-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 15.7 MB |
| Tags | CPython 3.10 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
f760a947dbd03f08f825e1854c8500ec2f2498c4e3ab9fe25eb8d14b52585069
|
|
BLAKE2b-256 checksum How to use checksums |
7bd635bf0464ccae00a737290354a104ad0dc31ea0e5012027150a97c984a198
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.
Transparency logSecurity for headroom-ai 0.43.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 6 files in this release have been uploaded with provenance metadata.
Attestation for headroom_ai-0.43.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.