How do you calculate LLM API cost?
Multiply tokens by price. For each model call, take input tokens × the input price plus output tokens × the output price, both quoted per million tokens. Multiply by calls per task and tasks per month. Then apply the discounts each provider publishes: cached input billed at a fraction of the input price, cache writes at a premium, and batch calls at half price.
How this is calculatedthe formula, a worked example, benchmarks, assumptions and sources · about 11 min read
The LLM API cost formula
These are the steps the calculator runs for every model. Prices are per million tokens (MTok), so each call’s token sum is divided by 1,000,000.
- Calls a month
tasks a month × model calls per taskPer-day volume is multiplied by 365 ÷ 12 days.- Cache reads and writes
prefix = input tokens × repeated share; reads = prefix × hit rate; writes = prefix − readsA miss writes the prefix to the cache. Where the provider charges no separate write (Google’s implicit caching), the miss is billed as ordinary input.- Cost per call
(fresh input × input price + reads × cache-read price + writes × cache-write price + output × output price) ÷ 1,000,000The price band is picked from the full prompt length, so long-context rates apply to the whole call.- With batch
cost per call × (1 − batch share) + cost per call × 50% × batch shareAnthropic, OpenAI and Google all publish batch at 50% of each standard rate, cache rates included.- Monthly cost
calls a month × cost per call- Cost per 1,000 requests
cost per call × 1,000- Cost per task, AI against a person
calls per task × cost per call + review minutes × hourly cost ÷ 60, against minutes by hand × hourly cost ÷ 60- Hard savings
hours saved × hourly cost × share you stop paying for − the API billThe rest of the hours saved is time back, shown on its own and never as the headline.
How to use this calculator
- Start from one task, not one promptA task is the unit of work you care about: a ticket answered, an invoice checked, a document summarised. Enter how many you run a month or a day, and how many model calls each one takes. A single prompt is one call; an agent that plans, calls tools, and checks its work can take five to twenty.
- Count tokens for a typical callInput is everything you send: system prompt, instructions, tool definitions, retrieved documents, conversation so far, and tool results. Output includes reasoning tokens. Paste a sample prompt into the estimator for a rough count, then replace it with the usage numbers your API returns once you have them.
- Say how much of each prompt repeatsThe repeated share is the part that is identical from call to call and sits at the start of the prompt: system prompt, instructions, a fixed document. The hit rate is how often the cache still has it. Calls minutes apart hit often; calls hours apart miss unless you pay for a longer cache.
- Move work that can wait to batchBatch APIs return results within hours, not seconds, at half price. Overnight classification, back-office extraction, and evaluation runs usually qualify. Anything a customer is waiting on does not.
- Pick a tier, then compareChoose the lowest tier you think will do the job. The table flags the cheapest model at that tier or above. Click any row to price it in detail and see its cost per task against a person.
Worked example: 20,000 tasks a month on Claude Sonnet 5.5
The calculator’s default inputs, priced at Claude Sonnet 5.5’s list rates checked on 22 November 2026.
| Tasks per month | 20,000 |
|---|---|
| Model calls per task | 3 |
| Input tokens per call | 6,000 |
| Output tokens per call | 600 |
| Repeated prefix | 60% of input, 90% cache hit rate |
| Batch share | 0% |
| Prices (per MTok) | $2 input, $10 output, $0.10 cache read, $2.50 cache write |
| A person doing the task | 8 minutes at $45 an hour loaded; 1.5 minutes to review the AI’s work |
- Calls a month: 20,000 × 3 = 60,000.
- Without caching: (6,000 × $2 + 600 × $10) ÷ 1,000,000 = $0.018 a call, or $1,080 a month.
- With caching: the 3,600-token prefix is read from cache 3,240 tokens’ worth at $0.10 and rewritten 360 tokens’ worth at $2.50; 2,400 tokens stay at $2. That is $0.012 a call.
- Monthly bill: 60,000 × $0.012 = $721. Caching saves $359 a month. Cost per 1,000 requests: $12.02.
- Cost per task: $0.0361 in tokens, plus $1.13 of review time, is $1.16 against $6.00 by hand.
The model costs about $0.0361 per task, under 1% of what a person costs for the same task. The work frees about 2,167 hours a month. If you stop paying for 25% of those hours, hard savings are about $23,654 a month after the API bill. The other $73,125 a month is time back, not cash, until a cost actually stops. The cheapest model for the same workload is Claude Haiku 5.5 at $37.04 a month.
LLM API prices per million tokens, checked 22 November 2026
Standard pay-as-you-go list prices for text, in US dollars per million tokens, copied from each provider’s pricing page (linked in each row). Cache write shows the short-lived cache, then the long-lived one: Anthropic 5 minutes and 1 hour, OpenAI 30 minutes and 12 hours. Google’s implicit caching has no write charge. Batch is 50% of every rate for all three providers. Notes give long-context rates and, for promotions, the price until the promotion ends; the table and the calculator use the list price.
| Model | Input / output | Cache read | Cache write (short / long) | Batch input / output | Notes |
|---|---|---|---|---|---|
| Claude Fable 5.2 Anthropic · Frontier | $8 / $40 | $0.20 | $10 / $16 | $4 / $20 | None |
| Claude Opus 5.5 Anthropic · Frontier | $4 / $20 | $0.20 | $5 / $8 | $2 / $10 | None |
| Claude Sonnet 5.5 Anthropic · Balanced | $2 / $10 | $0.10 | $2.50 / $4 | $1 / $5 | None |
| Claude Haiku 5.5 Anthropic · Efficient | $0.10 / $0.50 | $0.01 | $0.125 / $0.20 | $0.05 / $0.25 | Prompts over 100K: $0.50 / $2.50 |
| GPT-6.2 Astra OpenAI · Frontier | $8 / $40 | $0.40 | $10 / $20 | $4 / $20 | Prompts over 272K: $16 / $60 |
| GPT-6.2 Sol OpenAI · Balanced | $2 / $10 | $0.10 | $2.50 / $5 | $1 / $5 | Prompts over 272K: $4 / $15 |
| GPT-6.1 Terra OpenAI · Efficient | $1 / $5 | $0.05 | $1.25 / $2.50 | $0.50 / $2.50 | Prompts over 272K: $2 / $7.50 |
| GPT-6 Luna OpenAI · Efficient | $0.10 / $0.50 | $0.01 | $0.125 / $0.25 | $0.05 / $0.25 | Prompts over 272K: $0.20 / $0.75 |
| Gemini 4 Carbon Google · Frontier | $4 / $20 | $0.20 | None | $2 / $10 | $2 / $10 until 30 Nov 2026 |
| Gemini 4 Argon Google · Frontier | $4 / $20 | $0.20 | None | $2 / $10 | $2 / $10 until 30 Nov 2026 |
| Gemini 4 Neon Google · Frontier | $3 / $15 | $0.15 | None | $1.50 / $7.50 | None |
| Gemini 4 Hydrogen Google · Balanced | $1.50 / $7.50 | $0.075 | None | $0.75 / $3.75 | None |
| Gemini 3.8 Flash Google · Balanced | $1.50 / $7.50 | $0.15 | None | $0.75 / $3.75 | $0.75 / $3.75 until 31 Dec 2026 |
| Gemini 3.5 Flash-Lite Google · Efficient | $0.30 / $2.50 | $0.03 | None | $0.15 / $1.25 | None |
Tier is Opswell’s grouping from each provider’s own description of the model, not a benchmark score. Where a provider runs a temporary promotion, the calculator uses the list price, because a budget usually runs longer than a promotion. Enterprise discounts, data-residency uplifts (Anthropic 1.1× for US-only inference, OpenAI 10% for regional processing), and fast or priority modes are not included.
Sources: Anthropic pricing; OpenAI pricing; Google pricing.
Claude API pricing, model by model
Anthropic’s standard list prices for the 4 Claude models in the calculator, read from its Claude API pricing page on 22 November 2026, in US dollars per million tokens (MTok). Open the calculator with Claude only to compare just these models on your own numbers.
- Claude Haiku 5.5 (efficient): $0.10 input and $0.50 output; cache read $0.01 (0.1× input); cache write $0.125 for 5 minutes or $0.20 for 1 hour; batch $0.05 / $0.25. Prompts over 100,000 tokens: $0.50 input, $2.50 output, $0.05 cache read, $0.625 / $1 cache writes.
- Claude Sonnet 5.5 (balanced): $2 input and $10 output; cache read $0.10 (0.05× input); cache write $2.50 for 5 minutes or $4 for 1 hour; batch $1 / $5. One rate across the full 1M-token context window.
- Claude Opus 5.5 (frontier): $4 input and $20 output; cache read $0.20 (0.05× input); cache write $5 for 5 minutes or $8 for 1 hour; batch $2 / $10. One rate across the full 1M-token context window.
- Claude Fable 5.2 (frontier): $8 input and $40 output; cache read $0.20 (0.025× input); cache write $10 for 5 minutes or $16 for 1 hour; batch $4 / $20. One rate across the full 1M-token context window.
What prompt caching, batch, and long context save on Claude
On the calculator’s default workload (60,000 calls a month, 6,000 input and 600 output tokens a call, 60% of each prompt repeated, 90% cache hits, 5-minute writes, no batch), the Claude bill runs from $37.04 on Claude Haiku 5.5 to $2,847 on Claude Fable 5.2 a month: Claude Haiku 5.5 $37.04, Claude Sonnet 5.5 $721, Claude Opus 5.5 $1,443, Claude Fable 5.2 $2,847.
- Prompt caching. A 5-minute cache write costs 1.25× base input and a 1-hour write 2×; a cache hit costs between 0.025× and 0.1× base input, depending on the model. On Claude Sonnet 5.5 in the default workload, caching saves $359 a month, and switching to 1-hour writes would add $32.40 a month unless it lifted the hit rate to 94%. The 1-hour cache is for prefixes reused less often than every 5 minutes.
- Batch API. 50% off input and output, and the caching multipliers stack with it. Sending every call through batch would take Claude Sonnet 5.5’s default bill from $721 to $361 a month.
- Long context. Claude Haiku 5.5 charges higher rates for a request whose prompt is over 100,000 tokens, counting cache reads and writes: $0.50 input instead of $0.10, 5× the standard rate. Claude Fable 5.2, Claude Opus 5.5 and Claude Sonnet 5.5 bill the full 1M-token context window at standard rates.
- Not in the calculator. US-only inference (inference_geo: "us") adds 1.1× to every rate. Not modelled here.
How tokens are counted
Providers bill by the token, a chunk of text that is often part of a word. OpenAI’s rule of thumb is that one token is about 4 characters or 0.75 words of English. Google says a token is about 4 characters for Gemini models, and 100 tokens is about 60–80 English words. The calculator’s estimator uses the 4-character rule, so treat its count as a rough guide, not a bill.
The same text is a different number of tokens on different models. Anthropic says Claude 4.7 and later models use a tokenizer that produces about 30% more tokens for the same text than earlier Claude models. For an exact count, use the provider’s token-counting endpoint or the usage numbers each API response returns.
- Input is everything sent on each call: system prompt, tool definitions, retrieved documents, conversation history, and tool results. In a conversation or agent loop, the whole history is sent again on every call.
- Output is everything the model writes. Google states that its output prices include thinking tokens.
- Tool use adds tokens you did not write. Anthropic adds a tool-use system prompt to any request with tools, 286 tokens on Claude Opus 5.5, on top of the tool definitions themselves.
How prompt caching is priced
Caching lets a provider reuse the processed start of a prompt that it has seen recently. You pay a reduced rate for the part read from cache. On Anthropic and on newer OpenAI models you also pay a premium the first time the prefix is written. That is why caching only saves money when the same prefix is read often enough.
- Anthropic: a 5-minute cache write costs 1.25× base input and a 1-hour write costs 2×. Cache hits cost 0.1× base input on most models, 0.05× on Claude Opus 5.5 and Claude Sonnet 5.5, and 0.025× on Claude Fable 5.2. Anthropic says the 5-minute cache pays for itself after one read and the 1-hour cache after two. Source.
- OpenAI: from GPT-5.6 on, a cache write costs 1.25× uncached input for the default 30-minute lifetime, or 2.5× for 12 hours in the Responses API. Reads cost 0.05× on GPT-6.2 Astra, GPT-6.2 Sol and GPT-6.1 Terra, and 0.1× on GPT-6 Luna. Prefixes under 1,024 tokens are not cached. Source.
- Google: implicit caching is on by default for Gemini 2.5 and newer. Hits are billed at the context caching price and there is no write charge, so a miss costs the same as not caching. Gemini 4 models support implicit caching only, with a 4,096-token minimum. Source.
When batch pricing is worth it
All three providers run a batch API at 50% of their standard rates: you submit many requests at once and collect the results later. It suits work nobody is waiting on: overnight document processing, classification backlogs, enrichment, and evaluation runs.
Batch and caching stack. Anthropic says its caching multipliers apply on top of the batch discount, and OpenAI and Google both list batch prices for cached input. A repeated system prompt sent through batch is the cheapest way to run high-volume work on any of these models.
Long-context pricing
Some models charge more per token once a single prompt passes a length threshold, and the higher rate then applies to the whole request, including the tokens under the line.
- Claude Haiku 5.5 charges higher rates for a prompt over 100,000 tokens, counting cache reads and writes. Other Claude 4.6 and later models bill the full 1M-token window at standard rates.
- OpenAI charges long-context rates for requests with more than 272K input tokens: input and cache rates double and output costs 1.5×, for the full request.
- Gemini 4 and Gemini 3.8 Flash list one rate on the Gemini Developer API pricing page, with no long-context tier.
Choosing a model tier
Price per token is not price per task. A frontier model that gets a task right in one call can cost less than an efficient model that needs three attempts and a person to fix the result. Start with the cheapest model that passes a test on 50 to 100 of your own examples, and move up a tier only where it fails.
The tiers here follow each provider’s own description: frontier for its most capable models, balanced for everyday production work, efficient for high-volume, cost-sensitive work. A common pattern is to route by task: an efficient model triages and extracts, a balanced or frontier model handles the cases that need judgement.
Hidden costs that move the bill
Most surprises on an LLM invoice come from tokens nobody planned for. Check these before you budget.
- Long system prompts sent on every call. A 5,000-token instruction block on 100,000 calls is 500 million input tokens a month. Cache it.
- Agent loops. Each step re-sends the conversation so far, so tokens grow with every turn. Enter the real number of calls per task.
- Retries and re-runs. A failed or rejected answer that is sent again is paid for twice. Add retries to calls per task.
- Tool fees. Web search on the Claude API costs $10 per 1,000 searches plus the tokens of the results. Grounding with Google Search on Gemini 3 and newer is free for 5,000 requests a month, then $14 per 1,000.
- Speed and residency. Anthropic’s fast mode on Claude Opus 5.5 costs $8 input and $40 output per MTok, twice the standard rate. OpenAI’s Fast mode costs twice its Standard rate. US-only or regional processing adds 10% on both.
- Output length. At standard rates, every model listed here charges at least five times as much for output as for input. Asking for shorter answers is often the cheapest saving available.
Cost per task against a person doing it
The unit-economics panel puts the model’s cost per task next to what the same task costs in a person’s time, including the minutes someone still spends checking the AI’s work. On most text tasks the token cost is a small fraction of the labour cost, which is why the review time usually matters more than the model price.
Hours saved are time back, not savings. They become hard savings only when a cost stops: a vacancy you do not refill, overtime or contractor spend you cut, or volume growth you absorb without hiring. The calculator asks what share you would actually take out of the budget, subtracts the API bill, and shows the rest as time back.
Assumptions and limits
- Prices are each provider’s standard list prices for text input and output, checked on 22 November 2026, in US dollars. They change; the date and source links are shown under the calculator.
- Where a provider runs a promotion, the calculator uses the list price and shows the promotional price in a note.
- Token counts are averages per call. The long-context band is chosen from the average prompt length, so a workload with a mix of short and very long prompts should be priced as two workloads.
- Cache writes use the short-lived cache by default (Anthropic 5 minutes, OpenAI 30 minutes). The long-lived option uses Anthropic’s 1-hour and OpenAI’s 12-hour rates. Google’s implicit caching has no write charge.
- Not included: Gemini explicit-cache storage fees, image, audio and video tokens, tool fees such as web search, fine-tuning, data-residency uplifts, fast or priority modes, and negotiated discounts.
- The token estimator divides characters by 4. It is an estimate, not a count from any provider’s tokenizer.
- Human cost per task uses the loaded hourly cost you enter. Freed hours count as hard savings only for the share you say you would stop paying for.
Terms used on this page
- Token
- The unit providers bill by: a chunk of text, often part of a word.
- MTok
- One million tokens. A price of $2 / MTok is $2 for every million tokens.
- Cache hit (cache read)
- Part of a prompt the provider has seen recently and reuses, billed at a reduced rate.
- Cache write
- Storing a prompt prefix so later calls can reuse it. Anthropic and newer OpenAI models charge a premium for it.
- Batch API
- Asynchronous processing: results come back later, at 50% of the standard rates.
- Long-context pricing
- Higher per-token rates for a request whose prompt passes a length threshold.
- Time back
- Staff time saved by automation. It is not cash until a cost stops.
Sources
- Claude API pricing · Anthropic, 2026
- Claude models overview · Anthropic, 2026
- OpenAI API pricing · OpenAI, 2026
- OpenAI prompt caching guide · OpenAI, 2026
- OpenAI models · OpenAI, 2026
- Gemini Developer API pricing · Google, 2026
- Gemini API context caching · Google, 2026
- Gemini API: understand and count tokens · Google, 2026
- OpenAI API key concepts: tokens · OpenAI, 2026
Common questions
How much does the Claude API cost?
Per million tokens, from Anthropic’s pricing page on 22 November 2026: Claude Haiku 5.5 $0.10 input and $0.50 output (prompts up to 100,000 tokens; $0.50 and $2.50 above), Claude Sonnet 5.5 $2 input and $10 output, Claude Opus 5.5 $4 input and $20 output, and Claude Fable 5.2 $8 input and $40 output. The Batch API is 50% off, a cache hit costs 0.025× to 0.1× base input, and a cache write costs 1.25× base input for 5 minutes or 2× for 1 hour. For 60,000 calls a month of 6,000 input and 600 output tokens, with 60% of each prompt cached at a 90% hit rate, that is $37.04 on Claude Haiku 5.5 to $2,847 on Claude Fable 5.2 a month.
How do I estimate Claude API cost for my own workload?
Open the calculator with Claude only. Enter tasks a month, calls per task, and tokens in and out per call. The table compares every Claude model at that volume, and the savings panel shows what prompt caching (5-minute or 1-hour writes), the Batch API, and the long-context rate change on your numbers. Share the result and the link keeps the Claude-only view.
How much does the OpenAI API cost per 1,000 tokens?
OpenAI quotes prices per million tokens; divide by 1,000 for the price per 1,000 tokens. Checked on 22 November 2026, GPT-6.2 Sol costs $2 per million input tokens and $10 per million output tokens, so $0.002 and $0.01 per 1,000. GPT-6 Luna costs $0.10 and $0.50 per million; GPT-6.2 Astra $8 and $40.
What is the cheapest LLM API?
Of the models priced here, Claude Haiku 5.5 and GPT-6 Luna have the lowest list prices at $0.10 input and $0.50 output per million tokens. The cheapest model for your workload depends on your mix of input, output, and cached tokens, and on whether the model does the task well enough, so compare on your own numbers.
How many tokens is a word or a page?
For English, OpenAI’s rule of thumb is about 0.75 words per token, and Google’s is 60–80 words per 100 tokens. A 500-word page is therefore roughly 600–850 tokens. Code, tables, and other languages usually take more tokens per word, and Claude’s current tokenizer produces more tokens for the same text than earlier Claude models.
Does prompt caching always save money?
No. On Anthropic and newer OpenAI models a cache write costs more than ordinary input, so a prefix that is rarely reused costs more with caching than without. Anthropic says the 5-minute cache pays for itself after one read and the 1-hour cache after two. Google’s implicit caching has no write charge, so it never costs more. The calculator shows a negative saving when your hit rate is too low.
Can I combine batch and prompt caching?
Yes, on all three providers. Anthropic says its caching multipliers stack with the batch discount, and OpenAI and Google both publish batch prices for cached input. The calculator applies caching first and then the batch discount to the share of calls you send through batch.
Why does the calculator use list prices instead of promotions?
Because promotions end and budgets do not. Where a provider has a dated promotion, such as Gemini 4 Carbon until 30 November 2026 or Gemini 3.8 Flash until 31 December 2026, the calculator prices at the list rate and shows the promotional price in a note.
Are these prices current?
They were copied from each provider’s pricing page on 22 November 2026, and the date and links are shown under the calculator. Providers change prices and release models often, so check the linked page before you sign a budget. Negotiated enterprise discounts are not included.
Can I embed this calculator on my site?
Yes. Use “Embed this calculator” under the tool for an iframe snippet. It runs in the visitor’s browser, sends nothing to an LLM, and stores nothing.
Read next
- Which AI dollars are real?Hard savings, revenue gained and hours saved are three different kinds of money. A business case that adds them together will not get past the CFO.
- How to size AI ROI before you buildSkip the open-ended pilot. Rank the jobs, size the top five from numbers you already track, and build only the one that pays.
- Why AI pilots stall, and how to get one into productionA pilot with no baseline, no owner and no end date does not fail. It never finishes. Set those three before you build and two weeks gives you a decision.
- How Opswell tools count dollarsThe rules behind every number on this page
Reviewed November 22, 2026 by Maxwell Kroll, founder of Opswell. The math runs in your browser. A Python copy of the same engine runs on our server, and we test that both give the same answer on every release.