← Free AI tools

Token Counter & Cost Estimator

Paste any text — see token count and what it actually costs across every major OpenAI, Google Gemini, and Anthropic model. Built for engineers who care about the bill, not just the count. Pricing updated April 2026.

Try a sample:
0 tokens·0 chars·0 words·0 lines

Cost at 0 tokens — across all models(paste text above to see costs)

ModelInput $/1MOutput $/1MCost as input
OpenAIGPT-5.4Popular
$2.50$15.00
OpenAIGPT-5.4 mini
$0.75$4.50
OpenAIGPT-5.4 nano
$0.20$1.25
OpenAIGPT-4.1
$2.00$8.00
OpenAIGPT-4.1 mini
$0.40$1.60
OpenAIGPT-4o
$2.50$10.00
OpenAIGPT-4o mini
$0.15$0.60
OpenAIo3
$2.00$8.00
OpenAIo4-mini
$1.10$4.40
GoogleGemini 3.1 ProPopular
$2.00$12.00
GoogleGemini 2.5 Pro
$1.25$10.00
GoogleGemini 2.5 Flash
$0.30$2.50
GoogleGemini 2.0 Flash
$0.10$0.40
AnthropicClaude Opus 4.6Popular
$5.00$25.00
AnthropicClaude Sonnet 4.6
$3.00$15.00
AnthropicClaude Haiku 4.5
$1.00$5.00
AnthropicClaude Opus 4.1
$15.00$75.00
AnthropicClaude Sonnet 4
$3.00$15.00
AnthropicClaude Haiku 3
$0.25$1.25

“Cost as input” is what you pay to send this text as a prompt. Output tokens (the model's reply) are billed separately at the Output $/1M rate.

That's one prompt. Your product runs millions.

The hard part isn't counting tokens for one prompt — it's knowing which features and which customers are generating the most of them across an entire product. PerUnit attributes token usage to the customer and feature behind every API call, across OpenAI, Anthropic, and Google.

Get early access to PerUnit

Frequently asked questions

What is a token, really?
A chunk of text — roughly 4 characters or 0.75 words in English. The word "hamburger" is 3 tokens. A 1,000-word document is around 1,300 tokens. Both your prompt and the model's reply consume tokens, and they're billed separately at different rates (output usually 3–6× input).
Do different models count tokens differently?
Yes. OpenAI uses the tiktoken BPE tokenizer; Anthropic's Claude uses a different one; Google's Gemini uses its own. The same text can differ by 5–15% between providers. This counter uses the 4-characters-per-token approximation — close enough for cost estimation across all three, but not for hard limits.
What's the max context length on each model?
GPT-4o and GPT-4o mini: 128K. GPT-4.1 and GPT-4.1 mini: ~1M. Claude Sonnet/Opus/Haiku 4.x: 200K. Gemini 2.5 Pro/Flash: 1M+ (some tiers up to 2M). Pricing per token doesn't change the limit — Claude is more expensive per token but tops out at a smaller context than Gemini.
Why are output tokens priced higher than input?
Generation is more expensive than reading. Computing each output token requires a forward pass through the model conditioned on everything before it; input tokens just get encoded once. Across all three providers output sits at roughly 3–5× the input rate. If your feature generates long responses, output will dominate the bill — easy to miss when you're reasoning about prompt length.

Get a monthly email when AI model pricing changes

One email a month. New model launches, price cuts, deprecations across OpenAI, Anthropic, and Google. No spam, unsubscribe any time.