# SuperCompress ## Docs - [compare_policies() — Benchmark All Compression Policies](https://docs.supercompress.vercel.app/api-reference/compare-policies.md): Run all five built-in compression policies on identical input and return per-policy CompressResult objects for benchmarking and comparison. - [compress_context() — Compress a Single Context String](https://docs.supercompress.vercel.app/api-reference/compress-context.md): Trim a single context string before each LLM call using learned KV eviction, keeping the most relevant tokens within a token budget. - [compress_detailed() — Compress with Per-Line Annotations](https://docs.supercompress.vercel.app/api-reference/compress-detailed.md): Compress a context string and receive per-line keep/drop annotations explaining why each line was retained or evicted — ideal for debugging and demos. - [compress_for_turn() — Merge and Compress Context Blocks](https://docs.supercompress.vercel.app/api-reference/compress-for-turn.md): Merge multiple context sources — system prompt, tool output, chat history — into one compressed string before each LLM inference turn. - [POST /v1/compress — Authenticated Compression Endpoint](https://docs.supercompress.vercel.app/api-reference/http-compress.md): Send context and a user query to POST /v1/compress with an sc_live_ API key. Returns compressed text, token counts, and KV-cache savings metrics. - [SuperCompress API Key Management and Usage Endpoints](https://docs.supercompress.vercel.app/api-reference/http-keys.md): Create, rename, revoke, and inspect per-key usage for SuperCompress API keys. All endpoints require a Firebase ID token in the Authorization header. - [SuperCompress HTTP API Overview and Authentication](https://docs.supercompress.vercel.app/api-reference/http-overview.md): REST API overview for SuperCompress: authentication schemes, endpoint table, API key lifecycle, and base URL for local and production deployments. - [SuperCompress Python Types — Dataclasses and Policies](https://docs.supercompress.vercel.app/api-reference/types.md): Reference for all public types exported by the supercompress package: CompressResult, LineAnnotation, SustainabilityEstimate, and EvictionPolicy. - [SuperCompress Benchmark Results, Metrics, and Methodology](https://docs.supercompress.vercel.app/concepts/benchmarks.md): Benchmark results, metric definitions, and step-by-step instructions for reproducing or extending SuperCompress's policy comparisons on your own data. - [KV Cache Eviction Policies in SuperCompress Explained](https://docs.supercompress.vercel.app/concepts/eviction-policies.md): SuperCompress eviction policies: FIFO, LRU, Truncation, H2O, SnapKV, Summarization, AttentionHeuristic, LearnedPolicy, and Oracle — with code examples. - [How SuperCompress Compresses LLM Context: Pipeline Guide](https://docs.supercompress.vercel.app/concepts/how-it-works.md): A technical walkthrough of SuperCompress's learned KV eviction pipeline — from tokenization and feature extraction to budget-constrained token selection. - [Contributing to the SuperCompress Open-Source Library](https://docs.supercompress.vercel.app/development/contributing.md): Set up a local dev environment, run the 52-test suite, lint with Ruff, and learn how the codebase is organised before sending a PR. - [Run the SuperCompress Local FastAPI Development Server](https://docs.supercompress.vercel.app/development/local-server.md): Spin up a local FastAPI server to test the SuperCompress browser demo, playground, /v1/compress, and /dashboard without a Vercel deployment. - [Training and Exporting the SuperCompress Checkpoint](https://docs.supercompress.vercel.app/development/training.md): Re-train the ~5K-param EvictionPolicyNetwork, export its weights to JSON for the browser demo, and regenerate benchmarks and charts. - [API Dashboard: Manage Keys, Auth, and Usage Tracking](https://docs.supercompress.vercel.app/guides/api-dashboard.md): Create and revoke SuperCompress API keys, monitor per-key token usage, and authenticate requests against the hosted compress endpoint. - [Environmental Impact: Tokens Saved to CO₂ Avoided](https://docs.supercompress.vercel.app/guides/environment.md): How SuperCompress translates tokens saved into GPU-seconds avoided, watt-hours, and estimated CO₂ — and the assumptions behind the numbers. - [Integrating SuperCompress with OpenAI, LangChain, and More](https://docs.supercompress.vercel.app/guides/integrations.md): Wire SuperCompress into any Python backend, chat API, or agent framework to shrink LLM context before it reaches the GPU and cuts your token bill. - [How to Install SuperCompress in Your Python Project](https://docs.supercompress.vercel.app/installation.md): Install SuperCompress from GitHub with pip — requires Python 3.10+ and PyTorch. Optional extras add dev tooling, an HTTP server, and Firebase storage. - [SuperCompress: Learned Context Compression for LLMs](https://docs.supercompress.vercel.app/introduction.md): SuperCompress is a Python library that trims long LLM prompts with a learned eviction policy — preserving answer quality while cutting KV costs by ~65%. - [SuperCompress Quickstart: Compress Your First LLM Context](https://docs.supercompress.vercel.app/quickstart.md): Install SuperCompress and run your first context compression in minutes — one function call, no API key, runs entirely on CPU before inference.