OpenAI LLM API Pricing Calculator: Work Out Your Cost
An OpenAI LLM API pricing calculator estimates your bill from the tokens you send and receive. Learn the formula, the cost drivers and a worked example.
On this page
Short answer
An OpenAI LLM API pricing calculator estimates what your calls to OpenAI's language models will cost, based on the tokens you send and receive. You multiply input tokens and output tokens by their rates, add the two, and you have the cost of a call. The rest is choosing the right model and keeping token use down.
What is an OpenAI LLM API pricing calculator?
An OpenAI LLM API pricing calculator is a method or tool that estimates what your calls to OpenAI's language models will cost, based on the tokens you send and receive. It turns an abstract token count into a money figure before you commit to a design.
OpenAI charges by the token, not by the call. A token is a chunk of text, roughly four characters or about three quarters of a word in English. Every prompt you send and every answer you receive is counted in tokens.
| Cost driver | What it means | How it moves the bill |
|---|---|---|
| Input tokens | Text you send, prompts and context | More context, higher cost |
| Output tokens | Text the model writes | Longer answers, higher cost |
| Model tier | Which model answers | Stronger models cost more |
| Cached input | Repeated prompts stored for reuse | Lower cost per call |
| Batch API | Requests processed off-peak | Lower rate, slower return |
A calculator is only as good as its inputs. If you guess the token counts, the estimate is a guess too. Measure real prompts first, then calculate. See how to integrate the OpenAI API for the setup the estimate applies to.
How is API cost worked out?
API cost is worked out with one formula: input tokens divided by one million, times the input rate, plus output tokens divided by one million, times the output rate. Input and output have different rates, and output is usually the dearer of the two.
To use the formula, you need four numbers: how many input tokens a typical call sends, how many output tokens it returns, the input rate per million tokens, and the output rate per million tokens. Rates differ by model, so the same call costs a different amount on a different model.
Check the current rates on OpenAI's own pricing page, since they change when models are added or retired. A calculator that uses last year's rates will mislead you on this year's bill.
Once you have the cost of one call, multiply by the number of calls. Daily volume times cost per call gives the daily figure, and thirty days of that gives the monthly figure. Keep the two parts separate in your workings, so you can see whether input or output drives the bill.
What changes the price?
The price changes with the model, the output length, caching, batch processing and retries. Each of these is a lever you can pull, and each has a trade-off.
Model choice is the biggest lever. A stronger model costs more per token than a lighter one, so a call that works on the lighter model should not run on the stronger one. Test whether the cheaper model meets your quality bar before defaulting to the top tier.
Output length is the second lever. Long answers cost more than short ones, and the output rate is usually higher than the input rate. Asking for a short, structured answer instead of an open essay can cut the bill sharply.
Caching cuts the cost of repeated input. If many calls share the same system prompt or the same retrieved documents, cached input is charged at a lower rate. Batch processing, where requests are handled off-peak, also carries a lower rate but returns results more slowly.
Retries are the hidden lever. A call that fails and is retried twice costs three times the original. Set retry limits and a timeout, and log failures so you can see how often retries happen.
How do you estimate tokens before you call the API?
You estimate tokens by counting a sample of real prompts with a tokeniser, then adding a margin. A rough word count is not enough, because code, numbers and other languages tokenise differently from plain English.
Start with a sample of real calls: ten or twenty prompts and their answers from your actual use case. Run them through a tokeniser for the model you plan to use, and record the input and output counts separately.
Take the average, then add a margin of about a quarter for variation. Prompts grow over time as context is added, so an estimate based on the shortest prompt will understate the bill.
For retrieval use cases, count the retrieved context too. A prompt that pulls in five documents can carry far more input tokens than the question itself, and that context is charged on every call. See what OpenAI is for background on the models behind these numbers.
How do you keep the bill down?
You keep the bill down by cutting tokens, choosing the cheaper model that meets the bar, caching repeated input and capping output. Each step is small on its own; together they change the total.
Shorten prompts first. Remove repeated instructions, trim retrieved context to the passages that matter, and drop examples the model no longer needs. A prompt that shrinks by a third cuts input cost by a third.
Use the cheaper model for drafts and triage, and the stronger model only where quality demands it. Many workflows split this way: a light model classifies and drafts, a strong model checks the hard cases.
Cache what repeats. A system prompt or a set of retrieved documents that appears in every call should be cached rather than resent at full price. Set a maximum output length so a runaway answer cannot burn the budget in one call.
Finally, batch what can wait. Reports, summaries and bulk processing that do not need an instant answer can run through the batch API at a lower rate.
Example (hypothetical): a support team's monthly bill
Example (hypothetical): a support team handles 2,000 tickets a day with an AI draft assistant. Each ticket sends 800 input tokens and receives 200 output tokens. The hypothetical rates are $2 per million input tokens and $8 per million output tokens.
Daily input is 2,000 times 800 tokens, or 1,600,000 tokens. At $2 per million, that is 1.6 times $2, or $3.20 a day. Daily output is 2,000 times 200 tokens, or 400,000 tokens. At $8 per million, that is 0.4 times $8, or $3.20 a day.
Over 30 days, input is 48 million tokens, which is 48 times $2, or $96. Output is 12 million tokens, which is 12 times $8, or $96. The monthly bill is $96 plus $96, or $192.
The rates here are hypothetical, used only to show the arithmetic. Check OpenAI's own pricing page for the current rates before you budget, and rerun the sum when you change models or prompts. If the team switches to a cached system prompt, the input figure falls and the total follows it.
What are the common mistakes?
The most common OpenAI API pricing mistakes are forgetting output tokens, ignoring retries, and budgeting from a single test call instead of real volume.
- Forgetting output tokens. Output is usually dearer than input, so a long answer costs more than the prompt that asked for it.
- Ignoring retries. A call retried twice costs three times the original, and nobody budgets for it.
- Budgeting from one call. A single short test call says nothing about a month of real traffic.
- Using stale rates. Rates change when models are added or retired, so last year's calculator misleads.
- No output cap. Without a maximum length, one runaway answer can burn a day's budget.
If you are weighing OpenAI against other providers, open-source OpenAI API alternatives compares the options.
How do you track spend after launch?
You track spend after launch with the usage dashboard, per-key limits, spend alerts and a weekly review. A calculator gives the estimate; tracking shows whether it holds.
Start with the usage dashboard, which shows tokens and cost by model and by day. Split usage by API key or by project so one workflow cannot hide inside another's numbers.
Set a monthly budget and an alert at a threshold such as 80 percent, so the team hears about a spike before the month ends. Set per-key limits too, so a single runaway integration cannot spend the whole budget.
Review weekly for the first month. Compare actual tokens per call with the estimate, and look for the drivers: longer prompts, more retries or a model change. If the numbers drift, update the calculator inputs rather than the budget.
Key takeaways
- Cost is input tokens times the input rate, plus output tokens times the output rate
- Output tokens usually cost more than input tokens, so long answers drive the bill
- Model choice is the biggest lever; test the cheaper model first
- Cache repeated prompts and batch work that can wait
- Track spend weekly and update the calculator when prompts or models change
Frequently asked questions
What is an OpenAI LLM API pricing calculator?
It is a method or tool that estimates what your calls to OpenAI's language models will cost, based on the tokens you send and receive. You multiply input and output tokens by their rates, add the two, and you have the cost of a call.
How much does the OpenAI API cost?
It depends on the model, the tokens and the volume. OpenAI charges per million tokens, with different rates for input and output. Check OpenAI's own pricing page for current rates, since they change when models are added or retired.
What is a token?
A token is a chunk of text, roughly four characters or about three quarters of a word in English. Every prompt you send and every answer you receive is counted in tokens, and you are charged for both.
Why is my API bill higher than the estimate?
The usual causes are longer prompts than planned, more output tokens, retries after failures, or a model change. Check the usage dashboard for tokens per call and compare it with the estimate to find the driver.
Does caching lower the cost?
Yes, when many calls share the same system prompt or retrieved documents. Cached input is charged at a lower rate than fresh input, so a stable prompt that repeats across calls costs less each time.
Is the batch API cheaper?
Yes, requests processed off-peak through the batch API carry a lower rate than live calls. It suits reports, summaries and bulk work that does not need an instant answer, but results come back more slowly.