Formulas and sources
Each formula this calculator uses, where it comes from, and what it leaves out. "How it works" shows the same formula with your own numbers.
Cost of one request
In the one-model view
- Cost / request
- the cost of one API call
- Input Tokens
- the prompt, system instructions and context sent to the model
- Output Tokens
- the tokens the model writes back
- Input Rate
- the price per 1 million input tokens, after any option below
- Output Rate
- the price per 1 million output tokens, after any option below
Rates are in US dollars per 1 million tokens, as each provider’s own pricing page states them. For Llama 4, which Meta’s pricing page does not list, they are the median of its hosting providers’ prices. This panel carries no prices: the model details under the model picker show the rate in use, the date it was last checked and where it was read.
Source: Standard formula; no single publisher. Rates are each provider’s own per-1M-token prices, such as OpenAI’s [1], Anthropic’s [2] and Google’s [4].
Monthly cost
With Requests per month set
- Monthly
- the cost of a month of requests
- Cost / request
- from the formula above
- Requests / month
- how many requests you send in a month
A cache kept by the hour (Google, ByteDance) adds its storage charge once to the month, not to each request (see "Cache storage").
Source: Standard formula; no single publisher.
Comparing models
In the Compare view
- Monthly
- each model’s cost for the month
- Input Tokens
- the same for every model
- Output Tokens
- the same for every model
Each model is priced at its own rates, and its own long-context tier where one applies. The batch, cache, reasoning and custom-rate settings of the one-model view do not reach the columns; a column’s own Customize pricing applies to that column only. A Words setting does not reach the Compare view either: the numbers there are read as tokens. The lowest cost per request is marked Best.
Source: Standard formula; no single publisher.
Cached input and cache writes
With Cached input pricing on
- Input Tokens
- all the input tokens of the request
- Cached Tokens
- input tokens read back from the provider’s cache
- Written Tokens
- input tokens written to the model’s default cache on this request (5 minutes on Claude, 30 minutes on OpenAI)
- Input Rate
- the model’s input rate
- Cached Rate
- the model’s published cached price, a fraction of its input rate
- Write Rate
- the model’s published write price, a fraction of its input rate
A model with no published cached price bills cached tokens at the full input rate, and one with no published write price bills written tokens as plain input. A write only pays off once it is read back: the result says after how many reads. The written tokens count in the Input Cost card.
Source: Standard arithmetic on each provider’s published shares: OpenAI’s Cached input and 30m write columns [1] and prompt-caching guide [10]; Anthropic’s prompt caching table and its break-even of one read for a 5-minute write [2].
Batch pricing
With Batch pricing on
- Batch Rate
- the rate for input, cached input, cache writes, reasoning and output tokens alike, except cached input where the provider keeps its standard price
- Standard Rate
- the rate without Batch pricing
- Batch Share
- the model’s published batch price over its standard price
Where a provider publishes a batch price, Batch Share is that price over the standard price. OpenAI, Anthropic and Google set it at half. On some Gemini models Google keeps cached input at its standard price under Batch, and those cached tokens keep their standard rate. A model with no published batch price, or no batch API, keeps its standard rates.
Source: Each provider’s own batch prices: OpenAI’s Batch table, which halves the cache-write price too [1], Anthropic’s, whose cache multipliers stack with the Batch discount [2][3], and Google’s [4].
Reasoning tokens
For OpenAI, Anthropic, Google and xAI models
- Billed Output Tokens
- the output tokens the provider charges for
- Output Tokens
- the visible answer
- Reasoning Tokens
- the private tokens a model spends thinking before it answers; the figure your API reports
They are not in the response, so the bill is larger than the visible answer.
Source: Billed as output tokens by OpenAI [5], Anthropic [6], Google [4] and xAI [12].
Long-context rates
When Input Tokens pass a model’s threshold
Above a model’s threshold, OpenAI, Google, xAI and MiniMax bill the whole request at their long-context rates, not only the tokens past it. A request just over the line can cost up to twice as much as one just under it, and up to five times on Claude Haiku 5.5. Claude 4.6 and later models cost the same at any length, except Claude Haiku 5.5, which bills the whole request at higher rates once the prompt is over 100,000 tokens. The model details show each threshold.
Source: As each provider publishes it: OpenAI’s Long context prices [1], Google’s prompts over 200k tokens [4], and Anthropic’s standard pricing across the full context window, with Claude Haiku 5.5’s prices by prompt length [2].
Cache storage
For Google and ByteDance models with Cached input pricing on
- Monthly
- the cost of a month of requests
- Cost / request
- the cost of one request
- Requests / month
- requests in the month
- Cached Tokens
- the tokens kept in the cache
- Storage Rate
- the provider’s storage price per 1 million tokens per hour, Standard tier
- Hours
- how long the cache is kept in the month
Google and ByteDance charge by the hour for keeping a cache, on top of the cheaper read. It is one charge for the period, not one per request.
Source: Google’s storage price, from its context caching rows [4], and ByteDance’s Standard billing rule on BytePlus [11].
Words to tokens
With a side switched to Words
- Tokens
- the estimated token count, rounded up
- Words
- the words you enter
- Tokens per Word
- an estimate per model family: about 1.33 for GPT and models without a ratio of their own, 1.52 for Claude 4.6 and earlier, 1.98 for Claude 4.7 and later, 1.67 for Gemini
These are estimates; real counts depend on the text and the provider’s tokenizer. "How it works" states the ratio it used for your model.
Source: Based on OpenAI’s rule of thumb of 0.75 words a token [7] and Anthropic’s 3.5 characters a token [8]. Claude 4.7 and later is scaled by the 30% more tokens Anthropic gives for its newer tokenizer [2]. Gemini’s is CalcTrail’s own estimate, at the high-token end of Google’s 60 to 80 words per 100 tokens [9].
Cost range
With Variability set above 0
- Cost / request
- the estimate
- Variability
- how far you expect the token counts to differ, as a percentage; 20 to start
For one request, and for the month when requests per month is set: each request’s low and high times the volume, with any cache storage at both ends.
Source: CalcTrail’s own range; no publisher.
What prompt caching saves: the Batch + Cached Prompt example
Sources
- OpenAI. Pricing, the Standard and Batch tables (Cached input and 30m write columns) and Long context. Undated page, read October 26, 2026.Our automated tests check this calculator against 4 cases from it.
- Anthropic. Pricing, sections "Prompt caching", "Batch processing", "Long context pricing" and "Additional notes". Undated page, read October 17, 2026.Our automated tests check this calculator against 2 cases from it.
- Anthropic. Prompt caching, its pricing section and FAQ. Undated page, read October 5, 2026.
- Google. Gemini Developer API pricing, the per-model Standard tables: Batch, context caching and its storage price, thinking tokens, prompts over 200k tokens. Undated page, read November 19, 2026.
- OpenAI. Reasoning models, section "How reasoning works". Undated page, read October 5, 2026.
- Anthropic. Steering thinking, section "Pricing". Undated page, read October 26, 2026.
- OpenAI. Key concepts, section "Tokens". Undated page, read October 5, 2026.
- Anthropic. Glossary, entry "Tokens". Undated page, read November 14, 2026.
- Google. Understand and count tokens, its opening section on tokens. Undated page, read November 19, 2026.
- OpenAI. Prompt caching, cache-write lifetimes and rates. Undated page, read October 26, 2026.
- BytePlus. Model pricing (ModelArk), section "Billing rules" and the Cache storage column. Undated page, read November 19, 2026.
- xAI. Prompt caching: Usage & Pricing, section "Pricing", the Reasoning tokens row. Undated page, read November 24, 2026.
What this calculator does not cover
- Prices are standard-tier list prices in US dollars, before tax. Service tiers and surcharges are not applied: OpenAI’s Fast and Flex modes and its regional-processing uplift, Google’s Priority tier, and the US-only inference surcharges of Anthropic and xAI.
- Only each provider’s default cache write is priced: 5 minutes on Claude (its 1-hour write costs twice the input rate) and 30 minutes on OpenAI (its 12-hour write costs 2.5 times it). Inside a batch, Anthropic serves cache hits on a best-effort basis.
- Fees beyond tokens are left out: web search, code execution, the extra input tokens tool use adds, and earlier thinking blocks that Anthropic bills as input.
- Time-of-day prices, such as DeepSeek’s off-peak half price, and volume or negotiated discounts are not applied. Custom rates take a contract price.
- The Reasoning field is offered for OpenAI, Anthropic, Google and xAI models only, the four that say they bill reasoning as output. Other providers’ thinking tokens are not counted.
- A price change a provider has already announced takes effect on its date, by your device’s calendar. A model a provider has shut down is not offered for new estimates, and a saved tab keeps the model it used.
Sources checked on
How we choose sources and test the calculators: How CalcTrail calculates