LLM Token Counter & API Cost Calculator
Estimate token counts and compare monthly API costs across 32 models from Anthropic, OpenAI, Google, xAI, and DeepSeek. Live prices sourced directly from each provider — not from training data.
Character and word counts are exact. Token counts are estimates because tokenizers differ per model family and only OpenAI publishes theirs (
tiktoken). This tool uses per-family chars-per-token heuristics tuned to published averages. For byte-exact OpenAI counts use OpenAI’s official tokenizer.
1. Count tokens
2. Compare monthly costs
Enter your expected per-request tokens and request volume. Uses the token counts above as defaults, or override manually.
| Provider | Model | Input $/MTok | Output $/MTok | Cached $/MTok | Context | Monthly $ |
|---|
Verify before committing. Pricing changes frequently and varies by tier, region, and features (batch discounts, priority tiers, volume commits). Some providers list off-peak or promotional rates — peak/standard-tier rates may be higher. Cached-input pricing applies only to reused prefixes; write-time cache costs are omitted for readability. This tool is a planning aid, not a bill.
3. Model reference
All 32 models tracked. Sort by any column. Click any provider name for its official pricing page.
| Provider | Family | Model | Input | Output | Cached | Context | Notes |
|---|
How to estimate LLM API costs before you commit
Model pricing shifts monthly, tokenizers differ per family, and every provider prices things a little differently — per-million tokens vs. per-thousand, cached vs. fresh input, batch vs. real-time. This tool gives you an apples-to-apples monthly-cost view across the current lineup without you memorizing anyone’s pricing page.
Why token counts are estimates (and why that’s honest)
Only OpenAI publishes their tokenizer (tiktoken). Anthropic, Google, and xAI keep theirs private. Every “Claude token counter” tool you see online is estimating, whether they admit it or not. Common heuristics: chars-per-token ~4 for English on GPT models, ~3.5 for Claude, ~4 for Gemini. Real content varies with language, code density, and punctuation. Treat estimates as within ±15%.
What matters more than exact token counts
- Input/output ratio. Chat apps skew toward long inputs, short outputs. Code assistants flip that. Output tokens are usually 2–10x the price of input.
- Cached input. Reusing system prompts across requests can drop input costs 80%+ on models that support it. Anthropic, OpenAI, and Google all publish cache rates; xAI and DeepSeek partial support.
- Context window matters for the workload, not the pricing tier. Bigger context isn’t inherently more expensive per token, but some providers charge more for prompts above certain thresholds (Google: >200k, xAI: >200k). Watch the notes column.
- Batch discounts. Not shown here because they aren’t consistently published; typically 50% off for offline batch workloads (OpenAI, Anthropic). Ask before committing to a big batch job.
Data source and freshness
Prices are pulled from each provider’s own pricing page and stored in llm-pricing.json with per-entry source URLs. Retrieval date is shown prominently at the top of the tool. We aim to refresh quarterly — if you spot a stale figure, the source URL is one click away. Never trust an LLM-generated pricing summary (including one from us) without verifying against the provider’s page.
Related tools
- API Directory (500+ public APIs) — browse other developer APIs beyond LLMs.
- Developer Tools Suite — JSON, JWT, regex, and more.
- Freelance Rate Calculator — work out what your billable rate needs to be to make LLM API spend sustainable.