Everything you need to reduce LLM token costs with query-aware context compression. Open source (MIT), runs on CPU, ~5K parameters, no GPU required.
Install, get a key, compress your first prompt โ in under 5 minutes.
Python API, HTTP endpoints, response fields, error codes, and client usage.
Wire SuperCompress into OpenAI, LangChain, Express.js, Vercel AI SDK, and more.
Call the hosted API or pip install locally โ no servers to manage.
How the learned policy works: features, training, inference, and compiler mode.
Methodology for estimating energy and carbon savings from token reduction.
SuperCompress is a query-aware context compiler for LLM inference. It sits between your application and the language model, preprocessing the prompt to remove tokens that aren't relevant to the current user question. This reduces input token counts by ~65% on average, cutting API costs and latency while preserving the evidence the model needs to answer correctly.
Unlike truncation (which blindly drops the tail) or summarization (which rewrites content and risks losing detail), SuperCompress scores every segment of the prompt against the user's actual question and keeps only what matters for that query.
| Metric | Value |
|---|---|
| Policy size | ~5,200 parameters |
| Latency | ~60ms per compression (CPU) |
| Token savings (compiler mode) | 82.5% avg on bundled presets |
| Oracle recall | 100% โ every answer-critical line preserved |
| Model download | None โ weights included in pip package |
| GPU required | No โ runs on CPU before inference |
| License | MIT โ free for commercial use |
SuperCompress is designed for production AI features where context grows over time and token costs scale linearly with usage:
In compiler mode (the default), SuperCompress:
The full pipeline takes ~60ms on a single CPU core โ no GPU, no model download, no extra LLM calls.