Low-cost iOS & Android apps. Free quote in 24h: +33 1 59 13 25 55

Home/Blog/AI

AI API costs: how not to blow up your bill

The five mechanisms that make an AI API bill run away, the levers that cut it fivefold, and the safeguards to put in place before production.

Stream of particles channelled through a series of translucent filters

Key takeaways

  • The costliest item is almost always the context sent, not the response generated.
  • A cache on repeated instructions sharply reduces the cost of similar calls.
  • Using the most powerful model for every task multiplies the bill with no measurable gain.
  • Set a spending cap and an alert before going to production, not after the first incident.
  • Measure the cost per useful business action, not the cost per call.

A company calls us because its AI bill has been multiplied by more than twenty in a month. No change in pricing, no particular usage peak: a code change had caused the full conversation history to be sent with every request instead of the last three exchanges.

Bills that run away are almost never a pricing problem. They are design problems, and they can be fixed in a few days.

Understanding what you pay for

You pay for the text that goes in and the text that comes out, counted in units called tokens — roughly, a common word is worth one to two tokens in French.

Two findings follow, and they are counter-intuitive.

Input costs less than output per unit, but it often makes up most of the bill, because you send a lot and receive little. A document assistant commonly sends 6,000 tokens of context to produce 250 tokens of response.

The cost per call is trivial; it is the volume that counts. A tiny cost per request seems negligible until forty people make three hundred a day.

The five mechanisms that make a bill run away

1. Context sent every time

Culprit number one. The entire history, or twenty document passages “just in case”, is sent with every request.

The fix: send only what is necessary. On a document assistant, going from twenty passages to five — after a reranking step that selects the best — sharply reduces cost without degrading quality, often improving it. This is the mechanism described in our article on RAG assistants.

2. No cache on instructions

Most applications send the same two thousand tokens of system instructions with every request. Providers offer caching mechanisms that bill this part at a reduced rate when it is reused.

The fix: place the stable part — instructions, examples, reference documents — at the start of the request and enable the cache. It is a change of a few hours for a permanent gain.

3. The oversized model

Using the most capable model to sort a request into three categories is like taking a lorry to deliver a letter.

The fix: route by task. A lightweight model to classify, extract, rephrase; the capable model to reason, synthesise, write. The price difference between tiers is counted in multiples, not percentages.

4. Cascading calls

An agent that chains eight steps makes eight calls, each carrying the accumulated context of the previous ones. Cost then grows quadratically with the number of steps.

The fix: limit the number of steps, summarise the context between steps rather than accumulating it, and set an iteration cap. It is also what prevents infinite loops — the subject of our article on AI agents.

5. No safeguards

No limit per user, no account cap, no alert. A badly written loop in production can then consume a monthly budget in a single night.

The three safeguards to put in place before going to production: a spending cap on the provider account, an alert at 50% and 80% of the monthly budget, and a limit on calls per user per hour in your application. One day of work, and no surprise is possible any more.

The order in which to optimise

1stReduce the context sent: the biggest lever, almost always
2ndEnable the cache on the stable part of requests
3rdRoute simple tasks to a lighter model

These three levers, applied together, commonly divide a bill by three to five with no measurable loss of quality. We apply them systematically before considering anything else.

Finer optimisations — quantisation, self-hosted models, batch processing — only make sense at high volumes, and they introduce an operational burden you must be able to carry.

The right indicator: cost per useful action

Tracking total monthly cost tells you nothing. Tracking the cost per successful business action tells you everything.

Examples: cost per case processed, cost per response validated without rework, cost per document correctly extracted. This figure can be compared with what the action used to cost in human time — and it is the only argument that holds up in a budget committee.

On a healthy use case, you commonly get a cost per action of a few cents against several euros of human time saved. The debate over API pricing then stops by itself.

An AI bill that causes worry is almost always the symptom of a system sending too much, too often, to the most expensive model. It is not a supplier problem, it is an engineering problem — and therefore fixable.

The check in three questions

To put to your team or your provider, once a quarter:

  1. How many tokens are sent per request on average, and why? If nobody knows, that is the first job.
  2. What proportion of requests benefits from the cache? Below 50% on an application with stable instructions, there is an immediate gain.
  3. Which tasks use the most expensive model, and did they really earn it? A one-day comparative test is enough to settle it.

Sources

55 · agency

Product, design & engineering studio — Paris · Nice · Lyon

Since 2013, 55 · agency has been designing and building mobile apps, websites and AI products for startups, SMEs and large accounts, out of Paris, Nice and Lyon.

FAQ

Frequently asked questions

How much does an AI API cost for a business application?

For an internal assistant used by twenty to fifty people, a few hundred euros a month is generally enough. Bills running to several thousand euros almost always come from a design flaw: an oversized context, no cache, or a model too big for the task.

What is the main cost item?

The context sent as input, in the vast majority of document-based applications. The entire history or corpus is often sent with every request, when a few well-selected passages would be enough. Reducing this context is the most effective lever.

Should you use the most powerful model?

Rarely for everything. Classifying a request, extracting a field or rephrasing a sentence works very well with a lighter, much cheaper model. Reserve the most capable model for reasoning tasks that genuinely need it, and measure the quality difference before deciding.

How do you avoid a nasty surprise on the bill?

Set a spending cap at account level, an alert at 50 and 80% of the monthly budget, and a limit on calls per user per hour in your application. These three safeguards take a day to put in place and make any runaway impossible.

Ready to start?

Let’s talk about your next product.

A free 30-minute call, no strings attached. You leave with a clear, costed view of your project.