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

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.44.0
File Size Uploaded Provenance Actions
headroom_ai-0.44.0.tar.gz 3.6 MB With provenance Details for headroom_ai-0.44.0.tar.gz

Built distributions (wheels)

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

Total release size: 82.5 MB

Release files / headroom_ai-0.44.0.tar.gz

Download URL headroom_ai-0.44.0.tar.gz
Size 3.6 MB
Tags Source
SHA-256 checksum
How to use checksums
4fa74895947905acc54564c1a24f67adefc71c2e4d1b599d723db46177f02e42
BLAKE2b-256 checksum
How to use checksums
0e4e7d86706ccca125d01ccf2ca903ebeca9f131d8b9149ebaa9e3f3a90acc0e
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 10, 2026.

Transparency log

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

Download URL headroom_ai-0.44.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
a7853a0d81f1e3f6d4b00de6114791732ff458c09b8af05a06c4ae2d8c492d68
BLAKE2b-256 checksum
How to use checksums
67053e61efd4aff135c053ac2d3f5fa51f1ab458758d03229656194aa7ef409e
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 10, 2026.

Transparency log

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

Download URL headroom_ai-0.44.0-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
3b5c7fd289e7d227dcd9b896615541ea9d3d37388bd97b3257fc8769c4b7ef70
BLAKE2b-256 checksum
How to use checksums
8f6339c8f6bd317714bc6a68775be5da5e15bca9e91d5f95e259bc00e6de6f7f
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 10, 2026.

Transparency log

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

Download URL headroom_ai-0.44.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
58f2e6ac736fe882f83cae0a3bffad7ce574d12587eb999d6501bffd053a75cd
BLAKE2b-256 checksum
How to use checksums
5ed92ff01892de67c0824d024cdb0152e371bb8cd5ced8ed6c2a66ad5c5f13a4
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 10, 2026.

Transparency log

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

Download URL headroom_ai-0.44.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
9b084f4cd9918af2d0970450ff3e990fffc29a8220dc5e24fa0f33a4dd0359cc
BLAKE2b-256 checksum
How to use checksums
42b71ab4da6f7a091fd1a102b5194828f9a588b6b4f11b522f38b86b125770a3
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 10, 2026.

Transparency log

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

Download URL headroom_ai-0.44.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
2ab9d0c7ced1b94220597b2a48996693ebc0a61dd1ce38749709ae299b3f51da
BLAKE2b-256 checksum
How to use checksums
3758cb856a12253468d2c70ea6223531a34558f57f294196f75172343833f164
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 10, 2026.

Transparency log

Security for headroom-ai 0.44.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.

Select from 6 files

Attestation for headroom_ai-0.44.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 10, 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.44.0 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