LLM API Cost Calculator

Pick a model (or enter custom pricing), enter input and output tokens per request and your daily request volume, and get an estimated monthly API bill — with the input vs output cost split and the same workload priced across every major GPT, Claude, and Gemini model. Pricing is as of July 2026.

Put this calculator on your website — free

Copy one snippet and give your visitors a working LLM API Cost Calculator.

How LLM API pricing works

Large language model APIs bill by the token, not the request. A token is a chunk of text — roughly 4 characters or 0.75 words of English, so about 1,000 tokens per 750 words (code and non-English text run higher, and tokenizers differ: Anthropic notes its newest models tokenize the same text into ~30% more tokens than its earlier ones). Every model has two prices, quoted per 1 million tokens: one for input (everything you send — system prompt, retrieved context, the user's message, and any prior chat turns) and one for output (the model's reply).

Output is almost always the pricier of the two — typically 3× to 6× the input rate — because the model generates it one token at a time, while your input is processed in parallel. That single fact drives most of the surprises in a monthly bill: a short answer can cost more than a long prompt. The rates embedded here were verified in July 2026 against OpenAI's API pricing page, Anthropic's pricing documentation, and Google's Gemini API pricing page; if your model or negotiated rate isn't listed, pick "Custom pricing" and enter your own numbers.

The formula

Monthly cost = (Tin × Pin + Tout × Pout) ÷ 1,000,000 × R × 30.44

Tin and Tout are input and output tokens per request; Pin and Pout are the model's prices per million tokens; R is requests per day. We use a 30.44-day month (365.25 ÷ 12, the average calendar month) so monthly and annual figures line up. These are standard pay-as-you-go rates: batch and caching discounts are deliberately excluded (see below), so treat the result as your ceiling, not your floor.

Worked example

