AI token cost calculator
Calculate input, cached-read and output token costs with your own API rates. See per-request and total consumption without uploading prompts.
Enter your token counts and the rates from your provider’s pricing page. This tool estimates token consumption, not a subscription invoice. It does not count tokens from text or call an AI API. All values remain in your browser. Reviewed September 5, 2026.
The formula, without hidden assumptions
Every cost in this tool comes from a quantity multiplied by a rate. Rates use US dollars per one million tokens. First subtract cached input from total input to obtain the fresh-input quantity. Multiply each category by its own rate, divide by one million, and multiply by the request count. Add the three category costs to obtain consumption for the forecast period. There is no extra platform fee built into the result.
Cost = requests × ((total input − cached input) × fresh rate + cached input × read rate + output × output rate) ÷ 1,000,000
For the synthetic example above, one request contains 2,000 fresh input tokens, 8,000 cached input tokens, and 1,000 generated tokens. At the entered rates, fresh input costs $0.002, cached reads cost $0.0008, and output costs $0.003. The total is $0.0058 per request, or $17.40 for 3,000 requests. This is a worked arithmetic example, not an observation from an operating application.
| Category | Tokens per request | Example rate per 1M | 3,000-request cost |
|---|---|---|---|
| Fresh input | 2,000 | $1.00 | $6.00 |
| Cached reads | 8,000 | $0.10 | $2.40 |
| Generated output | 1,000 | $3.00 | $9.00 |
Choose token counts that match your actual workload
A token is not necessarily a word or a character. To forecast an existing application, start with the usage fields in its API responses or provider dashboard. Check whether the reported input count includes cached tokens before copying values here. Some providers report separate categories rather than a combined total. In that case, reconstruct total input before entering the cached subset. Counting the same cached tokens in both fresh and cached categories makes the forecast too high.
For a new application, create a small test set covering short requests, typical requests, and long conversations. Do not enter private prompts into this website. Run your test using the provider’s own tooling and record aggregate counts locally. A single short prompt is a poor estimate for a document assistant that later sends conversation history, retrieval results, tool definitions, and instructions on every turn. Include the complete request context, not only the visible user question.
Output length deserves its own assumption. An output-token ceiling is a maximum, not a prediction that every request reaches it. Using the ceiling can be useful for a conservative scenario, but label it as such. Use measured output counts for an expected scenario. If reasoning or another billable category is charged separately by your provider, check its billing treatment and calculate that category outside this three-category tool instead of silently leaving it out.
Read the provider’s rate table before calculating
Confirm the provider, model, endpoint, region, currency, and billing mode. A model name alone is not a complete price. The same model served by different companies may have different rates and additional charges. A discounted batch request is not interchangeable with a standard interactive request. Do not combine the cheapest input price from one billing mode with an output price from another unless the official documentation explicitly permits that combination.
Copy rates in dollars per million tokens, not per thousand tokens. If a source gives dollars per thousand, multiply its number by one thousand before entering it here. If the source gives a price for a whole subscription or a credit pack, it is not a token rate. Keep the source URL and date with your own forecast so another person can reproduce the calculation later.
The Claude pricing documentation illustrates why category matching matters: cache writes and reads have different pricing. This calculator includes cached reads, but not cache creation or storage. The Ollama pricing page separates model consumption and plan allowances. For those monthly plans, use our Ollama cash calculator after estimating usage. Do not treat this tool’s consumption total as your final invoice.
Forecast uncertainty instead of hiding it
Calculate three scenarios with the same current rate source. In your lower-usage scenario, use modest request counts and shorter outputs. In your expected scenario, use the best available workload measurements. In the higher-usage scenario, consider longer conversations, more requests, and lower cache reuse. Record the three totals in your planning document. They describe conditional outcomes, not confidence intervals or promised bills.
Changing one assumption at a time makes the result easier to interpret. For example, leave the synthetic rates and request count unchanged but set cached tokens to zero. The cost becomes $39.00, compared with $17.40 in the cached-read example. The $21.60 difference is the arithmetic effect of that assumed cache reuse, not guaranteed savings. Real cache creation costs, expiration, minimum sizes, and misses can change the comparison.
Request growth has a simpler effect in this linear model. Doubling the request count doubles token consumption if the average request shape and rates stay constant. Real systems can depart from that assumption: more users may change conversation length, reuse, retry frequency, or the mix of selected models. Recalculate when those factors change rather than multiplying last month’s invoice by a user-growth percentage.
What is deliberately excluded?
This calculator excludes subscription fees, included credits, unused prepaid balances, taxes, currency conversion, tool-call charges, web-search fees, storage, cache writes, cache retention, images, audio, video, fine-tuning, hosting, and engineering costs. It also does not model tiered discounts or price changes during the forecast period. Add such costs as separate lines in a complete budget using the relevant official rate tables. If your workload mixes models, calculate each model separately and add the totals.
Retries are not automatically free. If your provider bills a retried request, include it in the request count. Concurrency is a throughput or eligibility constraint rather than an extra token multiplier. Ten requests running together do not imply ten times the tokens of the same ten requests running sequentially. Their actual usage and provider terms determine cost.
Common questions
Can this count the tokens in a pasted prompt?
No. It is a cost calculator for known or estimated counts. Exact text tokenization depends on the chosen model’s tokenizer. Use the provider’s supported token-counting method, then bring the aggregate numbers here. We avoid a text upload so you do not need to share prompt content with this website.
Should I enter one month of input tokens or one request?
Either representation can work, but do not multiply twice. For average per-request counts, enter the forecast number of requests. For already aggregated totals across the entire period, enter those totals and set requests to one. Label your calculation clearly so the next person does not interpret a monthly aggregate as a single request.
Does a zero result mean my AI application is free?
No. It means the entered quantities and rates produce no cost in the three categories modeled here. A subscription, machine, storage service, or other excluded category may still cost money. Review the exclusions before making a purchase decision, and check the provider’s current invoice rules.
How should I report the result?
Report the forecast period, provider rate source and verification date, token-count method, cache assumption, request count, and excluded items alongside the total. A transparent estimate is easier to update and challenge than a precise-looking dollar figure with no explanation. Read the credits versus cash guide before converting consumption into a subscription budget.