AI Token Cost Calculation Methodology
This page explains how the calculator turns token usage into estimated API cost. It is meant to make the assumptions visible so users can verify the result instead of treating it as a billing statement.
Core formulas
Total cost = input cost + cached input cost + output cost
Input cost = input tokens x calls x input price per 1M tokens / 1,000,000
Cached input cost = cached input tokens x calls x cached input price per 1M tokens / 1,000,000
Output cost = output tokens x calls x output price per 1M tokens / 1,000,000
Pricing fields
| Field | Meaning | Common mistake |
|---|---|---|
| Input price | Price for new prompt or context tokens sent to the model. | Including cached tokens here again. |
| Cached input price | Price for repeated context when the provider bills a cache hit separately. | Assuming every repeated prompt is automatically cached. |
| Output price | Price for generated tokens returned by the model. | Forgetting that output is often priced higher than input. |
| Calls | Number of model requests in the selected period. | Counting user tasks but not internal agent calls. |
Data sources and review
Pricing entries are compiled from official provider pricing pages for OpenAI, Anthropic Claude, Google Gemini, and DeepSeek. The pricing table links to official sources so users can verify each provider directly.
The site is reviewed when official pricing changes are known, when users report a mismatch, or when new supported models are added. The calculator does not automatically sync with provider billing systems.
What is not included
- Audio, image, video, grounding, storage, batch, priority, fine-tuning, or embedding charges unless explicitly listed.
- Provider discounts, regional taxes, credits, enterprise contracts, or account-specific pricing.
- Application costs outside the model API, such as hosting, vector databases, queues, logging, and human review.
- Tokenizer differences for exact billing. The text estimator is an approximation for planning.
Why results are estimates
Real bills depend on exact tokenizer output, provider-side rounding, model settings, retries, failed requests, feature-specific charges, and account-level terms. Use the calculator to compare scenarios and set a budget range, then verify with provider dashboards after launch.
Correction policy
If a pricing entry appears wrong, send the model name, official pricing URL, and the expected input, cached input, or output price to contact@aitokencost.net. Corrections are prioritized when they affect visible calculator results.
FAQ
Does the calculator use official prices?
It uses official provider pages as references, but users should verify current prices before production budgeting.
Why are cached input tokens separate?
Some providers bill repeated context differently. Separating cached input prevents users from mixing cache-hit and cache-miss prices.
Can I rely on this for invoices?
No. Use it for planning and comparison. The provider dashboard and invoice are the source of truth for billing.