AI Token Counter & Cost Calculator

Free browser-based tool to count tokens and compare API costs across GPT-4o, Claude, Gemini, Grok, Llama 4, and DeepSeek — then compare gateways and local runners (OpenRouter, Together AI, Groq, Fireworks AI, LLM Gateway, Hugging Face, and Ollama) to decide where to run them. Paste any prompt and see results instantly. Runs entirely in your browser — nothing is uploaded or stored.

LLM API pricing comparison (as of July 2026)

The table below shows current per-token pricing for the 13 most widely used AI models. Prices are per million tokens (MTok). Input tokens are what you send to the model; output tokens are what it sends back. Use the interactive calculator above to price your specific prompt.

Model Provider Input / MTok Output / MTok Context window
GPT-4oOpenAI$2.50$10.00128k tokens
GPT-4.1OpenAI$2.00$8.001M tokens
GPT-4o miniOpenAI$0.15$0.60128k tokens
o3OpenAI$2.00$8.00 ⚠200k tokens
o4-miniOpenAI$1.10$4.40 ⚠200k tokens
Claude Sonnet 4.6Anthropic$3.00$15.00200k tokens
Claude Opus 4.8Anthropic$5.00$25.00200k tokens
Claude Haiku 4.5Anthropic$1.00$5.00200k tokens
Gemini 2.5 ProGoogle$1.25$10.001M tokens
Gemini 2.5 FlashGoogle$0.30$2.501M tokens
Grok 4.3xAI$1.25$2.501M tokens
Llama 4 ScoutMeta$0.10$0.3010M tokens
DeepSeek V3DeepSeek$0.14$0.28128k tokens

⚠ o3 and o4-mini are reasoning models — internal chain-of-thought tokens are billed as output but not shown in the response. Actual cost is typically 2–5× higher than displayed.

LLM gateway and local runner comparison

Rather than calling OpenAI or Anthropic directly, many developers use a gateway — a single API that routes to multiple providers — or run models locally. The table below compares the main options.

Platform Type Models Pricing Free tier Best for
OpenRouterCloud gateway400+Base price + ~5% markupYesWidest model catalogue; switch providers without code changes
Together AICloud inference100+Own competitive pricingYes ($25 credit)Open-source models (Llama, Mistral, Qwen) at scale
GroqCloud inference20+Low cost, own pricingYesLowest latency — real-time and voice applications
Fireworks AICloud inference100+Own competitive pricingYesProduction agentic apps; strong structured output & function calling
LLM GatewayCloud gateway200+Base + 5% (BYOK = free)NoBYOK savings, self-hosting, SOC 2 compliance
Hugging FaceModel hub1M+Serverless (pay-per-call) or dedicated endpointsYesFine-tuned or niche models not on commercial APIs
OllamaLocal & cloud200+Local: free; cloud: Free / $20 / $100 per monthYesLocal privacy, offline work, or cloud access to large models

Gateway pricing is indicative. Always confirm current rates on the provider's own site before making infrastructure decisions.

Frequently asked questions

What is a token in AI pricing?

A token is the unit every major provider actually bills by — roughly 3-4 characters of English text, or about three-quarters of a word. Pricing is split into input tokens (what you send) and output tokens (what the model generates back), and output is almost always priced several times higher than input.

How accurate are AI token counters?

GPT-4o, GPT-4.1 and GPT-4o mini use OpenAI's real o200k_base tokenizer, loaded directly in your browser, so those counts are exact. Claude, Gemini, Grok, Llama and DeepSeek don't publish a free client-side tokenizer, so their counts are estimated from a characters-per-token ratio tuned per provider, typically within a few percent of the real count.

Why is Claude or Gemini's token count different from GPT's for the same text?

Each provider trains its own tokenizer on its own data, so identical text splits into a different number of tokens depending on the model. That's also why a prompt that comfortably fits one model's context window can fail in another's.

Why does output always cost more than input?

Generating text is more computationally expensive than reading it, so every provider prices output tokens higher than input, typically 3-5x.

What is the "context window," and what happens if my prompt exceeds it?

The context window is the maximum number of tokens a model can hold in a single request — your prompt plus its reply. Go over it and the request fails outright or gets truncated, rather than just costing more.

How does the multi-turn / chatbot cost modeling work?

Real chatbots resend the entire conversation history on every turn, so cost compounds as a conversation gets longer — a single per-run number badly understates this. Modeling this turn-by-turn and summing it gives a true cost-per-conversation figure, optionally accounting for prompt caching.

Does this tool send my prompt or document anywhere?

No. Tokenizing and cost calculation both run entirely in your browser using JavaScript — nothing you paste is uploaded, stored, or transmitted anywhere, including to us.

What is the difference between a direct API provider and a gateway?

Direct providers (OpenAI, Anthropic, Google, etc.) host their own models and bill per token. Gateways like OpenRouter and LLM Gateway sit in front of multiple providers and give you one API key for all of them, adding a small markup (~5%). Inference providers like Groq and Together AI host open-source models on their own hardware at competitive prices. Local runners like Ollama let you run models on your own machine for free.

Is the pricing always up to date?

Pricing is entered manually from each provider's published rate card and reviewed periodically. Providers change prices without much notice, so confirm current rates on the provider's own site before relying on this for budgeting a production workload.

Understand the numbers

The calculator gives you a figure. These guides explain how LLM billing actually works — which assumptions are load-bearing, and what to change when the answer is too expensive.

All guides · How these numbers are calculated