Skip to main content

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

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.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for headroom-ai 0.43.1
File Size Uploaded Provenance Actions
headroom_ai-0.43.1.tar.gz 3.5 MB With provenance Details for headroom_ai-0.43.1.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for headroom-ai 0.43.1
File Actions
headroom_ai-0.43.1-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details for headroom_ai-0.43.1-cp310-abi3-win_amd64.whl
headroom_ai-0.43.1-cp310-abi3-manylinux_2_28_x86_64.whl CPython 3.10 abi3 Linux glibc 2.28+ x86-64 Details for headroom_ai-0.43.1-cp310-abi3-manylinux_2_28_x86_64.whl
headroom_ai-0.43.1-cp310-abi3-manylinux_2_28_aarch64.whl CPython 3.10 abi3 Linux glibc 2.28+ ARM64 Details for headroom_ai-0.43.1-cp310-abi3-manylinux_2_28_aarch64.whl
headroom_ai-0.43.1-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details for headroom_ai-0.43.1-cp310-abi3-macosx_11_0_arm64.whl
headroom_ai-0.43.1-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details for headroom_ai-0.43.1-cp310-abi3-macosx_10_12_x86_64.whl

Total release size: 82.2 MB

Release files / headroom_ai-0.43.1.tar.gz

Download URL headroom_ai-0.43.1.tar.gz
Size 3.5 MB
Tags Source
SHA-256 checksum
How to use checksums
9cc0780aea3f9ba5918739b280dbe21fad6a6151f947801ad9574cb0450906c9
BLAKE2b-256 checksum
How to use checksums
563c596d8c291db976aa812ccc169b31b0b1e53b774c5357ea59aec60ce93709
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 log

Release files / headroom_ai-0.43.1-cp310-abi3-win_amd64.whl

Download URL headroom_ai-0.43.1-cp310-abi3-win_amd64.whl
Size 15.8 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
25c744b5149bf8271317c3c932206aec9e7a7054d9c11d5018e301d2711c63d3
BLAKE2b-256 checksum
How to use checksums
39ad11228dc80b4244cef1d442df05c7be51505d132dacc75a2dfb2e0d424b2e
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 log

Release files / headroom_ai-0.43.1-cp310-abi3-manylinux_2_28_x86_64.whl

Download URL headroom_ai-0.43.1-cp310-abi3-manylinux_2_28_x86_64.whl
Size 15.9 MB
Tags CPython 3.10 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
2e9cd1a9aab42f60b00a9f7c8a85cf82815b51b1989179e5fdd40ddd09915d6e
BLAKE2b-256 checksum
How to use checksums
d5885a473fbf45b7df0d71fe286106f6a9a7cfac704a45d4f62bd0810672ef3e
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 log

Release files / headroom_ai-0.43.1-cp310-abi3-manylinux_2_28_aarch64.whl

Download URL headroom_ai-0.43.1-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
12bf1314ff0b3d6f0860b41578422b77949203a93c14bec9f692c7e5b36a862f
BLAKE2b-256 checksum
How to use checksums
e99b4fae8fd0a0f3403c9c9e0a36fd5cd48bb80729d0e7713afc73cb0a4233c2
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 log

Release files / headroom_ai-0.43.1-cp310-abi3-macosx_11_0_arm64.whl

Download URL headroom_ai-0.43.1-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
91d100d88d960b9c8110487cde6c71da635653d0b02f66acacdd6d58a5ccee65
BLAKE2b-256 checksum
How to use checksums
fe020b426d6b9506437f380047f90d95bbb3e4622f942b10a4b243cea479c8c4
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 log

Release files / headroom_ai-0.43.1-cp310-abi3-macosx_10_12_x86_64.whl

Download URL headroom_ai-0.43.1-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
a35c3bbbe13b8f46abb5e7007d710ce6916c4f028d72fe9e57cba62c7fc9367a
BLAKE2b-256 checksum
How to use checksums
694b04f0a326de5939a1edb435db647ba1ab91c941fe724c337491097e80eed6
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 log

Security for headroom-ai 0.43.1

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.

Select from 6 files

Attestation for headroom_ai-0.43.1.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 log

A 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.

Release history Release notifications | RSS feed

This release

0.43.1 This release

6 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page