A product assistant sends 1,500 input tokens (system prompt + context + the user's question) and gets back a 500-token answer, over 1,000 requests a day.

On Claude Sonnet 4.6 ($3 / $15 per 1M): (1,500 × $3 + 500 × $15) ÷ 1,000,000 = $0.012 per request → × 1,000 × 30.44 = $365.28 / month. Note the output is $0.0075 of that $0.012 — 62.5% of the cost from 25% of the tokens.

The same workload runs about $10.65 / month on Gemini 2.5 Flash-Lite, $121.76 on Claude Haiku 4.5, and $1,217.60 on Claude Fable 5 — a >100× spread for identical traffic. Model choice is the second-biggest lever after output length.

The cost levers that actually move the bill

Output length is the big one. Because output is priced highest and you pay per generated token, trimming a verbose reply from 800 to 400 tokens roughly halves the output cost — often a bigger saving than any prompt tweak. Ask for concise answers, set a sensible max_tokens, and avoid letting the model pad. Model choice is second: the spread between the cheapest and priciest models on the same workload can be 20× to 100×, so route easy calls to a small model and reserve a frontier model for the hard ones. Batch and caching are the third lever, and this calculator deliberately ignores them: prompt caching bills repeated system prompts and context at roughly 10% of the input rate, and batch APIs cut both input and output by about 50% for work that can wait — combined, stable high-volume workloads routinely save 50–90% versus the standard rates shown here. If you want to sanity-check a percentage saving, the percentage calculator handles the arithmetic.

The hidden costs that break naive estimates

Three things routinely make a real bill exceed the back-of-envelope figure. Retries: timeouts and rate-limit backoffs mean some requests run more than once — budget a few percent of overhead. System prompts count as input on every single call: a 1,500-token system prompt sent 1,000 times a day is 1.5 million input tokens daily before the user types anything — exactly what prompt caching exists to defray. Context growth in multi-turn chats: because you resend the whole conversation each turn, a 10-turn chat pays for early messages 10 times over, so a flat per-request estimate undercounts long sessions. One more thing money can't fix: rate limits are separate from cost. Every provider caps requests and tokens per minute by usage tier, so a workload you can afford is not automatically a workload you're allowed to run — check the tier limits before promising throughput.

Build vs. API: the honest breakeven

At some monthly bill, self-hosting an open-weight model starts to look tempting. The honest math: a single always-on GPU server capable of serving a decent model rents for more per month than most of the workloads people run through this calculator, and that's before an engineer's time to run it. Self-hosting wins on unit cost only when you can keep expensive hardware busy around the clock — sustained, high, predictable volume — or when the small models you'd run are dramatically cheaper than the frontier model you'd otherwise call. Below that, the API's pay-per-token model is the discount. The better reasons to self-host are privacy, latency control, and independence, not the invoice; to compare a monthly bill against an upfront hardware spend properly, the time value of money calculator is the right next stop.

The vintage caveat: prices move

This calculator reflects published standard rates as of July 2026, verified against OpenAI's API pricing page, Anthropic's pricing documentation, and Google's Gemini API pricing page. LLM pricing is unusually volatile — new model tiers launch monthly, introductory discounts expire, and per-token rates get cut as capacity grows. Two specific things to check before you commit a budget: introductory pricing (Anthropic's Claude Sonnet 5 runs at its $2 / $10 intro rate only through 31 August 2026, then reverts to $3 / $15) and long-context surcharges (Google's Gemini Pro models charge roughly double per token once a prompt exceeds 200K tokens). Always re-check the provider's current pricing page before budgeting a production workload.

Frequently asked questions

How much does the OpenAI or Claude API cost per month?

There is no flat fee — you pay per million tokens, with separate input and output rates. As of July 2026, published rates per million tokens (input / output) run roughly: OpenAI GPT-5.6 Terra $2.50 / $15 and Luna $1 / $6; Anthropic Claude Opus 4.8 $5 / $25, Sonnet 5 $2 / $10 (intro rate), Haiku 4.5 $1 / $5; Google Gemini 3.1 Pro $2 / $12 and 2.5 Flash $0.30 / $2.50. As a reference point, 1,000 requests a day at 1,500 input + 500 output tokens each is about $365 a month on a $3/$15 model — the same workload spans roughly $11 to $1,218 a month across the current lineup.

How many tokens is 1,000 words?

Roughly 1,300 to 1,350 tokens. The standard estimation rule is that one token is about 4 characters or about 0.75 words of English, so divide your word count by 0.75. Code, non-English languages, and unusual formatting tokenize less efficiently, and tokenizers differ between vendors — Anthropic notes its newest models tokenize the same text into about 30% more tokens than its earlier ones. For a real figure, run a sample through the provider's tokenizer or token-counting endpoint.

Why is output more expensive than input?

Providers price output tokens 3 to 6 times higher than input because generating each token requires a full forward pass through the model, whereas input tokens are processed in parallel during prefill. The practical upshot is that output length usually drives your bill more than prompt length: a 400-token answer on a model priced at $5 per million output tokens can cost more than a 1,500-token prompt at $1 per million input tokens.

How can I reduce LLM API costs?

Cap output length (it is the biggest lever), pick the smallest model that passes your quality bar, and use the official discounts this calculator deliberately excludes: prompt caching bills repeated system prompts and context at roughly 10% of the input rate, and batch APIs cut both input and output by about 50% for non-urgent work. Combined, workloads with stable prompts routinely save 50-90% versus standard rates. Also trim context you resend every call, and route easy requests to a cheap model.

Which LLM is cheapest for a high-volume app?

At July 2026 rates the cheapest tiers are the small/lite models — Google Gemini 2.5 Flash-Lite ($0.10 / $0.40 per million), OpenAI GPT-5.4 nano ($0.20 / $1.25), and Google Gemini 2.5 Flash ($0.30 / $2.50) — which can be 20 to 100 times cheaper than a frontier model on the same workload. Use the comparison table in this calculator to price your exact token counts across every model; the cheapest option depends on your input/output ratio, since a model with cheap input but pricey output loses on output-heavy workloads.

Related calculators