Skip to content
tokensaverfree & open source · runs offline

Most AI bills have the same leak: the prompt.

A system prompt is sent with every request, so every wasted token is paid for on every call. tokensaver shows what a prompt costs on 20 OpenAI, Anthropic and Google models, and exactly what to cut.

pip install prompt-tokensaver

Windows · macOS · Linux · Python 3.10+ · Live · free and open source · v0.1.4

tokensaver example: a support prompt cut from 834 to 665 tokens (-20%) by removing filler, minifying JSON and merging a repeated rule.

What it catches

Real waste, priced in tokens and dollars

Polite filler

I would like you to please read the message…

Read the message…

−6tokens

Pretty-printed JSON

{↵····"answer": "string",↵····"category": …

{"answer":"string","category":…}· data verified unchanged

−61tokens

Same rule, pasted twice

Please note that you must only answer…

said once· flagged for your review

−41tokens

834→665tokens−20%

$422 savedper 1M calls · GPT-4o · example support prompt

Measured on a sample prompt. Savings depend on your prompt and are not guaranteed.

How it works

Three commands

  1. 1
    tokensaver count prompt.txt

    Count the tokens in a prompt. Exact for OpenAI models; Claude and Gemini counts are clearly labelled estimates.

  2. 2
    tokensaver compare prompt.txt

    Price the same prompt on 20 models, cheapest first, per call and per million calls.

  3. 3
    tokensaver optimize prompt.txt

    Get concrete edits, each priced in tokens and dollars, with a before/after diff. Your original file is never overwritten.

Six rules

Safe by default

Applied automatically

  • JSON minification (the data is checked to be identical)
  • Whitespace cleanup

Applied only when you approve

  • Duplicate lines and paragraphs
  • Repeated instructions
  • Polite filler phrases

Flagged only

  • Long few-shot examples

The filler-phrase, repeated-instruction and long-example rules are English-only for now.

Fully offline

No API key, no account, no server. Prompts never leave your machine.

No AI inside

Every rule is plain, tested code, so the same prompt always gets the same suggestions.

Any language

Counting, JSON, whitespace and duplicate checks are tested on 55 languages, including Persian, Arabic, Chinese and Japanese.

Free and open source

MIT licensed. 216 automated tests on Windows, macOS and Linux.

Find the leak in your prompt in under a minute

pip install prompt-tokensaver

Built and maintained by Axieo Technologies Inc., Ontario, Canada.