LLM Token Counter & AI Cost Calculator
Count the tokens in your text or prompt and estimate the cost across GPT-5, Claude, Gemini, Kimi K3, Grok and DeepSeek. Exact OpenAI counting, per-call and monthly costs, with prompt caching.
API cost calculator
Estimate how much you would spend per call and per month on each model.
Share of the input that arrives cached and is billed at ~10%. Raise it if you repeat the same system prompt or work with agents.
| Model | Cost / call | Cost / month | Context |
|---|---|---|---|
| GPT-5.6 Sol | $0.02 | $20 | 400k |
| GPT-5.6 Terra | $0.01 | $10 | 400k |
| GPT-5.6 Luna | $0.004 | $4 | 400k |
| GPT-5.4 mini | $0.003 | $3 | 400k |
| GPT-5.4 nano | $0.00083 | $0.825 | 400k |
| Claude Fable 5 | $0.035 | $35 | 1M |
| Claude Opus 5 | $0.0175 | $17.5 | 1M |
| Claude Sonnet 5ⓘ | $0.007 | $7 | 1M |
| Claude Haiku 4.5 | $0.0035 | $3.5 | 200k |
| Gemini 3.1 Pro | $0.008 | $8 | 1M |
| Gemini 3.6 Flash | $0.00525 | $5.25 | 1M |
| Gemini 3.5 Flash | $0.006 | $6 | 1M |
| Gemini 3.5 Flash-Lite | $0.00155 | $1.55 | 1M |
| Gemini 3.1 Flash-Lite | $0.001 | $1 | 1M |
| Gemini 2.5 Flash | $0.00155 | $1.55 | 1M |
| Gemini 2.5 Flash-Lite | $0.0003 | $0.3 | 1M |
| Kimi K3 | ≈$0.0105 | $10.5 | 1M |
| Grok 4.5 | ≈$0.005 | $5 | 500k |
| DeepSeek V4 Pro | ≈$0.00087 | $0.87 | 1M |
| DeepSeek V4 FlashCheapest | ≈$0.00028 | $0.28 | 1M |
Token counts are exact for OpenAI models (o200k tokenizer). For Claude and Gemini they are estimates: recent Claude models use a tokenizer that produces ~30% more tokens for the same text, and Gemini uses its own. Treat it as a close approximation.
All counting happens in your browser. Your text is never sent to any server or stored.
What this tool does
You paste a text or a prompt and get two things: how many tokens it takes up, and what it would cost to process on the current models from OpenAI, Anthropic, Google, Moonshot (Kimi), xAI (Grok) and DeepSeek. With the input tokens, output tokens and calls-per-month fields, the table works out the cost per call and the estimated monthly bill for each model, and flags the cheapest.
Counting for OpenAI models is exact: it uses their own tokenizer (o200k_base), downloaded into your browser. Your text never leaves your machine.
For Claude and Gemini the count is a calibrated estimate. For Kimi, Grok and DeepSeek the tool does not load their tokenizer, so their cost is marked with ≈: use it to compare orders of magnitude, not to sign off a budget to the cent.
Why counting tokens matters before you write any code
When you wire a language model into an application, cost does not scale with your number of users — it scales with the size of what you send them. And that size is almost always underestimated, for three reasons:
The system prompt is paid on every call. If your system instruction is 800 tokens and you serve 10,000 requests a month, that is 8 million tokens paid purely to repeat the same instructions. It is the easiest spend to trim and the most commonly ignored.
History grows. In a chat, every turn re-sends the entire prior conversation. Cost per message is not constant: it grows with thread length, and in long conversations it takes off.
Retrieved context outweighs the question. In a RAG architecture, the chunks you inject are usually an order of magnitude larger than the user query. Deciding how many chunks fit is a cost decision, not just a quality one.
Measuring those three things before writing the integration is the difference between a predictable bill and a surprise.
How to use it
- Paste the text or prompt into the input field. The count updates as you type.
- Adjust the expected output tokens: what the model replies is billed too, and usually at a considerably higher rate than input.
- Enter how many calls per month you expect.
- Move the cached input control if you repeat the same prefix on every call. Tokens that arrive from cache cost around 10% of regular input, so the percentage you set there moves the bill more than any other field.
- Compare the monthly cost column across models.
What a token is
A tokenizer splits text into fragments based on how often they appear in the training data. Common words usually take a whole token; rare ones, proper nouns and technical terms get split into several. Spaces, punctuation and line breaks count too.
The usual rule of thumb — 1 token ≈ 4 characters ≈ 0.75 words in English — is a reasonable starting point, but only for English.
Text in other languages costs more
Tokenizers are trained on English-dominated corpora. The result is that a frequent English word fits in one token while its Spanish, Portuguese or German equivalent splits into two or three. The same content translated can cost 20 to 40 percent more.
This has an unintuitive practical consequence: if your application serves non-English users but the system prompt can be written in English without losing quality, writing it in English cuts real cost on every call.
Input and output do not cost the same
Every provider charges output tokens considerably more than input — the usual gap is three to five times. It is the asymmetry that most distorts a back-of-the-envelope estimate.
A typical case: an assistant that receives 2,000 tokens of context and replies with 500. It looks like the bulk of the cost sits in the input because it is four times longer, but at an output rate five times higher, those 500 tokens of reply can cost more than the 2,000 of input. That is why the tool separates the two fields instead of asking for a total.
How to cut the bill without losing quality
- Shorten the system prompt. It is the one token you pay on absolutely every call. Trimming 300 tokens there is worth more than optimizing anything else.
- Use prompt caching. All three providers bill an already-processed prefix at around 10% of regular input. In repetitive workloads the effect is not marginal: measuring 35 days of real work with a coding agent, 97.5% of the tokens turned out to be cache re-reads, and without that discount the equivalent bill went from $6,146 to $39,781. I break it down in how much AI coding agents really cost.
- Trim the history. Keeping the last N turns plus a summary of what came before usually gives the same result as re-sending the whole conversation.
- Pick the model per task. Classifying, extracting fields or routing does not need the priciest model. Reserving the big one for what actually reasons, and sending the rest to a small one, is the highest-impact optimization and the least practised.
- Cap output tokens. Setting an explicit ceiling avoids needlessly long answers that you pay for in full.
About the prices in the table
Prices are a hand-maintained reference, and the tool shows the date of its last review alongside each provider’s official links. API rates change often — and not only upwards: 2026 saw considerable drops — so for a firm budget it is worth confirming at the source.
Frequently asked questions
What exactly is a token?
It is the unit a language model splits text into before processing it. It matches neither words nor characters: frequent words are usually one token, rare ones get split into fragments, and spaces and punctuation count too. API billing is per token, not per word.
How many words are 1000 tokens?
In English, roughly 750 words. In Spanish considerably fewer, around 550 to 600, because tokenizers are trained mostly on English text and split Spanish words into more fragments. It is a rough rule: measure the actual text for a real figure.
Is the count exact for every model?
For OpenAI models yes, because the tool uses their own tokenizer (the o200k_base encoding). For Claude and Gemini it is a calibrated estimate, since their tokenizers are not public. Use it to size and compare, not as a billing figure.
Why does Spanish text cost more than English?
Because the same content produces more tokens. Tokenizers are trained on English-dominated corpora, so frequent English words fit in one token while their Spanish equivalents split into two or three. The same paragraph translated can come out 20 to 40 percent more expensive.
What is cached input and why does it change the cost so much?
It is the part of the prompt the provider already processed recently and does not charge at full price: OpenAI, Anthropic and Google all bill it at roughly 10 percent of regular input. It matters because in any repetitive workload (a fixed system prompt, a long chat, an agent working in a loop) most of what you send has already been sent before. In a 35-day measurement of a coding agent, 97.5 percent of the tokens were cache re-reads and the discount cut the equivalent bill by 84 percent. The calculator control lets you set what share of your input arrives cached and see the effect.
Is my prompt sent to a server?
No. The tokenizer is downloaded to the browser and counting happens locally. The text you paste never leaves your machine, so you can measure prompts containing customer data or internal information without exposing them.
Are the prices up to date?
The price table is a hand-maintained reference, and the tool shows the date of its last review alongside links to each provider's official page. API prices change often and sometimes drop sharply, so always confirm at the source before committing to a budget.
Reviews & ratings
No reviews yet. Be the first to leave one!
Related guides
Blog tutorials where this tool comes in handy.
Related tools
Others from the catalogue that pair well with this one.