Billion Context

Billion Context

★ 4.1 🔖 1500 saves 💰 Free GitHub

Billion Context is an open-source context-compression plugin for AI coding agents, with more than 4,800 stars on GitHub. It sits between your coding agent and its model API and keeps a single session alive for days or even a whole month — billions of tokens through one context window — while cutting token use by up to five times.

Overview

Long coding sessions blow up context: every token costs money, and once the window fills up the session degrades or dies. Billion Context runs a proxy that rewrites the agent’s Anthropic or OpenAI API streams and applies model-driven incremental compression. The model itself decides when and what to fold into high-fidelity summaries. Compression is incremental, reversible, and prefix-cache friendly: a healthy session keeps a 95–97% cache hit rate. One npm install covers more than twenty agent clients — Claude Code, Codex, Cursor, Pi, OpenCode, Gemini CLI, Qwen Code, Kimi, and more — via the bili launcher or a native plugin install.

Key Features

  • Month-long single sessions: one session runs for days or weeks, pushing billions of tokens through a single context window.
  • Five times fewer tokens: a 100K window suffices where a far larger, costlier window was needed.
  • Model-driven compression: the model chooses what to compress and when, folding conversation into layered summaries rather than truncating it.
  • Reversible and cache-friendly: summaries are written in small ranges, decompress on demand, and keep the cache prefix intact.
  • Four injected context tools: compress, decompress, search_context, and acp_status let the model manage its own context as a session grows.
  • Works with 20+ agent clients: one proxy covers Claude Code, Codex, Cursor, Pi, OpenCode, Gemini CLI, Qwen Code, Kimi, and many more.
  • Independently benchmarked: first on ContextBench, +16.6% over the best RAG approach on LongMemEval-S, and 100% survival on a 1.48M-token MemoryAgentBench run.

💳 Pricing

Billion Context is completely free and open source under the MIT license, with a single attribution requirement. You install it with npm, run it locally, and there is no paid tier or account.

Who Is It For

Billion Context is for developers who run long AI coding sessions and are tired of losing context — or paying for it. It suits anyone working on large codebases with Claude Code, Codex, or Cursor, teams keeping marathon sessions alive across days, and builders who want smaller windows to do bigger jobs.

🚀 Visit Billion Context Official Site

🚩 Report an issue