LLM API Cost Calculator
What an AI model API costs per request, per conversation and per month from tokens in and out at the prices you enter, with prompt caching, batch discounts, images, audio and speech, and the tokens per minute you need.
Result…
How it's calculated
Input cost = input tokens × [(1 − cached share) + cached share × (1 − cache discount)] × input price ÷ 1,000,000 Output cost = output tokens × output price ÷ 1,000,000 Token cost × (1 − batch discount); + images, audio minutes and speech characters × their prices With history: input over T turns = T × in + (in + out) × T(T − 1) ÷ 2 Month = cost per request × requests a day × days; TPM = peak requests a minute × tokens per request
AI model APIs bill text by the token, usually with one price per million input tokens and a higher one for output. Prompt caching bills the repeated start of a prompt at a lower rate, and batch APIs trade a slower answer for a discount, so both are entered as percentages from your provider. In a chat the app usually resends the whole conversation each turn, so input grows quickly with the number of turns: switch that on to see it. Images, transcription minutes and text-to-speech characters are priced per unit and added per request. Tokens per minute at your peak request rate tells you the rate limit you need. No provider's prices are built in, because they change often.
Your numbers, step by step
About the LLM API Cost calculator
This LLM API cost calculator estimates what a language model API costs you per request, per conversation, per day and per month. You enter the input and output tokens per request and the prices per million tokens from your provider's price page; no provider's prices are built in, because they change often. Add the share of each prompt served from a prompt cache and its discount, a batch API discount, and the number of requests per conversation. You can also choose whether each turn resends the chat history, which is how most chat apps work and why long conversations cost more. Images, transcribed audio minutes and text-to-speech characters can be added at unit prices you enter. It also gives the tokens per minute your peak request rate needs, to check against a rate limit. Developers and product teams use it to budget an AI feature before launch.
How to use it
- Enter the “Input tokens per request” and “Output tokens per request”. The LLM token calculator estimates tokens from words.
- Enter the “Price per 1M input tokens” and “Price per 1M output tokens” for your model.
- If you use caching or batching, fill in the “Share of input served from cache”, the “Discount on cached input” and the “Batch discount”.
- Set the “Requests per conversation”, whether each turn resends the history, the “Requests per day” and the “Days a month”.
- Add images, audio or speech if you use them, and the “Peak requests per minute” for the rate limit.
Worked example
A chat feature sends 1,200 input and 300 output tokens per request, at 2 per million input tokens and 8 per million output. Sixty percent of the input is cached at a 90% discount. Conversations last 6 requests and resend the history, at 3,000 requests a day over 30 days. Input over a conversation grows to 29,700 tokens, so a conversation costs 0.041724 and a month 625.86. Without the resent history the month would be 315.36. At 40 requests a minute the peak need is 210,000 tokens per minute.
Updated
Questions people ask
How do I calculate the cost of an API request?
Multiply the input tokens by the input price per million and divide by 1,000,000, do the same for the output tokens, and add the two. Then apply any cache or batch discount your provider offers.
Why do long chats cost so much more?
Most chat apps send the whole conversation so far with every new message, so the input grows with each turn. Over T turns the input is roughly T × the new message plus the history, which grows with T².
How much does prompt caching save?
It saves the cached share × the cache discount on your input cost. With 60% of input cached at a 90% discount, input costs 54% less. Output tokens are not affected, and some providers charge extra to write to the cache.
How many tokens per minute do I need?
Multiply your busiest requests per minute by the average tokens per request, counting input and output. Compare that with your account's rate limit, which may count input and output separately.
Where do I find the prices to enter?
On the provider's official pricing page for the exact model, tier and region you use. Prices differ by model and change over time, so check them on the day you plan.
Why might my bill differ from this estimate?
Providers may bill long contexts, reasoning tokens, tool calls, cache writes or fine-tuned models at other rates, and they add tax depending on where you are. Compare the estimate with your usage dashboard after a few days, and get your provider's or an accountant's view before committing a budget.