You're building something with the OpenAI or Anthropic API.
It's working well. Then you check your usage dashboard and
the number is... not what you expected.
This happens to almost everyone who builds with AI APIs for
the first time. Not because the pricing is hidden - it's
published clearly - but because tokens are not an intuitive
unit of measurement, and the costs compound in ways that
aren't obvious until you're already past them.
Tokens aren't words. They aren't characters. They're chunks
of text a model's tokenizer splits your input into, and the
exact split depends on the model.
Rough rules of thumb:
The same sentence can be a different number of tokens
depending on which model you're using. This is normal and
expected.
Most people focus on input cost (your prompt) and forget
about output cost (the completion). This is a mistake because:
Most AI token counters claim to give you an exact count for
any model. Most are lying, or at best, guessing.
Exact token counts are only possible when you have access to
the model's actual tokenizer. Today that means:
A tool that claims to give you an exact Claude token count
is giving you a confident approximation. That's fine as long
as it's honest about it. Most aren't.
Three things worth knowing before you send:
Show how each of these plays out differently across GPT-4o,
Claude Sonnet 4, and Gemini 2.5 Flash using the same prompt.
"I built a free token counter that handles all three major
providers, is upfront about which counts are exact vs.
estimated, and lets you add custom pricing if the built-in
table is out of date. No signup, runs entirely in your browser."
| Model | Context Window | Input (per 1M) | Output (per 1M) |
|---|---|---|---|
| GPT-4o | 128K tokens | $2.50 | $10.00 | | GPT-4o mini | 128K tokens | $0.15 | $0.60 | | Claude Opus 4 | 200K tokens | $15.00 | $75.00 | | Claude Sonnet 4 | 200K tokens | $3.00 | $15.00 | | Gemini 2.5 Pro | 1M tokens | $1.25 | $10.00 | | Gemini 2.5 Flash | 1M tokens | $0.075 | $0.30 |
Prices change. Check the calculator for the most current
verified rates.
Knowing your token count before you send doesn't just save
money on individual calls. It changes how you think about
prompt design - you start making deliberate tradeoffs between
context richness and cost, which makes you a better AI
application builder.