Headroom

Headroom

★ 4.6 🔖 12000 saves 💰 Free GitHub

Headroom is an open-source context optimization layer that compresses everything an AI agent reads — tool outputs, logs, files, database results and RAG chunks — before it reaches the language model. The project has collected more than 76,000 stars on GitHub and is under very active development, with its latest updates in 2026. Its promise: the same answers with a fraction of the tokens, so agents respond faster and cost less.

Overview

Headroom sits between your application and the LLM provider as a transparent proxy, a Python or TypeScript library, or an MCP server. It detects the content type automatically and routes it to a specialized compressor: JSON arrays are analyzed statistically so errors and anomalies survive, logs keep their failures and drop passing noise, and code is compressed with AST awareness. A Compress-Cache-Retrieve store keeps the originals, giving the model a tool to fetch full details when compression went too far — aggressive, but reversible. Newer releases add persistent hierarchical memory and failure learning, which reads past sessions, finds failed tool calls and writes the lessons back into project instructions.

Key Features

  • Typically 20% fewer tokens for coding agents, 60–95% fewer for JSON
  • SmartCrusher statistical compression preserves errors and outliers
  • Lossless CCR mode stores originals the model can retrieve on demand
  • Works as proxy, Python/TypeScript library, or MCP server
  • Integrations for LangChain, Agno, Strands, LiteLLM and Vercel AI SDK
  • Cache optimization, persistent memory and Prometheus metrics built in

💳 Pricing

Headroom is free and open source under the Apache-2.0 license. You can self-host the proxy or embed the libraries in your own stack at no cost; your only spend remains your existing LLM API bill — which Headroom is designed to shrink.

Who Is It For

Headroom is for developers running agentic applications in production — coding assistants, support agents, research tools — whose context windows are flooded with tool output and whose token bills reflect it.

🚀 Visit Headroom Official Site

🚩 Report an issue