Skip to content

Automation & Cost

Prompt Compressor & Token Reducer (Free, Runs Locally)

Cut prompt tokens with deterministic rules, then price the difference: original vs compressed tokens, saved per call, and monthly API savings at your run volume.

Reviewed$0 · No login

TL;DR

Sogoh compresses prompts with deterministic rules, not another model call. The default 329-token system prompt drops to 279 tokens (−15.2%) in balanced mode; at 5,000 runs a day on a $2/M input model that is $15.00 a month. Code blocks, quoted strings, URLs and numbers are protected.

Output · prompt & context compressor

中文

100% in-browser. Nothing uploaded.

1,416 characters

Code blocks, quoted strings, URLs, numbers and template variables are protected — every mode leaves them untouched.

Compression mode

Also strips pleasantries and filler, compresses whole-input JSON/XML whitespace, dedupes repeated long lines.

Start balanced. Use aggressive only for high-volume internal calls where you can read the output.

Compressed prompt

act as a careful data-extraction assistant for our accounts-receivable team. read the customer email below and return one JSON object with the following fields: order_id, invoice_total, currency, due_date and line_items.

follow these rules carefully, because a wrong number creates a credit note and a manual review:
- Copy the order_id exactly as it appears in the email. Do not change the letter case, do not add spaces, and do not normalize the hyphen.
- If the invoice total is missing, return null instead of guessing. It is much better to return null than to invent a number.
- Keep the currency as a three-letter ISO code, even if the email writes euros or dollars in words.
- Format the due date as YYYY-MM-DD, and never use a local date format.
- Return line_items as an array. If there are no line items, return an empty array.

Here is the email:
---
Hi team, for the quick delivery. Our order A-10482 arrived on 3 May, but the invoice shows 1,240.50 EUR while the quote was 1,180.00 EUR. We also ordered 4 replacement filters at 12.00 EUR each. send a corrected invoice by 2026-06-15.
---

Return only the JSON object, with no commentary and no markdown fences. for your help.

Same instructions, fewer tokens. Edit nothing here — copy it back into your workflow.

Token audit

Original
329
Compressed
279
Tokens saved
50
Saved
15.2%
227 characters removed

Counted with gpt-tokenizer (o200k_base): exact for OpenAI o200k models, within a few percent for Claude, Gemini and DeepSeek. No 4-characters-per-token guess.

What that does to the bill

Monthly API savings

$15.00· per year$180.00

15.2% fewer input tokens
Saved per call
$0.0001
Tokens saved / month
7.5M
runs / day

A 30-day billing month. 5,000 runs a day is 150,000 calls a month — a busy extraction or classification workflow.

Compare model prices →

List prices per 1M input tokens from the same snapshot as the token cost calculator. Taxes, batch discounts and cache discounts are excluded.

LLM token cost calculator →Workflow automation guides →

The formula, in full

Full method & sources →
Saved tokens
saved = original − compressed
Saved share
savedPct = saved ÷ original × 100
Cost per call
saved ÷ 1,000,000 × input price
Monthly
per call × runs/day × 30
Annual
monthly × 12
Token count
gpt-tokenizer(o200k_base, text)

Compression is deterministic string rewriting — no model call, no sampling, no hidden prompt. Token counts come from the same BPE vocabulary as OpenAI’s o200k models; other providers tokenize differently, so treat their numbers as an estimate. Model-based compressors such as LLMLingua prune tokens with a second model and can cut more, at the cost of reproducibility and a quality check; this page stays rule-based so the same input always gives the same output. The “4 characters per token” rule of thumb is wrong for code, JSON and Chinese, which is why this page counts instead of guessing.

Aggressive mode can drop a word the instruction needed. Read the result, or stay on balanced for customer-facing prompts.

gpt-tokenizer (MIT)OpenAI tokenizerLLMLingua (arXiv)Anthropic — context engineeringOpenRouter Models API — model pricesFormula & price APIPrices retrieved November 30, 2026. Verify against your provider invoice before budgeting.

