Free LLM tool

LLM Token Counter & Cost Estimator

Paste any text. We tokenize it with OpenAI's official tokenizer, calibrate for Anthropic and Google, and show per-call cost across 8 frontier models - with caching factored in, in your browser, no upload.

Built by Vladyslav Rybak, Founder, Croni · Last updated Jul 12, 2026

Input tokens
Heuristic (loading…)
74
294 characters
Slider goes to 16k (typical frontier output cap). Type up to 64k for extended-thinking Claude or reasoning model outputs.
Repeated prompts get up to 90% input-cost discount
Cost per call by model
OpenAIAnthropicGoogle
  • Gemini 2.0 Flash
    $0.075/M in · $0.3/M out · ctx 1000k
    $0.00015
    <$0.0001 in + $0.00015 out
  • GPT-4o mini
    $0.15/M in · $0.6/M out · ctx 128k
    $0.00031
    <$0.0001 in + $0.00030 out
  • Claude Haiku 4.5
    $0.8/M in · $4/M out · ctx 200k
    $0.00216
    <$0.0001 in + $0.00210 out
  • Gemini 2.0 Pro
    $1.25/M in · $5/M out · ctx 2000k
    $0.00254
    <$0.0001 in + $0.00245 out
  • GPT-4o
    $2.5/M in · $10/M out · ctx 128k
    $0.00519
    $0.00018 in + $0.00500 out
  • Claude Sonnet 4.5
    $3/M in · $15/M out · ctx 200k
    $0.00811
    $0.00023 in + $0.00788 out
  • GPT-4 (legacy)
    $30/M in · $60/M out · ctx 8k
    $0.0322
    $0.00222 in + $0.0300 out
  • Claude Opus 4
    $15/M in · $75/M out · ctx 200k
    $0.0405
    $0.00117 in + $0.0394 out

Prices verified: 2026-05-19 · Vendor list rates per million tokens · Estimates are not a substitute for vendor billing

About the llm token counter & cost estimator

Token estimation matters when you're building on an LLM API: cost is set by tokens, not characters, and the gap varies by language, code content, and model. A 1,000-character prompt is ~250 tokens of English prose, ~330 tokens of code, ~600 tokens of dense Asian-script text. The same call across GPT-4o, Claude Sonnet and Gemini Flash can have a 100× price spread.

This counter uses OpenAI's official tokenizer (loaded on demand to keep the page light) and calibrates Anthropic and Google models with empirical multipliers based on their public tokenizer behavior. The cost-bar visual lets you compare 8 models at a glance; the caching toggle reflects the up-to-90% discount you get on repeated prompts. Nothing is uploaded - everything runs in your browser.

When the estimate is accurate vs when it isn't

For English prose with GPT models, the count is exact (we use the real tokenizer). For Claude, we apply a ~+5% multiplier based on empirical observation against Anthropic's tokenizer; for Gemini, a ~-2% multiplier. Code, JSON and CJK can vary further. For exact production accounting, use the vendor's official tokenizer (e.g. anthropic-tokenizer for Claude); this tool is for fast 'roughly how much will this cost?' decisions and side-by-side model comparison.

Why output tokens cost more than input tokens

Every major provider prices output tokens 2-8× higher than input tokens. The reason: generating a token requires a full forward pass through the model, whereas processing an input token is comparatively cheap. The practical effect: a 'rewrite this' call typically costs ~3× more than a 'summarize this' call, even though both feel like one operation to the user. The cost-bar visualization above splits each model's bar into input portion (lighter) and output portion (darker) so you can see the ratio.

How prompt caching changes the math

Toggling 'caching enabled' applies the discount each vendor offers on repeated input tokens: OpenAI ~50%, Anthropic up to ~90%, within a 5-minute or 1-hour window. If your application reuses the same system prompt or context across many calls, real production cost is typically much lower than the no-cache estimate. Gemini doesn't yet expose prompt caching at the same level on the public API as of mid-2026; we don't apply a discount there.

Why a tokenizer-based estimator beats character counting

The classic '~4 chars/token' rule is fine for napkin-math English. It overshoots by 20-40% on punctuation-heavy code and JSON, undershoots by 30-60% on dense CJK, and varies model-by-model in ways the rule can't capture. Using the real tokenizer means the counts you see match what you'll actually be billed for on GPT models - and are within a few percent on Claude / Gemini.

FAQ

Which models does the counter support?

GPT-4o, GPT-4o mini, GPT-4 (legacy), Claude Sonnet 4.5, Claude Haiku 4.5, Claude Opus 4, Gemini 2.0 Flash, Gemini 2.0 Pro. Pricing reflects the vendor public list rate verified on the date stamped on the tool. New frontier models get added as they ship.

How accurate is the token count?

For GPT models, exact - we use OpenAI's official tokenizer (cl100k_base or o200k_base depending on the model). For Claude, we apply a ~+5% calibration multiplier; for Gemini, ~-2%. These multipliers come from empirical comparison with vendor tokenizers on English prose. For non-English text or code-heavy content, accuracy degrades; use the vendor's tokenizer for production billing.

Why might my real bill be lower than this estimate?

Prompt caching (toggle above) can reduce input cost by 50-90% on repeated prompts. Batch APIs offer ~50% off for jobs that can wait. Enterprise commitments and reserved capacity reduce rates further. Expand the 'Why your real bill may differ' section in the tool for the full list.

Does anything leave my browser?

No. The tokenizer runs locally, the calculations run locally, and we don't log inputs. The page only loads the tokenizer library on demand (~50kB chunk) and otherwise has no network calls.

What if pricing is stale?

The pricing-verified date is stamped on the tool. If a vendor changed their rate after that, our estimate is off until we update. We refresh quarterly; let us know if you spot stale pricing.

Can Croni help me build AI features?

Croni Publish uses a two-model pipeline - a generator drafts each post, a separate validator checks it for quality and rejects bad output before it ever reaches your feed. The cost-bar visualization above is a fast way to compare which combination of generator + validator models keeps margins healthy for your use case.

Ready to ghost-write
your social presence?

(Without writing a single post)