Compress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.
Headroom is a token optimization library and proxy for large language model applications that compresses tool outputs, logs, files, and retrieval-augmented generation chunks before they reach the LLM, reducing token consumption by 20% for coding agents and 60–95% for JSON while maintaining answer quality. Built in Python and TypeScript, it provides multiple deployment patterns including a library, HTTP proxy, and Model Context Protocol server, with integrations for LangChain, OpenAI, Anthropic Claude, AWS Bedrock, and other LLM platforms. The project includes a Rust-based compression core (`headroom-core`) using trait-based detectors for content classification, a comprehensive evaluation framework benchmarked against standard datasets like GSM8K and SQuAD v2, and deployment templates for macOS LaunchAgent integration.