An AI feature that costs a few cents in testing can cost a few hundred a month in production, and the bill grows with every user. Most of it can be brought down without making the answers worse, but only once you know where it comes from.
This post works through an example bill and seven ways to lower it, with the effect of each one calculated rather than guessed.
Where the bill comes from
AI APIs charge per token, with separate prices for input and output, quoted per million tokens. The cost of a request is its input tokens times the input price plus its output tokens times the output price.
The AI API cost calculator uses an example of 1,000 requests a day, each with 1,500 input tokens and 500 output tokens, at prices of 3 and 15 per million:
| Input | Output | Total | |
|---|---|---|---|
| Per request | 0.0045 | 0.0075 | 0.012 |
| Per month, 30 days | 135 | 225 | 360 |
Output is a quarter of the tokens but nearly two-thirds of the cost, because each output token is priced five times higher. That single fact shapes most of what follows.
1. Ask for shorter answers
Because output is the expensive side, the answer’s length is usually the strongest lever. Many prompts invite long answers by accident: no length limit, a request to “explain”, a format that encourages preamble and summary.
Cutting the example’s answers from 500 tokens to 300 lowers the cost per request from 0.012 to 0.009, and the monthly bill from 360 to 270, a quarter less. Two ways to do it:
- Say the length in the prompt: “Answer in under 150 words” or “Reply with the category name only.”
- Set the maximum output tokens in the API request as a hard ceiling, so a runaway answer cannot exceed it.
For tasks such as classification or extraction, the answer can often be a few tokens: a label, a number, a short JSON object.
2. Trim the prompt that repeats
The instructions sent with every request are paid for every time. A system prompt that has grown to a thousand tokens through months of small additions is a thousand tokens on every call.
Cutting the example’s input from 1,500 tokens to 1,000 lowers the monthly bill from 360 to 315. Smaller than the output saving, because input is cheaper, but often easy: remove repeated rules, outdated examples and instructions the model already follows without being told. Paste the prompt into the token counter to see how long it really is.
3. Use a smaller model for simple tasks
Providers offer models at very different prices, and the cheapest are often good enough for simple, well-defined work: sorting messages into categories, pulling fields out of a form, checking whether text mentions a topic. Keep the larger model for tasks that need reasoning or careful writing.
Suppose 600 of the example’s 1,000 daily requests are simple, and a smaller model priced at 0.5 and 1.5 per million handles them well. Those requests drop from 0.012 to 0.0015 each. The daily cost falls from 12.00 to 5.70, and the monthly bill from 360 to 171, more than halved.
The catch is quality. Test the smaller model on a sample of real requests and compare the results before switching.
4. Cache what repeats
Some providers charge less for input that is identical across requests, such as a long shared document or a fixed set of instructions at the start of every prompt. If your requests begin with the same large block of text, check whether your provider offers this and how to structure the prompt to use it. The saving applies only to the repeated part, so put the fixed content first and the changing content last.
5. Batch what can wait
Some providers also offer lower prices for requests that do not need an immediate answer, processed in bulk over a longer period. Overnight reports, bulk tagging of old records and large translation jobs are good candidates. Interactive features, where a person is waiting, are not.
6. Carry less history
In a chat feature, each new message usually sends the whole conversation so far as input. A conversation of twenty exchanges sends all twenty with the twenty-first question. Costs grow with every turn, and long conversations also run into the model’s context window.
Ways to limit it:
- Keep only recent turns, plus a short summary of earlier ones.
- Start a new conversation when the topic changes.
- Send only the relevant part of a document, not the whole file, when the question is about one section.
The context window calculator shows how much room a model has for material once the answer and instructions are accounted for.
7. Stop paying for failures
Every retry, every loop and every request that produces an unusable answer is paid for in full. Common sources of waste:
- Retries on malformed output. If answers often fail to parse, fix the prompt or use structured output rather than retrying; how to get JSON from AI explains the options.
- Agents that loop, calling the model again and again without making progress. Set a limit on steps.
- Duplicate requests from double clicks or repeated page loads. Store results and reuse them.
The levers side by side
| Change | Monthly cost | Saving |
|---|---|---|
| None | 360 | - |
| Answers cut from 500 to 300 tokens | 270 | 25% |
| Prompt cut from 1,500 to 1,000 tokens | 315 | 12.5% |
| 60% of requests on a smaller model | 171 | 52.5% |
The savings combine. A smaller model for simple requests and shorter answers for the rest can take a bill well below half its starting point, without touching the requests where quality matters most.
Estimate the bill before launch
Cost surprises usually come from estimates made with the wrong numbers. Before a feature goes live, work out three figures. First, tokens per request: paste a realistic prompt and a realistic answer into the token counter, including the system prompt and any document that is sent with it. Second, requests per day at a normal level and at a busy one. Third, how volume will grow as more people use the feature.
Then enter each scenario in the cost calculator. A pilot with 300 requests a day at the example’s token counts costs about 108 a month; the same feature at 3,000 requests a day costs about 1,080. Knowing that before launch makes it easy to decide which of the levers above to build in from the start.
Getting the prices right
Use the price of the exact model each feature calls, not a general figure, and keep input and output prices separate, because the ratio between them decides where savings come from. If a feature uses two models, for example a small one to sort requests and a larger one to answer them, estimate each part separately and add them. Where your provider charges a lower rate for cached input, use the average rate you actually pay rather than the full price, so the estimate matches the invoice.
Think in cost per user
A monthly total says little on its own. Divide it by the number of people who used the feature that month and compare the result with what each of them is worth to the business. In the example, 360 a month spread across 200 active users is 1.80 per user. Whether that is cheap or expensive depends on what those users pay or bring in. A feature that costs 1.80 a month for a customer paying 30 is easy to justify; the same cost for a free user who never converts may not be. Cost per user is also the figure that shows whether the bill will stay manageable as the number of users grows.
Measure before you optimise
Most APIs report the input and output tokens of every response. Log them, along with which feature made the request. A week of data usually shows that one or two features account for most of the cost, and those are where the effort belongs. Without the data, it is easy to spend days shortening a prompt that was never the problem.
Then set a budget alert with your provider, so a bug that sends thousands of requests is caught in hours rather than at the end of the month.
Review the logs again after every significant change to a prompt or a model, because a small edit to a shared instruction can quietly double the tokens of every request.
Costs worth keeping
Some costs are worth paying. Instructions that prevent wrong answers, examples that keep the format stable and context that lets the model answer correctly the first time all save more than they cost, because a wrong answer is paid for twice: once to produce it and again to fix it. Cut what the model does not need, not what it does.
Sources, read November 28, 2026:
- Anthropic, Prompt caching: reading cached input costs significantly less than uncached input, which is why repeated content goes first in the prompt
- Anthropic, Batch processing: the Message Batches API handles large volumes asynchronously at a 50 percent discount, for work that does not need an immediate answer