Why Your OpenAI API Bill Keeps Climbing
Eight reasons AI API spend grows faster than usage, how to find which one is driving your bill and the fixes that usually pay off first.
The first OpenAI invoice is usually small enough to ignore. Then a feature ships, usage grows and the bill climbs faster than the user count. In most cases the cause is not one mistake but a handful of design choices that multiply each other.
Every AI API bill comes down to three numbers multiplied together: requests, tokens per request and price per token. When the bill rises, one or more of those numbers is growing. Here are the most common reasons, grouped by which number they drive.
Tokens per request are growing
1. Conversation history is resent on every turn
Chat-style applications typically send the full conversation back to the model with each new message. A ten-turn conversation does not cost ten times one message. It costs much more, because turn ten carries all nine previous turns as input. Long-running sessions quietly become the most expensive part of the product.
2. Retrieval adds more context than the model needs
Retrieval-augmented generation (RAG) pipelines often stuff ten or twenty document chunks into every prompt, just in case. If three would produce the same answer, the rest is paid-for noise.
3. Long system prompts on every call
Detailed instructions, examples and tool definitions can run to thousands of tokens. That cost repeats on every request.
4. Output is unbounded
Output tokens are typically priced several times higher than input tokens. Verbose answers, unrequested explanations and missing output limits add up. Reasoning models add another factor: the hidden reasoning they do before answering is billed as output tokens, even though you do not see it in the response.
Requests are multiplying
5. Agents and loops
An agent that plans, calls tools and checks its own work may make many model calls to complete one user task. Without a cap on steps, a single stuck task can generate dozens of calls.
6. Retries and duplicates
Aggressive retry logic, double-submitted requests from the front end and repeated identical questions all generate billable calls that produce no new value.
Price per token is higher than it needs to be
7. The flagship model handles everything
Teams often build with the most capable model and never revisit the choice. Classification, extraction, routing and short summaries can often be handled by a smaller model at a fraction of the price, with the larger model reserved for the requests that need it.
8. Real-time pricing for work that is not real time
Nightly report generation, document processing and evaluation runs do not need an answer in seconds. OpenAI's Batch API processes requests asynchronously within 24 hours at a 50% discount compared with the synchronous API.
To estimate your own numbers, use our free AI API cost calculator.
How to find out which one is driving your bill
- Split usage by feature. Use separate projects or API keys per application or feature, so the usage dashboard shows cost by source instead of one total.
- Log token counts. Every API response includes a usage block with input, output and cached token counts. Store it with a feature name and a user or tenant identifier.
- Calculate cost per request and per user. Track these over time. A rising cost per request means token growth. A rising request count per user means loops, retries or new behavior.
- Look at the distribution, not the average. A small share of very long conversations or runaway agent tasks often accounts for a large share of the spend.
Fixes that usually pay off first
- Trim conversation history. Keep the last few turns verbatim and summarize older ones.
- Retrieve less, rank better. Fewer, more relevant chunks usually maintain answer quality at lower cost.
- Use prompt caching. OpenAI applies prompt caching automatically to prompts longer than 1,024 tokens on supported models and bills recently seen input tokens at a discount. Put stable content, such as system instructions and tool definitions, at the start of the prompt and variable content at the end so more of each request can be cached.
- Route by difficulty. Send simple tasks to a smaller model and escalate only when needed. Test quality on a sample before switching.
- Batch what can wait. Move asynchronous workloads to the Batch API.
- Cap outputs and agent steps. Set maximum output tokens and a step limit for agents.
- Cache whole responses. For frequently repeated questions, store and reuse the answer instead of calling the model again.
- Set budgets and alerts. Use your provider's project budgets and notifications so a spike is caught in days, not at invoice time.
A worked example
Using hypothetical prices of $2 per million input tokens and $8 per million output tokens: a support assistant handling 200,000 conversations a month, averaging 12,000 input tokens and 800 output tokens per conversation, uses 2.4 billion input tokens and 160 million output tokens. That is $4,800 for input and $1,280 for output, or $6,080 a month.
Trimming history and retrieval to cut average input to 6,000 tokens halves the input cost to $2,400. If caching then applies to a stable 2,000-token prefix, the cost falls further. None of this requires changing the model. Prices vary by model and change often, so always check the current pricing page before you model your own numbers.
Want to know exactly where your AI budget goes?
An AI Spend Audit breaks down your usage by model, feature and customer, and gives you a prioritized savings plan.
Request an AI Spend Audit