Skip to content
KazamTools

AI API Cost Calculator

Price your workload on every major LLM API, with prompt caching and batch discounts, from dated official prices.

Workload

Prompt, system message and any documents.

Reasoning models also bill thinking as output.

Monthly = daily × 30.

Prompt caching and discounts
%

For example a long system prompt reused on every request.

Requests that (re)write the cache, e.g. 24 if it expires once an hour.

Cache lifetime (Anthropic and newest OpenAI models)

Providers

Cheapest of 28: Ministral 3 8B at $11.25 a month ($0.000375 per request). Most expensive: GPT-6 Astra at $1,350.

Cost per model, cheapest first
CompareModelPer requestPer dayPer month
Ministral 3 8BMistral AI$0.000375$0.375$11.25
Claude Haiku 5.5Anthropic$0.00045$0.45$13.50
GPT-6 LunaOpenAI$0.00045$0.45$13.50
Mistral Small 4Mistral AI$0.0006$0.60$18.00
GPT-5.4 nanoOpenAI$0.001025$1.03$30.75
Codestral 25.08Mistral AI$0.00105$1.05$31.50
DeepSeek V4.1 FlashDeepSeek$0.0012$1.20$36.00
Gemini 3.1 Flash-LiteGoogle (Gemini API)$0.00125$1.25$37.50
Mistral Large 3Mistral AI$0.00175$1.75$52.50
Gemini 3.5 Flash-LiteGoogle (Gemini API)$0.00185$1.85$55.50
Grok Build 0.1 (coding)xAI$0.003$3.00$90.00
Gemini 3.8 FlashGoogle (Gemini API)From 1 Jan 2027: $202.50/month$0.003375$3.38$101.25
GPT-5.4 miniOpenAI$0.00375$3.75$112.50
Grok 4.3xAI$0.00375$3.75$112.50
Grok 4.20 (non-reasoning)xAI$0.00375$3.75$112.50
DeepSeek V4 ProDeepSeek$0.00462$4.62$138.60
Mistral Large 4Mistral AI · preview$0.00481$4.81$144.30
Mistral Medium 3.5Mistral AI$0.00675$6.75$202.50
Grok 4.7xAI$0.007$7.00$210.00
Claude Sonnet 5.5Anthropic$0.009$9.00$270.00
GPT-6.1 SolOpenAI$0.009$9.00$270.00
Gemini 4 ArgonGoogle (Gemini API)From 1 Dec 2026: $540.00/month$0.009$9.00$270.00
GPT-5.6 TerraOpenAI$0.01$10.00$300.00
Gemini 3.1 Pro (preview)Google (Gemini API) · preview$0.01$10.00$300.00
Claude Opus 5.5Anthropic$0.018$18.00$540.00
GPT-5.5OpenAI$0.025$25.00$750.00
Claude Fable 5.1Anthropic$0.045$45.00$1,350
GPT-6 AstraOpenAI$0.045$45.00$1,350

Tick up to 4 models to compare the breakdown side by side.

Not sure how many tokens your prompt has? Paste it into the LLM token counter, then check it fits with the context window checker.

Price table (USD per 1M tokens)

Standard pay-as-you-go prices, read from each provider’s official pages on 22 Oct 2026. Values marked * could not be confirmed on an official page.

Anthropic · checked 22 Oct 2026
ModelInputCachedCache writeOutputContextMax output
Claude Fable 5.1claude-fable-5-1$10.00$0.25$12.50$20.00 long$50.001,000,000128,000
Claude Opus 5.5claude-opus-5-5$4.00$0.20$5.00$8.00 long$20.001,000,000128,000
Claude Sonnet 5.5claude-sonnet-5-5$2.00$0.10$2.50$4.00 long$10.001,000,000128,000
Claude Haiku 5.5claude-haiku-5-5Prompts of 100,001+ tokens: $0.50 in / $2.50 out$0.10$0.01$0.125$0.20 long$0.501,000,000128,000
Claude Sonnet 4.6claude-sonnet-4-6Uses the older Claude tokenizer, so the same text counts about 30% fewer tokens than on Claude 4.7 and later.$3.00$0.30$3.75$6.00 long$15.001,000,000128,000
Claude Haiku 4.5claude-haiku-4-5Uses the older Claude tokenizer, so the same text counts about 30% fewer tokens than on Claude 4.7 and later.$1.00$0.10$1.25$2.00 long$5.00200,00064,000
  • Batch: 50% off.
  • Cache writes cost 1.25× the input price (5-minute lifetime) or 2× (1-hour lifetime). Cache hits cost 0.1× on most models, 0.05× on Opus 5.5 and Sonnet 5.5, and 0.025× on Fable 5.1.
  • Batch (50% off) stacks with prompt caching.
  • Claude 4.6 and later models (except Haiku 5.5) bill the full 1M context at standard rates. Haiku 5.5 costs 5× for prompts over 100,000 tokens.
  • US-only inference (inference_geo) adds 10%.
  • Sources: Claude pricing, Claude models overview
