Skip to content
Greatest Calculators

LLM API Cost Calculator

Estimate language-model API cost per request, day, month, and year from uncached input, cached input, cache writes, output tokens, request volume, and editable provider rates.

Estimated monthly API cost

$288.00per month

GPT-6.1 Sol · 30,000 requests/month

Per request
$0.0096
Per day
$9.60
Per year
$3,456.00
Model and token mix

Standard pricing for prompts up to 272K input tokens (longer prompts cost 2× input and 1.5× output). Batch, Flex, Fast, Ultrafast and regional uplifts excluded.

tokens
tokens
tokens
tokens

Include billed reasoning or thinking tokens.

Rates per 1 million tokens
$
$
$
$
Request volume and extras
$

Grounding, tool calls, or another measured variable cost.

$

Cache storage, platform plans, monitoring, or support.

Cost per request

Uncached input
$0.004
Cached input / cache reads
$0.0006
Cache writes
$0.00
Output
$0.005
Other variable charges
$0.00
Variable cost per request
$0.0096
Cost per 1,000 requests
$9.60

Monthly usage and spend

Requests
30,000
Uncached input tokens
60,000,000
Cached input tokens
180,000,000
Cache-write tokens
0
Output tokens
15,000,000
Variable spend
$288.00
Fixed monthly costs
$0.00
Total monthly cost
$288.00

Pricing sources

Preset rates verified 2026-10-27. Always confirm before a purchasing decision.

What this calculator assumes
  • Direct standard paid-tier text-token prices only; rates are per 1 million tokens.
  • Every request is assumed to have the same average token mix.
  • Long context, regional processing, Fast/priority, Batch/Flex, media, tools, grounding, taxes, and free-tier quotas are excluded unless added manually.
  • Google cache storage and similar time-based charges belong in fixed monthly cost.

How this is calculated

I teach data analysis and SQL on The Data Science Tutor.

Formulas, assumptions, and rounding are documented in our calculator methodology.

Built by Will Henschell, data scientist. Formula checked against OpenAI, Anthropic and Google API pricing pages, verified . Editorial policy.

Disclaimer: Provider pricing changes frequently. Presets were verified October 27, 2026 and cover comparable standard text-token pricing only; two Google prices are promotional and rise on December 1, 2026 and January 1, 2027. Confirm current prices, service tier, context length, region, tools, modalities, cache storage, and taxes with the provider before purchasing capacity.
Two strips joined by bands. The top splits one request's tokens into input, cached input and output; the bottom splits its cost the same way. Output is the thinnest slice of tokens but the widest slice of cost, while cached input shrinks from the widest slice to a narrow one.
At the calculator's example rates ($2, $0.10 and $10 per million tokens), 500 output tokens are 6% of a request but 52% of its $0.0096 cost. At 1,000 requests a day for 30 days that is $288.00 a month.

Why Token Mix Matters More Than Total Tokens

One million tokens do not have one universal price. Output tokens usually cost several times more than ordinary input, while cached input can cost a fraction of the uncached rate. Two applications with identical total tokens can therefore have very different bills depending on output length, cache-hit rate, and how often prompts are rewritten.

How to Forecast a Production Workload

Use provider usage logs or a representative test set to measure average uncached input, cached input, cache writes, and billed output. Forecast at low, expected, and high request volumes. Add retries, evaluation traffic, background jobs, cache storage, grounding, observability, and support plans where they apply. Averages are useful for budgets; percentiles are safer for capacity and worst-case controls.

Preset Pricing — Verified October 27, 2026

The presets use each provider's current first-party standard paid text-token prices: OpenAI's GPT-6 Astra, GPT-6.1 Sol, GPT-6.1 Terra and GPT-6 Luna, Anthropic's Claude Fable 5.1, Opus 5.5, Sonnet 5.5 and Haiku 5.5, and Google's Gemini 4 Argon, Gemini 3.8 Flash and Gemini 3.5 Flash-Lite. They deliberately exclude modes that cannot be compared honestly across providers. Gemini 4 Argon's price is promotional through November 30, 2026 and Gemini 3.8 Flash's through December 31, 2026; both double after that. OpenAI's prices apply to prompts up to 272K input tokens and Haiku 5.5's to prompts up to 100K. Use custom rates whenever the workload crosses a published boundary.

