DEV Community

Ranker
Ranker

Posted on

I built Token Diet: a free, open-source prompt token counter to cut LLM API costs

Full disclosure: I work on Ranker, and Token Diet is our tool. Sharing it here because it is free, open source, and might genuinely save you money.

The problem

Every token you send to an LLM costs money and eats into the context window. Bloated prompts quietly burn budget, especially anything you run thousands of times a day.

What Token Diet does

Token Diet is a free prompt token counter and optimizer:

  • Paste a prompt and instantly see its token count (OpenAI, Claude, and Gemini estimates).
  • Trim the filler and compare the before and after side by side.
  • Estimate the monthly savings for your chosen model and call volume.

It runs entirely client side in your browser. No login, and nothing leaves the page.

Open source

The code is MIT licensed and on GitHub: https://github.com/rankerZA/token-diet

There is also an embeddable widget if you want to drop the counter into your own site.

Try it

Live tool: https://ranker.co.za/token-diet

Feedback and issues welcome on the repo. If it saves you a few dollars on your API bill, that is the whole point.

Top comments (0)