OpenAI · checked 22 Oct 2026
ModelInputCachedCache writeOutputContextMax output
GPT-6 Astragpt-6-astraPrompts of 272,001+ tokens: $20.00 in / $75.00 out$10.00$1.00$12.50$25.00 long$50.00922,000input; 1,050,000 total128,000
GPT-6.1 Solgpt-6.1-solPrompts of 272,001+ tokens: $4.00 in / $15.00 out$2.00$0.10$2.50$5.00 long$10.00922,000input; 1,050,000 total128,000
GPT-6 Lunagpt-6-lunaPrompts of 272,001+ tokens: $0.20 in / $0.75 out$0.10$0.01$0.125$0.25 long$0.50922,000input; 1,050,000 total128,000
GPT-5.6 Terragpt-5.6-terraPrompts of 272,001+ tokens: $4.00 in / $18.00 out$2.00$0.20$2.50$5.00 long$12.00922,000input; 1,050,000 total128,000
GPT-5.5gpt-5.5Prompts of 272,001+ tokens: $10.00 in / $45.00 out$5.00$0.50–$30.001,050,000128,000
GPT-5.4 minigpt-5.4-mini$0.75$0.075–$4.50272,000input; 400,000 total128,000
GPT-5.4 nanogpt-5.4-nano$0.20$0.02–$1.25272,000input; 400,000 total128,000
GPT-4.1gpt-4.1$2.00$0.50–$8.001,047,57632,768
GPT-4o minigpt-4o-mini$0.15$0.075–$0.60128,00016,384
o4-minio4-mini$1.10$0.275–$4.40200,000100,000
  • Batch: 50% off.
  • Batch and Flex processing cost 50% less than Standard.
  • For GPT-6.x, GPT-5.6 and GPT-5.5, prompts over 272K tokens are billed at 2× input and 1.5× output for the whole request.
  • Only GPT-6.x and GPT-5.6 list a separate cache-write price; on other models cache writes cost the normal input price.
  • Regional processing (data residency) adds 10%.
  • Sources: OpenAI API pricing, OpenAI models
Google (Gemini API) · checked 22 Oct 2026
ModelInputCachedCache writeOutputContextMax output
Gemini 4 Argongemini-4-argonFrom 1 Dec 2026: $4.00 / $20.00Input and output share one 1,048,576-token window. Output is 65,536 tokens by default (more with “long decode”). Implicit caching only.$2.00$0.10–$10.001,048,57665,536
Gemini 3.8 Flashgemini-3.8-flashFrom 1 Jan 2027: $1.50 / $7.50$0.75$0.075–$3.751,048,57665,536
Gemini 3.1 Pro (preview)gemini-3.1-pro-previewPrompts of 200,001+ tokens: $4.00 in / $18.00 out$2.00$0.20–$12.001,048,57665,536
Gemini 3.5 Flash-Litegemini-3.5-flash-lite$0.30$0.03–$2.501,048,57665,536
Gemini 3.1 Flash-Litegemini-3.1-flash-lite$0.25$0.025–$1.501,048,57665,536
Gemini 2.5 Progemini-2.5-proPrompts of 200,001+ tokens: $2.50 in / $15.00 outAvailable only to accounts that used it before.$1.25$0.125–$10.001,048,576*65,536*
Gemini 2.5 Flashgemini-2.5-flashAvailable only to accounts that used it before.$0.30$0.03–$2.501,048,57665,536
  • Batch: 50% off.
  • Batch API is 50% off. Output prices include thinking tokens.
  • Explicit context caching also charges storage per million tokens per hour, which this calculator does not include.
  • Price increases are already scheduled: Gemini 4 Argon doubles on 1 December 2026, Gemini 3.8 Flash on 1 January 2027.
  • Sources: Gemini API pricing, Gemini models
Mistral AI · checked 22 Oct 2026
ModelInputCachedCache writeOutputContextMax output
Mistral Large 4mistral-large-4Public preview. Some sites report a temporary launch discount; the model card shows these list prices.$1.36$0.14–$4.181,000,000n/p
Mistral Large 3mistral-large-2512$0.50––$1.50256,000n/p
Mistral Medium 3.5mistral-medium-3-5$1.50––$7.50256,000n/p
Mistral Small 4mistral-small-2603$0.15––$0.60256,000n/p
Codestral 25.08codestral-2508$0.30––$0.90128,000n/p
Ministral 3 8Bministral-8b-2512$0.15––$0.15256,000n/p
  • Batch: 50% off (stated as a general rule, not printed per model)*.
  • Mistral says batch processing cuts the price by 50% and cached input by up to 90%, but prints a cached price only for Mistral Large 4.
  • Mistral does not publish maximum output lengths on its model cards.
  • Sources: Mistral pricing, Mistral model cards
