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

Built distributions (wheels)

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

Total release size: 82.8 MB

Release files / headroom_ai-0.45.0.tar.gz

Download URL headroom_ai-0.45.0.tar.gz
Size 3.6 MB
Tags Source
SHA-256 checksum
How to use checksums
98702fcc5dae57592d71166aed035b2269e1875863febfca8a2a1fae8bae8e9d
BLAKE2b-256 checksum
How to use checksums
3207e9412179a76a5db08aee1160f4bfce027a41c978527723c6ca14804add44
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 22, 2026.

Transparency log

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

Download URL headroom_ai-0.45.0-cp310-abi3-win_amd64.whl
Size 15.9 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
9ddcf12e6a70c73525783a7db31b7261a612215e47dcedec2e94d72260aa2648
BLAKE2b-256 checksum
How to use checksums
46c17f37945c519f6d6663f9e93f490416473f31fb089f04a78b3619548b009d
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 22, 2026.

Transparency log

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

Download URL headroom_ai-0.45.0-cp310-abi3-manylinux_2_28_x86_64.whl
Size 16.0 MB
Tags CPython 3.10 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
75c386fb9d9124ea9259a61567ffa46128759f2695691459c6e7d751f9d4c2ca
BLAKE2b-256 checksum
How to use checksums
26bcaee4580f537985e7b9fa03b5ef2300f9e03828455c457e660911c25e2d6e
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 22, 2026.

Transparency log

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

Download URL headroom_ai-0.45.0-cp310-abi3-manylinux_2_28_aarch64.whl
Size 15.8 MB
Tags CPython 3.10 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
61bf883957bcd81d3f0ca08f2e0d1af6828fd710ec7dad2a07efe7998b7eb17b
BLAKE2b-256 checksum
How to use checksums
158b8ee31bb6164670f91734b6580422bf2fb5e50517df9494c383afa6a3e459
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 22, 2026.

Transparency log

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

Download URL headroom_ai-0.45.0-cp310-abi3-macosx_11_0_arm64.whl
Size 15.8 MB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
3b7f9ee266039ab5a8b10c5da5868f9b640f1f949d34005dc26362be526a5165
BLAKE2b-256 checksum
How to use checksums
f5381530981783c165d4350a5aee0556662ea6459d8edebbc64466acb26f7861
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 22, 2026.

Transparency log

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

Download URL headroom_ai-0.45.0-cp310-abi3-macosx_10_12_x86_64.whl
Size 15.8 MB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
8a7d039f3f99664b9f8518e1dcb966363d67c75e33a8f28e08c8f2ebc50f2f19
BLAKE2b-256 checksum
How to use checksums
308147813dbd1591c3fc72dd430a293adbc1c913b198849b27eba2bb361d94fe
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 22, 2026.

Transparency log

Security for headroom-ai 0.45.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.45.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 22, 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.45.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