Why the bill gets away from people
AI agents are everywhere now. They are no longer reserved for the biggest companies with dedicated teams and years of machine learning experience behind them. That is good news, and it is also the reason a lot of people are about to open an unpleasant invoice.
An agent that is not set up carefully can drain almost any budget in record time, and that is before you count the salaries of the AI engineers who built it. At hAIlander we work with small businesses on AI solutions that are useful and affordable, so cost is usually where the conversation starts.
When you work with an API you pay per token. Handle that carelessly and the bill overtakes the gain sooner than you would expect. It starts with things that sound trivial, like the language your instructions are written in, or the documents you drop into the context window. We will come back to the language point shortly.
Three questions to ask before you build anything
Below is the guide we follow when building agents. Most of the saving comes before you even write the first line of code. Answer the three questions below and you will start seeing the change immediately.
1. Do you really need an LLM for this?
This is the most important question, and it sounds strange in an article about AI agents, but it is not. Plenty of companies are following the hype and building agents where a simple automation, a well written script in your favourite programming language, or even an Excel formula would do the job. Answer honestly before you write a single prompt.
2. Which model is good enough?
This is the difference between saving money on day one and ending up with a large bill. It is human nature to reach for the best available technology, which is why so many of us replace a working phone with the new flagship every year. Sometimes that instinct has you firing a cannon at a fly.
Do you really need Claude Opus 5 for this task? Do you need the newest state-of-the-art model from the top of the leaderboard, or will a smaller one be enough? Text classification, light coding and sentiment analysis all run well on small models at a fraction of the cost, and they usually run faster than their bigger siblings too.
3. How much context do you really need?
The longer your agent runs, the more this one matters. It is tempting to add one more example or one more PDF just to be sure the agent knows everything about you. But does it need any of that to do its job? Cut what you can. A well optimised context often shrinks by half, and sometimes by more than 75%.
Now for the language point promised earlier. It is not only the number of words in your instructions, it is which language they are in. Most LLMs are optimised for English. If you run a Spanish or Italian company, writing your instructions in your native language feels natural, and it is often the wrong call. The same text usually costs more tokens outside English — with Polish, the gap can sit somewhere between 50% and 70%.
Answering those three questions can take an agent from hundreds of dollars a month to a few. There is even more you can do.
Three techniques that save even more
You need a bit more technical experience for the techniques below, but with an AI coding assistant helping you implement them, that shouldn't be a barrier.
Prompt caching
Your input gets sent to the model so it can be processed, and that happens on every single message or request. What is easy to miss is that when your agent does this hundreds of times a week, even a short input adds up. Providers spotted this and built caching: you pay full price once, then a fraction of it on every request after that.
Batch API
We like watching progress happen in real time, but there are plenty of cases where waiting a few hours costs you nothing. Does an invoice really need processing the moment it lands in your inbox? Probably not. The batch API lets you group requests into a single payload that finishes within 24 hours, and because of that delay, Anthropic , OpenAI and Google all offer a discount — often 50%.
Model routing
This one is more advanced and needs an automated control system that decides which model handles which task. Simple, straightforward requests go to the small, cheap models; the genuinely hard ones go to the big, capable models. Email classification does not need Anthropic's Fable 5 when Google's Gemini 3.1 Flash-Lite will finish it at a fraction of the cost. Add local models to the mix and the bill drops further, hardware aside.
What this looks like in numbers
Say you built an agent to process invoices. There are 200 of them each day, all on the same template, and the agent has to pull out the identification number, total value, date and customer details, then populate them in your system.
The input is the invoice plus the system prompt and other instructions, roughly 1,750 tokens, and the output is roughly 250 tokens. That works out to about 350,000 input tokens and 50,000 output tokens a day. Here is what three ways of running it look like.
The big guns
You reach for a state-of-the-art model: GPT 5.6 Sol, at $5 per million input tokens and $30 per million output. That is $1.75 a day for input and $1.50 for output, so $3.25 a day. It does not sound like much until you multiply it out and land at $97.50 a month.
The reasonable option
After a bit of research, you settle on Gemini 2.5 Flash Lite. Not the newest, but more than enough here. At $0.10 per million input and $0.40 per million output, you are paying $0.035 a day for input and $0.02 for output. You tell your manager that the processing which used to take hours every month now costs $1.65, and you go and do something more demanding with your week.
The 400 IQ option
$1.65 already looks good, but by now you know enough to think like an engineer. The processing does not need to happen this second, so batching cuts the cost in half, and prompt caching takes it lower still. Expect around $0.60 a month.
Not every task will shrink that far
A few simple decisions, and the monthly bill dropped more than 150x.
You will not get that ratio everywhere. Some tasks genuinely need the horsepower, and GPT 5.6 Sol or Fable 5 might be the right call. Looking at your agents from a few angles every so often, and trying to optimise everything, is the habit worth keeping. New models also arrive almost every day, so checking whether there is a cheaper alternative from time to time is going to be your new reality.
Planning to build an agent to help with your workload? Already working with AI agents and looking for a way to make them better and cheaper? Book a free intro call and let's talk about your needs.