Technology calculators

Token Cost Calculator

Updated Nov 10, 2026 By Infinity Calculator Formulas Sources
Rate
1. Usage Input
Characters, words and tokens update as you type.
Enter a single number; the unit toggle decides how it is read.
Interpret this number as
Converted with 1 token ≈ 0.75 words ≈ 4 characters.
Prompt caching re-uses an identical prompt prefix from the provider's cache at a reduced read rate. Not every model supports it. Where no cache tier exists these tokens bill at the standard input rate.
In this mode this field takes precedence over the output-ratio slider.
0Characters
0Words
0Input Tokens (est.)
0Output Tokens
Token figures are approximations (1 token ≈ 4 characters ≈ 0.75 words). Real tokenizers differ per model, so treat these as estimates.
75%: 0 tokens
Multiply your per-call cost by this number to project total spend.
Applies to Text Input and Word Count modes. In Token Count mode the cached-token field is used instead.
Adds the one-time write premium for cached tokens to Anthropic totals.
Rates are published in USD.
2. Model Rates & Comparison Selection
Quick provider filter
Model pricing table with editable rates, per-call cost and projected total cost.
Compare Provider Context Tier Fixed Fee / Call (USD) Est. Cost / Call
All rate boxes are editable and are entered in USD per 1 000 000 tokens. An edited rate is outlined in amber with a reset control beside it. Cost columns are shown in your selected display currency.
3. Cost Results
Prices Last Updated:
Detailed Cost Breakdown
4. Cost Breakdown Chart
Each bar is the projected total cost for the entered call volume, segmented by billing component.
Step-by-Step Solution

Introduction

AI models charge you by the token. A token is a small piece of text, about 4 characters long.1 Every prompt you send and every answer you get back costs money. This Token Cost Calculator shows you that cost before you get the bill.

Paste your text, type a word count, or enter exact token numbers. Then pick how many API calls you plan to make. The tool works out your input cost, output cost, and cached token cost for over 30 models from OpenAI, Anthropic, Google Gemini, xAI Grok, DeepSeek, and Mistral. If you only need the token counts themselves without pricing, the Token Calculator handles that job.

You can compare models side by side, see a chart of where your money goes, and switch to euros, pounds, yen, or Canadian dollars. Every price box can be edited, so you can test your own rates or a deal you were offered. The step-by-step section shows the math, so you can check the numbers yourself.

Use it to plan a budget, pick a cheaper model, or find out if prompt caching is worth it for your app.

How to use our Token Cost Calculator

Tell the calculator how much text you send to an AI model and how many times you send it. It shows your token counts, the cost per API call, the total cost for all calls, a side-by-side model comparison, and a chart of where the money goes.

Text Input tab: Paste or type your real prompt here. The tool counts the characters and words and turns them into an estimated token count.

Word Count tab: Type one number if you already know the size of your prompt. Then pick Words, Tokens, or Characters so the tool knows how to read that number.

