billion-context (ranxianglei/billion-context)

gemini-cli
Searching Database…

What is this?billion-context is a context-compression proxy that sits between any coding agent and its model API, rewriting Anthropic/OpenAI streams so a 100K context window is enough and a single session can run for months across billions of tokens.
Is it a plugin inside my coding agent or a separate tool?It's an npm CLI (the bili command) with three postures: a native plugin inside the client, a launcher that brings up the proxy and the client together without touching config files, or a universal /bili/ baseURL prefix.
How do I get it running?Run npm install -g billion-context, then pick one mode: bili plugin install (native plugin), a launcher like bili claude or bili codex, or prefix your client's baseURL with the proxy origin plus /bili/.
Which coding agents does it work with?About twenty clients: pi, omp, opencode, dsh, kimi, hermes, zcode, claude, codex, jcode, gemini, iflow, qwen, antigravity, mcode, aider, copilot, amp and goose, plus a generic fallback for anything else. Native in-client plugins exist for pi, omp, opencode (1.x/2.x), dsh, kimi, hermes and zcode.
Any gotchas before I install it?Native mode and the standalone in-process extensions are mutually exclusive — running both means double compression. Some clients have no native mode at all (jcode, aider, copilot, amp), and codex needs bili started before its session.
Is the code open source?The code ships without a standard open-source license (GitHub lists it as NOASSERTION); only the bundled research paper is explicitly MIT, so check the terms before commercial use.
How does the compression actually work?The proxy injects four context-management tools — compress, decompress, searchcontext and acpstatus — and the model calls them itself as context grows. Compressed ranges stay summarized in history until restored, and searchcontext can find details inside them.
How is this different from my agent's built-in summarizer?Compression is incremental, reversible and prefix-cache friendly: summaries are written in small ranges, can be decompressed on demand, and the cache prefix stays intact instead of being rebuilt.
Does it hold up over really long sessions?A bundled paper reports a 4.5-month, three-host study: 174,327 model calls, 18.76B cumulative input tokens, zero window violations on 204,800-token models, and marathon sessions of 8,584-12,049 calls.
How do I check it's compressing well?Run /acp or /acp-cache: a healthy session keeps a 95-97% prefix-cache hit rate, with compression itself costing at most 2%. Sustained drops usually mean upstream cache TTL expiry or a model switch.
Size
101.5 MB
Stars
9.1K
Age
3mo
Commits · 90 Days