AI Token Counter & LLM Cost Calculator
Related Tools
Enter input and output token counts; compare price across 30+ models. Deep-links from the token counter; cache- and reasoning-aware.
Side-by-side matrix: context, API $/M, capabilities; shareable ?models= links. Pairs with token counter and cost calculator.
Hub page listing every AI utility: token counter, cost calculators, RAG, caching, and programmatic model pages.
Users × requests/day × tokens with ×2/×5 stress and 12‑month projection for one reference model.
Compare per-request cost with and without prompt cache hits using published cached-input rates.
Rough planning estimate for image width/height → vision tokens.
Duration-based illustrative cost bands for speech and TTS-style workloads.
Float32 GB estimate plus embedding API math for ingest and monthly queries.
TPM and RPM headroom against illustrative dev/production tiers.
Break-even requests after a one-time fine-tune fee using your $/M assumptions.
Prompt + history size vs model context with 70% / 90% markers.
Editorial log of llm-pricing.json updates; pairs with /feed/pricing.xml.
Documents × chunks × top‑K × daily queries × output tokens — illustrative monthly LLM spend.
About AI Token Counter & LLM Cost Calculator
The AI Token Counter & LLM Cost Calculator is a free, privacy-first tool for estimating token usage and API cost across the most-used large language models in 2026 — including GPT-5, GPT-5 Mini, Claude Opus 4.7, Claude Sonnet 4.6, Gemini 2.5 Pro, Gemini 2.5 Flash, Llama 4, DeepSeek V3.1 and more. It is role-aware (system / user / assistant / tool), understands prompt caching and reasoning "thinking" tokens, and computes per-request and monthly costs against published per-million-token prices. Everything runs in your browser — no server round-trips, no signup, no telemetry on your prompts — so sensitive data stays on your device.
Key Features
- Role-aware prompt composer (system / user / assistant / tool) with per-message token counts — exact o200k per block for OpenAI when the tokenizer is loaded
- Compare 30+ frontier and open-source LLMs from OpenAI, Anthropic, Google, Meta, DeepSeek, Mistral, xAI, Cohere and Alibaba
- Prompt-caching-aware math for Anthropic, OpenAI and Gemini cached-input pricing
- Reasoning / "thinking" token toggle with a tunable ratio for GPT-5-thinking, Claude extended thinking, o-series and DeepSeek R1
- Per-request and per-month cost columns, sortable by total cost, input price, or context size
- Context-window fit meter with green / amber / red warnings at 70% and 90% utilisation
- Quick presets — Flagship, Cheapest, Best for coding, Best for reasoning, Long context (≥ 500k)
- Drag-and-drop or file upload for .txt, .md, .json, .csv, .ts, .js, .py, .html, .xml, .yaml
- Shareable permalink that encodes the entire scenario (no account, no database)
- One-click CSV export for the per-model cost breakdown
- Zero network calls with your prompts — every token count and price calculation runs locally
- Open, versioned pricing dataset you can inspect, copy and send pull requests against
Use Cases
- Estimate monthly API cost before deploying an AI feature to production
- Pick the most cost-effective model for a given prompt across 30+ providers
- Size prompts against each model’s context window to avoid truncation
- Model the savings from turning on prompt caching for long system prompts
- Compare the true cost of reasoning models (GPT-5-thinking, o-series, Claude extended thinking, DeepSeek R1) when thinking tokens dominate output
- Build a per-customer pricing sheet for an AI SaaS feature before you launch
- Share a costed scenario with your team via a single URL — no login required
- Teach engineers how tokenization, pricing tiers and context limits actually work
Pro Tips
- OpenAI GPT-family totals use the real o200k BPE (gpt-tokenizer) — same encoding as GPT-4o / GPT-5–class chat APIs for your pasted text. Claude, Gemini and Llama still use calibrated estimates (±~5%). Reconcile billing in each dashboard.
- Prompt caching can cut input cost by up to 90% for long, repeated system prompts. Set the "cached input fraction" slider to a realistic cache-hit ratio (0.5 – 0.9 for production chat agents).
- Reasoning models bill their hidden "thinking" stream as output. Enable the thinking toggle and tune the ratio (1.0 = thinking roughly equals visible output).
- Long contexts usually cost more, not just in tokens but in latency. Use the context-fit meter — aim to stay under 70% of the window for predictable performance.
- Copy the share link to lock the scenario into a URL — great for cost-review docs, Linear tickets and pull requests.
- Open with a preset via the query string, e.g. `/dev-tools/ai-token-counter/?preset=cheapest` or `?preset=flagship` (also `reasoning`, `long-context`, `coding`). A share URL that includes selected models in the hash overrides the preset.
Frequently Asked Questions
How accurate is the token count?
For OpenAI models marked o200k (GPT-5, GPT-4o, etc.), this page runs the real o200k BPE tokenizer in your browser — counts match API tokenization for the same UTF-8 string (your role-labeled conversation as pasted). Chat API calls also add a few overhead tokens for message packaging; for invoice-perfect counts, use the provider dashboard. Claude, Gemini and Llama still use calibrated estimates (±~5%) because those tokenizers are not shipped in this page.
Are my prompts uploaded anywhere?
No. Every token count and price calculation runs entirely in your browser. The page makes zero network requests with your prompt text. You can verify this by opening DevTools → Network while you type. This is the main reason security-conscious teams prefer our tool over server-side calculators.
Which models and providers are supported?
OpenAI (GPT-5 family, GPT-4.1, GPT-4o, o-series), Anthropic (Claude Opus 4.7, Sonnet 4.6, Haiku 4, Claude 3.5 Sonnet), Google (Gemini 2.5 Pro / Flash / Flash-Lite), Meta (Llama 4 Maverick / Scout, Llama 3.3), DeepSeek (V3.1, R1), Mistral (Large 2, Codestral 2, Small), xAI (Grok 4, Grok 3), Cohere (Command R+, Command R) and Alibaba (Qwen3-Max, Qwen3 Coder). We add new releases as they ship.
How is prompt caching priced?
Anthropic and OpenAI offer cached input at a steep discount (often ≈10%) versus normal input, with a small one-time cache-write premium for Anthropic. Gemini offers context caching with a similar model. Our calculator applies each provider’s published cached-input rate to the fraction of input you mark as cached.
What are thinking / reasoning tokens and why do they matter?
Reasoning models (GPT-5-thinking, the o-series, Claude extended thinking, DeepSeek R1) generate a hidden chain-of-thought before the final visible answer. Providers bill those hidden tokens as output. Turning the thinking toggle on and setting a ratio of 1.0 (thinking ≈ visible output) gives a realistic cost that many cost calculators hide.
Why does my estimate differ from the provider’s dashboard?
Three common reasons: (1) the provider ran a slightly different tokenizer version; (2) their dashboard charges for system overhead the API call added; (3) you included examples or formatting that compressed differently from our estimate. Treat our number as a budgeting estimate (±5%) and reconcile against the official invoice for accounting.
Can I save a scenario and share it with my team?
Yes. Hit “Share” to copy a URL that encodes the full scenario — messages, output tokens, cached fraction, monthly volume and selected models. The link works offline, has no expiry and stores no data on our servers.
Is this tool free forever?
Yes. The tool is ad-supported and fully free. There is no signup, no rate limit, no API key required, and no hidden premium tier. The open pricing dataset is versioned and publicly readable.
How often is pricing updated?
We refresh the pricing dataset whenever a supported provider announces a change. The homepage badge shows the most recent update date, and each model has a verified timestamp. For mission-critical budgeting, always double-check against the provider’s live pricing page before you launch.