100% in-browser. Nothing uploaded.

NotesResults come from public data and the formulas or rules shown on this page: calculators compare scale and direction, while parsers and path builders follow each tool’s documented syntax, which can change between versions. Neither is financial, tax, legal or medical advice; check the official source or a qualified professional before acting.

Method & sourcesFull disclaimer

Share

Email updates

Told when this page’s prices change

The formula stays the same. Prices do not. When a plan changes, one short email with the difference.

Submitting means you agree to receive occasional Sogoh updates and have read the privacy policy. Unsubscribe any time.

How the numbers are derived

  1. 01

    Paste the prompt you actually send

    Long system prompts, JSON schemas and retrieved context are where the tokens hide. Code fences, inline code, quoted strings, URLs, emails, template variables and numbers are masked before any rule runs, so no mode can rewrite them.

  2. 02

    Pick the least destructive mode that works

    Safe only normalises whitespace, Markdown emphasis and link syntax. Balanced also removes pleasantries and filler, minifies JSON/XML only when the whole pasted text is one document, and dedupes repeated long lines. Aggressive drops articles, pronouns, auxiliaries and sentence punctuation, so it has to be read before shipping.

  3. 03

    Count tokens with the real vocabulary

    Tokens are counted with gpt-tokenizer (o200k_base), the same BPE vocabulary as OpenAI’s o200k models. Other providers tokenize differently, so their numbers are an estimate within a few percent — far closer than the “4 characters per token” rule, which fails badly on JSON and Chinese.

  4. 04

    Turn saved tokens into a monthly bill

    Cost per call = saved tokens ÷ 1,000,000 × input price. Monthly savings = cost per call × runs per day × 30. Only the input side is counted: compression shortens the prompt, not the answer, so output tokens and cache discounts stay out of the number.

FAQ

Does compressing a prompt make the model dumber?

Safe mode cannot remove a word, so answer quality is unchanged. Balanced only removes politeness, filler and duplicated lines, which carry no instruction. Aggressive removes articles, pronouns and auxiliaries; meaning usually survives, but a sentence like “send it to the client, not the vendor” is exactly where a deleted word matters. Read the diff before using aggressive on customer-facing prompts.

Is my prompt uploaded anywhere?

No. Compression and token counting run in the page with bundled JavaScript; there is no request that carries your text. The page is static, has no login and no server-side compression endpoint, so the only copy of the prompt is the one in your browser tab. Clearing the field removes it.

Which tokenizer does the counter use, and how exact is it?

It uses gpt-tokenizer with the o200k_base vocabulary, loaded lazily in the browser. Counts are exact for OpenAI’s o200k models. Claude, Gemini and DeepSeek use different vocabularies, so their real counts differ by a few percent; the saved percentage and the direction of the bill are still reliable.

Why not just divide characters by four?

Because the ratio is not stable. English prose sits near four characters per token, but JSON keys, base64, code, URLs and Chinese are much denser: a Chinese character is often one token or more, not a quarter. The 4:1 shortcut undercounts exactly the inputs that make prompts expensive, so this page loads the real vocabulary instead.

Why is only the input side counted?

Compression changes the prompt, not the completion. Counting hypothetical output savings would inflate the result, and prompt-caching discounts vary by provider and prefix stability, so they are excluded too. The number you see is the conservative, input-only saving at list price.

Can I compress RAG context, Chinese prompts or mixed-language text?

Yes. RAG chunks compress like any prompt, and Chinese plus mixed-language text is handled: pleasantries are removed only at sentence starts, and token counting uses the same BPE vocabulary (a Chinese character often costs one token or more, so the savings are real). For RAG, compress the instruction template rather than the retrieved evidence — deleting a citation can change the answer even when the prompt gets shorter.

← Back to calculators