How This Is Calculated

The LLM API Cost Formula

For each request, multiply uncached input, cached input, cache-write, and output tokens by their separate prices per million tokens, then add any variable extras. Multiply request cost by daily request volume and active days for monthly variable spend, then add fixed monthly costs. Annual cost is the monthly estimate multiplied by twelve.

Formulas

Per request = (I × p_in + C × p_cached + W × p_write + O × p_out) ÷ 1,000,000 + other

Monthly = Per request × requests per day × days + fixed monthly cost

Annual = Monthly × 12

  • I, C, W, O uncached input, cached input, cache-write and output tokens per request (tokens)
  • p_in, p_cached, p_write, p_out the model's price for each kind of token (dollars per million tokens)

Assumptions and defaults

  • Preset prices are each provider's standard (not batch) per-million-token prices for the model, read on the provider's pricing and model pages. Source: OpenAI, Anthropic and Google API pricing pages, as of October 27, 2026.
  • Every request has the same token mix; cached input is billed at the cached rate and cache writes at the write rate. Source: Provider prompt-caching documentation, as of October 27, 2026.

Inputs it refuses or treats specially

  • Negative tokens, prices or request counts are refused; days per month must be a whole number from 1 to 31.
  • Long-context surcharges, tool calls and taxes are not added unless you enter them as other costs.

Worked example

GPT-6.1 Sol at $2 input, $0.10 cached input and $10 output per million tokens: 2,000 uncached input, 6,000 cached input and 500 output tokens cost $0.0096 a request. At 1,000 requests a day for 30 days that is $288 a month, $3,456 a year.

Checked by the test “matches the documented GPT-6.1 Sol default example (presets refreshed 2026-10-24)” in src/__tests__/rollout-batch-0001.test.ts.

Check it yourself

The calculation is the function calculateLlmApiCost(input: LlmApiCostInput): LlmApiCostResult | null in src/lib/calculators/llmApiCostCalculator.ts. These lines reproduce the example and print 288.00.

Show the JavaScript and Python

JavaScript

const perRequest = (2000 * 2       // uncached input
  + 6000 * 0.10                         // cached input
  + 500 * 10) / 1e6;                    // output
const monthly = perRequest * 1000 * 30;
console.log(monthly.toFixed(2));

Python

per_request = (2000 * 2          # uncached input
    + 6000 * 0.10                   # cached input
    + 500 * 10) / 1e6               # output
monthly = per_request * 1000 * 30
print(f"{monthly:.2f}")

I teach data analysis and SQL on The Data Science Tutor.

Sources

Last verified October 27, 2026.

11 automated tests cover this calculator. How calculations are documented and checked.

Frequently Asked Questions

How do I calculate the cost of one LLM API request?

Divide each token class by 1,000,000 and multiply by its provider rate, then add the results: uncached input, cached input, cache writes, and output. Add any metered tool or grounding charge separately. Output often costs more per token, so a smaller output can still dominate the request cost.

What is the difference between cached input and cache writes?

Cached input or cache reads reuse previously stored prompt content at a lower token rate. Cache writes create or refresh that stored content and may cost more than ordinary input. Providers also differ on cache lifetime and storage charges, so the calculator keeps reads, writes, and fixed storage costs separate.

Does the estimate include reasoning or thinking tokens?

Enter every billed output token reported by the provider, including reasoning or thinking tokens when they are included in output billing. The calculator prices the token counts you enter; it does not infer hidden token usage from prompt text.

Are batch, flex, fast, or long-context prices included?

No. Presets use comparable standard direct-API text pricing and clearly state their context limit or exclusions. Batch, flex, fast or priority processing, long context, regional processing, cloud marketplace markups, and free tiers require the matching custom rates.

Why can my provider invoice differ from this estimate?

Real workloads vary by request, tokenizers differ, and invoices may include retries, tools, grounding, media, storage, service tiers, regional uplifts, taxes, and minimum charges. Use measured usage averages and replace presets with the exact rates from your account for the closest forecast.