headroom-ai
The Context Optimization Layer for LLM Applications - Cut costs by 50-90%
Decision gist · record as of 2026-08-14
Yes. Actively maintained, well-documented, carries no security vulnerabilities, and offers substantial token savings (60–95% on structured data) with reversible compression and multiple integration modes. The permissive Apache-2.0 license and broad Python version support (3.10–3.14) make it production-ready. Install if you run LLM agents or applications and want to reduce token costs without rewriting code; the proxy mode requires zero changes to existing workflows.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10 or later.
- Some optional extras require a C++ toolchain.
- The CLI is available only via the PyPI package.
License · maintenance · safety
Apache-2.0 (permissive) — Apache-2.0 permissive license allows commercial and private use with minimal restrictions—suitable for production deployment in most contexts.
last release 2026-08-13 (1 days) · last repo commit 2026-08-14 · 66,362 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 741,980 downloads/mo, #5,182 on PyPI
Alternatives
Verify before relying
pip install 'headroom-ai[all]'
from headroom import compress
compressed = compress(messages=[{"role": "user", "content": "..."}])- Whether the 60–95% token savings on JSON and 15–20% on coding agents hold across different LLM providers and workload types beyond the documented examples.
- Whether reversible compression (CCR) retrieval adds latency or complexity in production agent workflows.
- How cross-agent memory deduplication performs at scale across many concurrent agent sessions.
- Performance characteristics of the ContentRouter and specialized compressors under high-volume or real-time constraints.
What it is and what it does
Headroom is a context compression layer that sits between your AI agent or application and the LLM provider. It detects content type (JSON, code, prose) and applies specialized compressors to reduce token count before the prompt reaches the model. The package runs locally, keeping your data on-device, and offers multiple integration modes: inline library, HTTP proxy (zero code changes), CLI agent wrapping, or MCP server for any MCP client.
Beyond input compression, the package also trims model output by steering verbosity and routing thinking effort, reducing the tokens you pay for on expensive output-heavy models. Compressed content is reversible via CCR (cached for on-demand retrieval), and the package includes cross-agent memory for deduplication, plus a learn command that mines failed sessions to improve future agent behavior.
Use it for
- Reduce token costs on long code search results or large log outputs sent to agents by 60–95%.
- Deploy a local proxy in front of an existing agent without changing application code.
- Compress RAG chunks and conversation history in agent pipelines to fit more context in a fixed token budget.
- Share and deduplicate compressed context across multiple AI agents via cross-agent memory.
- Mine failed agent sessions to auto-generate corrections and improve future agent behavior.
- Trim model output verbosity and thinking effort on routine steps to cut output token costs.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
Actively maintained, well-documented, carries no security vulnerabilities, and offers substantial token savings (60–95% on structured data) with reversible compression and multiple integration modes. The permissive Apache-2.0 license and broad Python version support (3.10–3.14) make it production-ready. Install if you run LLM agents or applications and want to reduce token costs without rewriting code; the proxy mode requires zero changes to existing workflows.
Install
headroom-ai on PyPI
Before you install
Medium friction: 10 runtime dependencies including tiktoken, litellm, pydantic, and ast-grep-cli. Actively maintained (last commit 2026-08-14, 66362 stars). Requires Python 3.10+. Wheels available for macOS (x86_64, arm64), Linux (x86_64, aarch64), and Windows.
Requires Python 3.10 or later. Some optional extras require a C++ toolchain. The CLI is available only via the PyPI package.
License in practice
Apache-2.0 permissive license allows commercial and private use with minimal restrictions—suitable for production deployment in most contexts.
Quickstart
pip install 'headroom-ai[all]'
from headroom import compress
compressed = compress(messages=[{"role": "user", "content": "..."}])
Verify before relying
- Whether the 60–95% token savings on JSON and 15–20% on coding agents hold across different LLM providers and workload types beyond the documented examples.
- Whether reversible compression (CCR) retrieval adds latency or complexity in production agent workflows.
- How cross-agent memory deduplication performs at scale across many concurrent agent sessions.
- Performance characteristics of the ContentRouter and specialized compressors under high-volume or real-time constraints.
Package facts
| License | Apache-2.0 permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Medium. Platform-specific wheel |
| Runtime dependencies | 10 packagestiktokenpydanticlitellmclickrichopentelemetry-apiast-grep-clipyyamltomlitomlkit |
| Maintenance | Actively maintained 1 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 741,980 / month, #5,182 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Scientific/Engineering :: Artificial IntelligenceTopic :: Software Development :: Libraries :: Python ModulesTyping :: Typed |
Evidence: headroom_ai-0.35.0-cp310-abi3-macosx_10_12_x86_64.whl; headroom_ai-0.35.0-cp310-abi3-macosx_11_0_arm64.whl; headroom_ai-0.35.0-cp310-abi3-manylinux_2_28_aarch64.whl; headroom_ai-0.35.0-cp310-abi3-manylinux_2_28_x86_64.whl; headroom_ai-0.35.0-cp310-abi3-win_amd64.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “llm token compression”
- headroom-aiCompresses LLM prompts and agent outputs before they reach the model,…
- llmlinguaLLMLingua compresses prompts by identifying and removing…
- toonstoons is a Rust-backed Python parser and serializer for the TOON…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also llmlingua · litellm · llm · litellm-proxy-extras · litellm-enterprise · promptlayer · fast-agent-mcp · deepagents · gepa · tokencost