Two ways to compress prompts with SuperCompress: call the hosted API (zero setup) or install the local library (runs on CPU, no GPU needed).
The fastest way to use SuperCompress in production. Get an API key, call the endpoint, done. No servers, no containers, no config.
Sign in at supercompress.dev/dashboard with Google or email and create an API key. Free tier includes 100K tokens/month.
# Quick one-liner (form-encoded)
curl -d "context=Your long context...&query=What do you want to know?" \
https://supercompress.dev/compress \
-H "X-API-Key: sc_live_YOUR_KEY"
# Or as JSON (standard)
curl -X POST https://supercompress.dev/api/v1/compress \
-H "X-API-Key: sc_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"context":"Your long context here…","query":"What do you want to know?"}'
# Or GET with query params
curl "https://supercompress.dev/compress?context=...&query=...&api_key=sc_live_YOUR_KEY"
from supercompress.client import SuperCompress
sc = SuperCompress() # reads SUPERCOMPRESS_API_KEY
out = sc.compress(context, question)
print(out.compressed_text)
Set your key as an environment variable:
export SUPERCOMPRESS_API_KEY=sc_live_YOUR_KEY
Run SuperCompress entirely on-device. The library bundles the trained policy (~5K parameters, ~200KB) — no model downloads, no GPU, no external dependencies.
pip install supercompress
from supercompress import compress_context
result = compress_context(
text="Your long context…",
question="What does fetch return?",
)
print(result.compressed_text)
print(f"Saved {result.kv_savings_pct:.1f}% tokens")
Since the library is just pip install supercompress, you can run it on any Python 3.10+ environment — your own server, a container, or a serverless function. No special setup required.
# Works anywhere Python runs
pip install supercompress
# Then in your app code
from supercompress import compress_context
Compression also runs in-browser. The playground at supercompress.dev/playground runs the same policy client-side — no API key needed.
| Hosted API | Local library | |
|---|---|---|
| Setup | Get a key, call the endpoint | pip install supercompress |
| Latency overhead | ~5ms network + processing | ~60ms in-process |
| External deps | None (HTTP client only) | Python 3.10+ |
| Rate limits | Plan-based (free: 100K tok/mo) | Unlimited (your hardware) |
| Data privacy | Context sent to API | Stays on your machine |
| Best for | Quick integration, low traffic, prototyping | High volume, latency-sensitive, air-gapped |