DeepSeek · checked 22 Oct 2026
ModelInputCachedCache writeOutputContextMax output
DeepSeek V4.1 Flashdeepseek-flash$0.30$0.006–$1.201,000,000384,000
DeepSeek V4 Prodeepseek-v4-pro$1.32$0.044–$3.961,000,000384,000
  • Batch: no batch API.
  • Prices shown are peak rates. Off-peak rates are half: peak is 01:00–04:00 and 06:00–10:00 UTC on weekdays (excluding Chinese public holidays); every other hour is off-peak.
  • Caching is automatic: repeated prompt prefixes are billed at the cache-hit price. There is no batch API.
  • Sources: DeepSeek models and pricing
xAI · checked 22 Oct 2026
ModelInputCachedCache writeOutputContextMax output
Grok 4.7grok-4.7Prompts of 200,000+ tokens: $4.00 in / $12.00 out$2.00$0.50–$6.00500,000n/p
Grok 4.3grok-4.3Prompts of 200,000+ tokens: $2.50 in / $5.00 out$1.25$0.20–$2.501,000,000n/p
Grok 4.20 (non-reasoning)grok-4.20-0309-non-reasoningPrompts of 200,000+ tokens: $2.50 in / $5.00 out$1.25$0.20–$2.501,000,000n/p
Grok Build 0.1 (coding)grok-build-0.1Prompts of 200,000+ tokens: $2.00 in / $4.00 out$1.00$0.20–$2.00256,000n/p
  • Batch: 20% off.
  • When a prompt reaches 200K tokens, every token in that request is billed at the higher long-context rate.
  • The Batch API is 20% off (not 50%) and is not available for Grok Build.
  • xAI does not publish maximum output lengths.
  • Sources: xAI models and pricing

n/p = not published by the provider. Prices exclude tax, tool calls (such as web search) and regional surcharges.

How to use the AI API Cost Calculator

  1. 1Enter the input and output tokens of a typical request (or come here from the LLM token counter).
  2. 2Enter how many requests you make per day.
  3. 3Optionally set the share of input served from the prompt cache, and tick Batch for asynchronous jobs.
  4. 4Compare the daily and monthly cost of every model, cheapest first, and open a model for the full breakdown.

How LLM API pricing works

Every major AI API bills by the token. Prices are quoted in US dollars per 1 million tokens, with separate prices for the text you send (input) and the text the model writes (output). For one request:

cost = (input tokens × input price + output tokens × output price) ÷ 1,000,000

Three things change that simple formula, and the calculator handles all of them:

  • Prompt caching. If the start of your prompt (a long system prompt, a document, a list of tools) is the same on every request, providers can cache it. Cached tokens cost a fraction of the normal input price: 10% on most models, 5% on Claude Opus 5.5 and Sonnet 5.5, and about 2% on DeepSeek. Anthropic and the newest OpenAI models charge a little more than the input price to write the cache, so you enter how often the cache is rewritten each day.
  • Batch processing. Jobs that can wait up to 24 hours cost 50% less at Anthropic, OpenAI, Google and Mistral, and 20% less at xAI. DeepSeek has no batch API but charges half price outside its peak hours.
  • Long prompts. Some models switch the whole request to higher prices once the prompt passes a threshold: 272,000 tokens on GPT-5.5 and GPT-6 models, 200,000 on Gemini Pro and Grok, and 100,000 on Claude Haiku 5.5.

The monthly figure is the daily cost × 30.

Where the prices come from

Each price was read from the provider’s own pricing or model page on the date shown in the price table, and each provider’s section links to its sources. We don’t copy prices from aggregator sites. Where a provider states a rule but doesn’t print a number per model (Mistral’s 50% batch discount, for example), the table marks it with an asterisk. Gemini has scheduled price increases, Gemini 4 Argon from 1 December 2026 and Gemini 3.8 Flash from 1 January 2027, so the comparison shows the future monthly cost too.

Worked examples

1. A support chatbot. Each request has a 2,500-token system prompt, 500 tokens of conversation and 400 output tokens, with 5,000 requests a day.

