Code, quoted strings, URLs and template variables are never touched — by construction, not by luck. Every compression comes with a checklist showing exactly which instructions survived. Works with ChatGPT, Claude, Gemini, and any LLM.
Three compression modes depending on your needs
Rule-based compression. Removes filler words, redundant phrases, and verbose patterns instantly — no API key needed.
Your model rewrites the prompt, a second model audits the result against every constraint, and lost ones are repaired automatically. Bring your own key.
A small on-device model (TinyBERT, LLMLingua-2) compresses entirely in your browser — no API key, nothing leaves your machine. Its output always goes through the same protected regions and Constraint Ledger — see the real numbers on why that matters.
See exact token counts before and after, and what each API call costs — including the compression call itself, priced before you run it.
Your prompts never touch our servers. API keys are used only in your current browser session and never sent to our servers.
No invented percentages. Generated by npm run bench against 40 real prompts in bench/corpus/, re-run before every release.
Generated by npm run bench on 2026-09-05. Tokens counted with the real o200k tokenizer (js-tiktoken) — never estimated. The ledger is enforced at every level here (the product default only enforces it at Aggressive) so blocked changes are visible at all three.
bench/corpus/phase0 + bench/corpus/phase2 — regression fixtures written to be already careful. A near-zero reduction here is the expected result: nothing gets invented to cut.
| Level | Avg. token reduction | Aggregate token reduction | Critical constraints preserved | Changes blocked by the ledger |
|---|---|---|---|---|
| Light | 0.0% | 0.0% (4,523 → 4,523) | 100.0% (434/434) | 0 |
| Balanced | 1.4% | 0.7% (4,523 → 4,491) | 100.0% (434/434) | 0 |
| Aggressive | 1.6% | 0.9% (4,523 → 4,484) | 100.0% (434/434) | 0 |
bench/corpus/phase6 — unengineered requests padded with the framing and hedges people type without thinking about it.
| Level | Avg. token reduction | Aggregate token reduction | Critical constraints preserved | Changes blocked by the ledger |
|---|---|---|---|---|
| Light | 0.0% | 0.0% (2,426 → 2,426) | 100.0% (60/60) | 0 |
| Balanced | 9.0% | 8.9% (2,426 → 2,209) | 100.0% (60/60) | 0 |
| Aggressive | 12.3% | 12.2% (2,426 → 2,129) | 100.0% (60/60) | 0 |
AI mode not measured for: Anthropic, OpenAI, Google Gemini. No percentage is published for a provider that was not actually called.
Local ML mode (TinyBERT via LLMLingua-2, real on-device inference), Balanced level, 3-prompt sample from the everyday corpus:
| Critical constraints preserved | Protected-region violations |
|---|---|
| 25.0% (5/20) | 0/8 |
Honesty as a feature, not a disclaimer. Every point below is a real, current limit of this exact codebase.
Code fences, inline code, quoted strings, URLs, template variables and few-shot examples are structurally excluded from every rule — not "usually skipped," never even offered to a rule as a candidate.
"never", "always", "must", "only", "step by step" and anything like them are never removed, at any level. packages/core/src/rules/discarded.ts lists every rule from the old app that did this, and why it was cut.
The ledger verifies that specific constraints (prohibitions, formats, numbers, quoted literals, variables) survive — not that the compressed prompt reads identically to a human. Review Aggressive output before shipping it.
There is no backend. Fast mode compresses in your browser tab and nothing leaves it. AI mode goes straight from your browser to the provider you pick, with your own key — never through a PromptTrim server, because none exists.
The constraint ledger's prohibition/requirement/format detection is English-only today. A prompt in Spanish or another language still gets the protected-region safety net, but not that checklist — this is tracked, not hidden.
Batch mode (several prompts separated by ---) is Fast mode only. Firing an unbounded number of paid API calls from one click is not a default anyone should get by accident.
LLMLingua-2 drops tokens by statistical importance, not meaning — our own benchmark above measured it keeping only 25% of critical constraints unaided. It's marked experimental for exactly that reason: the protected regions and Constraint Ledger it always runs through are what make it usable, not a claim that the model itself is reliable.
Compressing a prompt saves 15–30% once. Caching its static prefix saves about 90% on every repeated call. PromptTrim tells you which one is worth doing.
Rewriting removes the filler and stops. A shorter prompt is cheaper on every call, but the ceiling is whatever filler your prompt had — typically 15–30%, and none of it on the code, JSON or examples PromptTrim refuses to touch.
A cache hit costs 10% of the input price on Anthropic, OpenAI and Gemini alike. Writing the cache costs 1.25× the input price for a 5-minute lifetime, or 2× for an hour — so it pays for itself on the 2nd call, or the 3rd for the 1-hour cache.
A cache only matches an identical prefix. Today’s date, a request id or a template variable at the top of a system prompt changes those bytes on every call: no cache hit, no error, full price. PromptTrim finds them and offers to move them below the breakpoint.
Nothing shorter than 512 tokens caches on Claude Opus 5, 1,024 on Sonnet 5, 4,096 on Haiku 4.5, 1,024 on GPT-5.6 and later (2,048 before it) and 2,048 on Gemini 2.5. Under those, caching does nothing at all — quietly.
Prices and caching rules verified on 2026-09-03 against the official documentation of Anthropic, OpenAI and Google.
sessionStorage until you close the tab. We never see your prompts or keys.npm run bench. An already-careful system prompt barely shrinks in Fast Mode, and that's correct: there's nothing safe left to cut. A verbose, unedited prompt full of "please", "in order to" and framing typically compresses noticeably more. AI Mode isn't benchmarked with real providers yet (see the note above the tables); no percentage is published for it until it is.