LLM Cost Calculator: Estimate API Costs per Request and per Month
By FindMySum · Last reviewed
An LLM cost calculator turns token counts into money. Large language model APIs bill by the token, at one price for the text you send (input) and a higher one for the text the model writes (output), quoted per million tokens. Multiply, add, and scale by your traffic, and you have a budget. This page does that with Decimal arithmetic, adds prompt caching and batch discounts, and shows where the bill goes. The worked example uses the defaults: 2,000 input and 500 output tokens per request, 1,000 requests a day, at example prices of US$2 and US$10 per million tokens.
The formula
cost per request = uncached input × input price + cached input × cache price + output × output price, all divided by 1,000,000 because prices are per million tokens.
monthly cost = cost per request × (1 − batch discount) × requests per day × days per month
A year is 365 days of requests. Prices are inputs: they change several times a year and differ between providers, models and contracts, so the defaults are dated examples (a mid-size model's list price, read from the provider's pricing page on 12 November 2026), not a quote.
Worked example
- Input: 2,000 × US$2 ÷ 1,000,000 = US$0.004.
- Output: 500 × US$10 ÷ 1,000,000 = US$0.005.
- Per request: US$0.009, or US$9 per 1,000 requests.
- Per month: US$0.009 × 1,000 × 30 = US$270.
- Per year: US$0.009 × 1,000 × 365 = US$3,285.
Output is only 20% of the tokens but 56% of the bill, because each output token costs five times an input token here. That pattern is typical, and it means long answers and "thinking" tokens move the total more than long prompts do.
Prompt caching
Many requests repeat the same opening: a long system prompt, tool definitions, a reference document. Providers can cache that prefix and bill repeated reads at a fraction of the input price. In the example, if 60% of the input comes from the cache at US$0.10 per million:
- uncached input: 800 × US$2 ÷ 1,000,000 = US$0.0016
- cached input: 1,200 × US$0.10 ÷ 1,000,000 = US$0.00012
- output: US$0.005
The request drops to US$0.00672 and the month to US$201.60, a 25% saving. Writing to the cache usually costs a little more than normal input, and caches expire after minutes of disuse, so the saving depends on traffic that re-uses the prefix often. The calculator leaves the write surcharge out.
Batch processing
Work that nobody waits for, such as nightly classification, evaluations or summarising a backlog, can often go through a batch interface at a discount, 50% at several providers. Set it under advanced options; it applies to every token. At 50% the example falls to US$135 a month.
What the estimate leaves out
- Retries and failures: timeouts and malformed outputs that are re-sent cost tokens too.
- Growing context: in chat, each turn re-sends the history, so later turns cost more than the first. Use an average over whole conversations.
- Other charges: images, audio, web search and tool calls are often priced separately; some models charge more above a long-context threshold.
- Taxes and currency: prices are in US dollars before tax.
Keeping the bill down
The levers follow from the formula. Shorter outputs (a tighter format, a lower maximum) cut the expensive side. Caching cuts repeated input. Batch processing halves work that can wait. A smaller model cuts every price, if its answers are good enough. And retrieval that sends five relevant passages instead of fifty shortens the prompt. The context window calculator helps size that prompt, and the tokens per second calculator shows how long the answers take.
More questions
How do I find my average tokens per request?
Every API response reports the input and output tokens it used. Log them for a day of real traffic and divide the totals by the number of requests. Averages from real usage beat estimates from word counts, especially for chat, where the history grows each turn.
Is it cheaper to use a smaller model?
Per token, almost always: smaller models can cost a tenth of the largest ones. Whether the total is cheaper depends on quality; if a smaller model needs retries or longer prompts to get the same result, the savings shrink. Run both on a sample of real requests and compare cost per successful result.
How does a growing chat history affect cost?
Each turn re-sends the earlier turns as input, so input tokens grow with every message. A 20-turn chat can bill several times the tokens of its final question. Prompt caching, trimming old turns or summarising them keeps the cost in check.
Should I budget in US dollars?
API prices are quoted and usually billed in US dollars. If you pay in another currency, convert the monthly total at your card's or bank's exchange rate and add any foreign transaction fee and sales tax that applies to digital services where you live.
How do I estimate cost before I have any traffic?
Write five to ten realistic requests, run them once, and read the token counts from the responses. Multiply by the requests per day you expect, then by 1.5 to 2 for growth, retries and longer-than-expected answers.
Sources
This article explains how the calculator works and is general information, not financial, tax, legal or medical advice. Rules change; check the sources above or a qualified professional before you act.