Model No caching 83% cached, cache rewritten 24×/day
Claude Sonnet 5.5 $50.00/day ($1,500/month) $26.39/day ($792/month)
Gemini 3.8 Flash $18.75/day ($563/month) $10.35/day ($311/month)
DeepSeek V4.1 Flash $6.90/day ($207/month) $3.24/day ($97/month)

For Sonnet 5.5 the cached version works out like this: 500 fresh tokens × 5,000 × $2 = $5.00, plus 2,500 cached tokens × 4,976 cache reads × $0.10 = $1.24, plus 24 cache writes × 2,500 × $2.50 = $0.15, plus output 400 × 5,000 × $10 = $20.00 (each ÷ 1,000,000). Caching cuts the bill by almost half, and output becomes the largest cost.

2. A nightly batch job. Summarising 10,000 documents a day at 8,000 input and 300 output tokens on Claude Haiku 5.5 costs $8.00 + $1.50 = $9.50 a day. Through the Batch API it is $4.75 a day, or $142.50 a month.

3. Crossing a long-context threshold. One GPT-5.5 request with a 272,000-token prompt and 2,000 output tokens costs 272,000 × $5 + 2,000 × $30 (each ÷ 1,000,000) = $1.36 + $0.06 = $1.42. Add 28,000 tokens to the prompt and the request crosses the threshold: 300,000 × $10 + 2,000 × $45 = $3.00 + $0.09 = $3.09. That is only 10% more input but more than twice the price, because every token in the request is billed at the higher rate.

Tips to cut your API bill

  1. Measure real token counts instead of guessing from word counts. Use the LLM token counter; its “Estimate the cost” button fills in this calculator.
  2. Put stable content first so it can be cached: instructions, tool definitions and reference documents before the user’s question.
  3. Cap the output. Output is usually 4–8 times the price of input, and reasoning models bill their hidden thinking as output too.
  4. Move non-urgent work to batch. Evaluations, nightly reports and bulk classification rarely need an answer in seconds.
  5. Send less text. Clean Markdown is much shorter than HTML or raw PDF text. Convert files with document to Markdown and check the result with the context window checker.
  6. Try a smaller model on a sample of real requests before deciding. A small model can cost a tenth as much as a flagship.

What the calculator leaves out

Token charges are usually most of the bill, but not all of it. Web search and other tool calls, explicit cache storage on Gemini (billed per hour), image and audio inputs, data-residency surcharges (about 10% at Anthropic and OpenAI), fine-tuning and sales tax are not included. Free tiers and enterprise discounts are not included either. Treat the result as a planning estimate, and confirm current prices on the provider’s page before you sign off a budget.

Cite this calculator

Using this calculator in an essay, report or article? Copy a ready-made reference. Check your teacher's or publisher's style guide for small differences.

APA
KazamTools. (2026, October 22). AI API cost calculator. Retrieved October 30, 2026, from https://kazamtools.com/developer/ai-api-cost-calculator/
MLA
"AI API Cost Calculator." KazamTools, 22 Oct. 2026, https://kazamtools.com/developer/ai-api-cost-calculator/. Accessed 30 Oct. 2026.
Chicago
KazamTools. "AI API Cost Calculator." Last modified October 22, 2026. Accessed October 30, 2026. https://kazamtools.com/developer/ai-api-cost-calculator/.
Plain link
AI API Cost Calculator (KazamTools): https://kazamtools.com/developer/ai-api-cost-calculator/
HTML link
<a href="https://kazamtools.com/developer/ai-api-cost-calculator/">AI API cost calculator</a> by KazamTools

Frequently asked questions

How is LLM API cost calculated?

Cost = input tokens × input price + output tokens × output price, with prices quoted per 1 million tokens. Cached input tokens are billed at the cheaper cache price, and batch jobs get a discount.

Where do the prices come from, and how current are they?

Every price was read from the provider’s official pricing or model page on the date shown above the table, with a link to the source. Prices change often, so check the source before you commit to a budget.

How much does prompt caching save?

Cache reads usually cost 5–10% of the normal input price (DeepSeek about 2%). Anthropic and the newest OpenAI models charge a little extra to write the cache, so caching pays off when the same prefix is reused many times.

How much cheaper is the Batch API?

Anthropic, OpenAI, Google and Mistral take 50% off batch requests, which return within 24 hours. xAI’s batch discount is 20%, and DeepSeek has no batch API but halves its prices outside peak hours.

Why do output tokens cost more than input tokens?

Each output token is generated one step at a time, while input tokens are processed in parallel. Output is typically 4–8 times the input price, and reasoning models also bill their hidden thinking tokens as output.

Does this include taxes or other fees?

No. It covers token charges only. Tool calls such as web search, data-residency surcharges, storage for explicit caches and sales tax are extra.

Was this tool helpful?