Token Count tab: Enter exact token numbers from your API logs. Fill in input tokens, cached prompt tokens (tokens read from the provider's cache), and output tokens.

Output size slider: Set how long the model's answer is, as a percent of your input tokens. Use the quick buttons like Chat 75% or Classification 10% if you are not sure.

Number of API calls: Enter how many times you will run this prompt. The cost per call is multiplied by this number.

Cached share of input (%): Enter what part of your prompt is reused and served from cache. Cached tokens cost less on models that offer a cache rate.

Anthropic cache-write tier: Pick None if your cache is already warm. Pick the 5-minute or 1-hour tier to add the one-time cache write fee to Claude models.

Display currency: Choose USD, EUR, GBP, JPY, or CAD. All prices are set in USD. For another currency, the Exchange rate box fills with the latest daily rate, and you can type your own rate instead.

Provider filter: Click a provider name to show or hide its models. Hover the info icon to see how that provider bills caching.

Search box: Type part of a model or provider name, like "haiku" or "gemini", to shrink the table fast.

Sort menu: Keep the default grouped view, or sort every model from cheapest to most expensive by total cost.

Compare checkboxes: Tick the models you want to test. Pick two or more to unlock the comparison table and the stacked chart.

Rate boxes: Change any input, output, cached, or fixed-fee price if your contract rate is different. Edited boxes turn amber and have a reset button.

Show only selected rows: Turn this on to hide every model you did not tick.

Buttons: Press Calculate to refresh the numbers, Highlight Best Value to mark the cheapest pick, Copy Estimate to save the breakdown as text, and Reset to start over.

What Are AI Tokens?

A token is a small piece of text. Most AI models break your words into these pieces before they read them. One token is about 4 characters, or roughly three-quarters of a word.1 So 100 words is about 133 tokens. Short words may be one token. Long or odd words may be split into two or three.

How AI Token Pricing Works

AI companies charge by the token, not by the question. Prices are listed in dollars per 1 million tokens. Every API call has two main parts:

  • Input tokens: the text you send in, like your prompt, chat history, and any documents you paste.
  • Output tokens: the text the model writes back.

Output almost always costs more than input. On Claude Sonnet 5.5, for example, output costs $10 per million tokens and input costs $2.2 That is because the model has to think and build each new word, which takes more computer power than reading.

Cached Tokens Can Cut Your Bill

If you send the same starting text again and again, like a long system prompt, the provider can save it. This is called prompt caching. Reading from the cache is much cheaper. On most Claude models, a cache read costs 10% of the standard input price.2 Anthropic also charges a write premium to store the text: 1.25 times the base input price for a 5-minute cache, or 2 times for a 1-hour cache.2 Google bills cached tokens at a reduced rate plus a storage price for each hour the cache is kept.3 OpenAI's GPT-6 models also list a separate cache-write rate.4

Other Things That Change the Price

  • Context tiers: Some models charge more when your prompt goes over a set size. Gemini Pro models switch to a higher rate for prompts over 200K tokens.3 OpenAI's GPT-6 models switch to a higher rate above 272K input tokens.4
  • Time of day: DeepSeek's off-peak rates are half of its peak rates, and peak hours are 01:00 to 04:00 and 06:00 to 10:00 UTC, Monday through Friday.5
  • Fixed fees: Perplexity's Sonar Chat Completions added a flat search fee to every request, on top of the token cost, until its support ended on September 27, 2026.6 Tool costs are separate from model token costs on its Agent API, where a standard web_search costs $0.0025 per invocation.7 xAI bills its Web Search tool per call, on top of tokens.8 That is $5 for every 1,000 calls.
  • Promo prices: A few models have temporary low rates that end on a set date. Gemini 3.8 Flash, for example, is $0.75 per million input tokens through December 31, 2026, and $1.50 starting January 1, 2027.3

Why Estimating Token Costs Matters

One API call may cost less than a penny. But apps make thousands or millions of calls. Small price gaps grow fast. A model at $15 per million output tokens costs 30 times more than one at $0.50. Checking the math before you build helps you pick the right model, set a real budget, and avoid a surprise bill.

If AI calls are part of a product you sell, token spend belongs in your unit economics.

Simple Ways to Spend Less

  • Ask for shorter answers. Set a word or token limit in your prompt.
  • Use a small model for easy jobs like sorting or tagging. Save big models for hard work.
  • Put your fixed instructions at the start so caching can pick them up.
  • Trim old chat history and cut extra documents you do not need.
  • Batch jobs when you can. Anthropic's Batch API, for example, gives a 50% discount on both input and output tokens.2

Note: Token counts here are estimates based on 1 token ≈ 4 characters. Each model uses its own tokenizer, so real counts will be a little different. Always check the provider's current price page before you commit to a budget.


Formulas used

Input tokens from characters or words 1
T_{in} \approx \frac{\text{characters}}{4} \approx \frac{100 \times \text{words}}{75}
Output tokens from output ratio
T_{out} = T_{in} \times \frac{r_{\%}}{100}
Cached and uncached input token split
T_{cached} = T_{in} \times \frac{s_{\%}}{100}, \qquad T_{uncached} = T_{in} - T_{cached}
Cost per call
C_{call} = \frac{T_{uncached} \cdot P_{in} + T_{cached} \cdot P_{cached} + T_{out} \cdot P_{out}}{1{,}000{,}000} + F
Total projected cost for all calls (the cache write, when chosen, is billed once, on the first call)
C_{total} = C_{call} \times N_{calls} + \frac{T_{cached} \cdot (P_{write} - P_{cached})}{1{,}000{,}000}
Currency conversion of displayed cost
C_{display} = C_{USD} \times FX_{rate}

Frequently asked questions

Why is my real bill a bit different from this estimate?

Two reasons. First, token counts here use a rule of thumb: 1 token is about 4 characters. Each model has its own tokenizer, so its count will be a little higher or lower.

Second, providers can add things this tool does not model, like reasoning tokens, image tokens, cache storage fees, or taxes. Treat the result as a close guess, not an invoice.

How do I work out my monthly AI cost?

Put your monthly call volume in the Number of API Calls box. If you make 500 calls a day, enter 15,000 for a 30-day month.

The Est. Total Cost column then shows your monthly spend for that model.

Do cached tokens get added on top of my input tokens?

No. Cached tokens are part of your input, not extra. The tool splits your input into two parts: cached tokens billed at the cheap cache-read rate, and the rest billed at the normal input rate.

That is why the cached number can never be larger than the input number.

How do I compare two models fairly?

Tick both boxes in the Compare column. The comparison table and stacked chart appear once you pick two or more.

Keep the input, output, cache, and call settings the same for both. Then the only thing changing is price.

Is the 4-characters-per-token rule good for code and other languages?

It is decent for plain English. The 4-characters rule is a rough estimate for English text, and other languages can have different relationships between characters, words, and tokens.1

  • Code and JSON: often more tokens, because symbols and indents split up.
  • Chinese, Japanese, Arabic: often many more tokens per character.

For those, use the Token Count tab with real numbers from your API logs.

My prompts vary in size. What number should I enter?

Use your average prompt size, then check a worst case too. Run the average for your budget and the largest prompt to see your ceiling.

If big prompts pass a model's long-context limit, switch to that model's long-context row.


Sources

  1. Understanding and counting tokens. OpenAI. Use rough estimates for English text; Distinguish input and output tokens. Accessed November 4, 2026.
  2. Pricing. Anthropic. Model pricing; Prompt caching; Batch processing. Accessed November 4, 2026.
  3. Gemini Developer API pricing. Google. Gemini 3.8 Flash; Gemini 3.1 Pro Preview; Gemini 2.5 Pro. Accessed November 4, 2026.
  4. Pricing. OpenAI. Flagship models. Accessed November 4, 2026.
  5. Models & Pricing. DeepSeek. Pricing, note (2). Accessed November 4, 2026.
  6. Migrate from Sonar to the Agent API. Perplexity. 2026. Accessed November 4, 2026.
  7. Pricing. Perplexity. 2026. Accessed November 4, 2026.
  8. Models and Pricing. xAI. 2026. Accessed November 4, 2026.