billion-context
A context-compression proxy and plugin that lets coding agents run very long sessions on small context windows by letting the model compress and restore conversation ranges.
At a Glance
Locally installed context-compression plugin distributed via npm under an MIT license with an added attribution term on user-facing product surfaces; not a plain OSI-approved license, so classified as free rather than open source.
Engagement
Available On
Alternatives
Listed Nov 2026
About billion-context
billion-context is an open-source context-compression proxy and plugin by ranxianglei for long-running coding agent sessions. It sits between an agent and its model API, rewriting Anthropic and OpenAI streams with acp-kernel compression so a single session can run for days while using a smaller context window. It installs through npm as the bili command and supports a long list of clients, including pi, opencode, omp, Claude Code, Codex, Gemini CLI, Kimi, Hermes and others.
What It Is
bili is a local proxy that compresses consumed conversation into layered summaries before requests reach the model provider. The README describes the compression as incremental, reversible and prefix-cache friendly: summaries are written over small message ranges, can be decompressed on demand, and the cache prefix stays intact. The model decides when and what to compress rather than hitting a hard truncation limit.
How the Compression Workflow Works
The proxy injects four context-management tools into the conversation: compress folds a message range into a detailed summary, decompress restores a range when exact details are needed, search_context searches compressed summaries and visible messages by keyword, and acp_status reports context usage and which ranges are still compressible. Growth nudges prompt the model as context expands, and a preflight step acts as a hard backstop when input alone exceeds the window. The client's own stored conversation history is not rewritten; only what is sent to the model is rebuilt from live blocks plus summaries.
Ways to Connect a Client
There are three paths. A native plugin (bili plugin install <client>) makes bili a plugin inside clients such as pi, omp, opencode, dsh, kimi, hermes, zcode and claude. A launcher (bili <client>) starts the proxy and the client together without editing the client's real config, using certificate-based MITM or a /bili/ config rewrite. The universal option is prefixing a client's base URL with http://localhost:8787/bili/. A Dockerfile is included for running the proxy as a service, and the proxy has a web UI, session list, logs, config editor and JSON endpoints.
Observability and Operations
The /acp and /acp-cache commands show session status and a cache-health report with hit-rate attribution; the README says a healthy session sits at 95–97% prefix-cache hit rate. The project documents self-update with staggered rollout, critical-defect advisories, session storage maintenance via bili sessions and bili storage gc, and remote-agent hosting with --host. The README also links a paper and a third-party benchmark write-up, whose figures are the author's own reports. The README labels the project status as early.
Current Status
The latest release listed is v0.1.213, published 2026-11-07. The license is MIT with one additional attribution term requiring user-facing products that use it to credit billion-context with a link.
Community Discussions
Be the first to start a conversation about billion-context
Share your experience with billion-context, ask questions, or help others learn from your insights.
Pricing
Free
Locally installed context-compression plugin distributed via npm under an MIT license with an added attribution term on user-facing product surfaces; not a plain OSI-approved license, so classified as free rather than open source.
- Install via npm: npm install -g billion-context --prefix=~/.local
- MIT License plus Additional Term requiring attribution on product surfaces
- GitHub license metadata shows Other (NOASSERTION)
- Underlying model/inference costs are external
Capabilities
Key Features
- Model-driven incremental compression of conversation ranges into summaries
- Injected compress, decompress, search_context and acp_status tools
- Prefix-cache friendly, reversible compression
- Native plugins for pi, omp, opencode, dsh, kimi, hermes, zcode and claude
- Launcher mode and /bili/ URL-prefix mode for many other clients
- Web UI with sessions, logs, config editor and cache hit-rate report
- /acp and /acp-cache status and cache attribution commands
- Docker deployment
- Self-update with staged rollout and critical-defect advisories
- Session storage maintenance CLI
- Derived child sessions inherit parent compressed context
