How much does it cost each time you ask the AI about your database?
· Toni Martir, arquitecto de software
At a wholesale distributor, the company's AI runs on a pay-as-you-go cloud model. Someone in sales types «how much did we sell in Girona yesterday?»: eight words. The provider does not charge for those eight words, but for everything the model reads and writes to answer them.
The bill is counted in tokens (chunks of words), with one price per million for the tokens the model reads and another, higher one for those it writes. It reads far more than your question, and part of what it writes never reaches your screen. The published prices of Anthropic's Claude Sonnet 5.5 show where the money goes.
«How much did we sell in Girona yesterday?»: what gets billed
An example with round numbers and Claude Sonnet 5.5 prices, in dollars per million tokens: 2 to read, 10 to write and 0.10 to read from the cache. This is the first question of the conversation; on later ones, everything already said is added to what it reads.
What it reads: everything, every time
The model remembers nothing from one question to the next. Anthropic's API, the door through which programs use the model, is «stateless»: the tool sends it the whole conversation every time. And OpenAI warns that even when its API keeps the conversation, everything that came before is «billed as input tokens» again.
So every question carries the tool's instructions, the description of your tables, which the AI needs to write the right SQL statement (the technical instruction that fetches the data), and everything said so far. Say the instructions and the table description add up to 20,000 tokens: at 2 dollars a million, that is 4 cents per question. Giving it only the sub-schema for the question's area makes each one cheaper. On your own machine, that reading costs you a wait before the first word.
What it writes: including what you don't see
Models that reason before answering first write an internal text, and that text is billed. Anthropic bills it as output tokens, «for the full thinking process», not for the part you can see. OpenAI does the same, and the reasoning can take «anywhere from a few hundred to tens of thousands» of tokens, depending on how hard the question is.
Reasoning tokens are charged at the writing price: on Sonnet 5.5, 10 dollars a million, five times the reading price; 2,000 come to 2 cents.
The cache makes repeats cheaper
The cache exists for what repeats with every question: the provider keeps what it has already read and charges less to read it again. On Sonnet 5.5, reading from the cache costs 5% of the normal price, and writing to it costs 25% more.
But the tool has to ask for it: on Anthropic's API, with a field in each request. And it expires: it lasts five minutes from the last time it was used. The question after the coffee break pays for the whole description again, plus 25% to store it.
So how much does each question cost?
Whatever it costs to read everything that comes with it —instructions, table description and conversation, all over again each time— plus what it writes, reasoning included. In the example, 6.2 US cents, of which your question and the SQL statement are 3%; with the cache, 2.4. A thousand questions a month come to 62 dollars without the cache, and 24 if they all hit the cache.
At Reportman AI every SQL statement the AI writes goes through a blind audit, optional and on by default, which explains in plain words what it does without knowing your question: that is how you know whether the figure is right. The plans have a fixed fee, with an approximate number of cloud queries per day, and one-off credit packs if those run out. Local AI is not charged per question: unlimited queries on every plan, including the €0 one, with you providing the machine and the electricity. With the Agent running as a service, any machine with AI can be shared by granting access by email and, wherever it is, while it is connected it shows up in the pool of machines of everyone with access, who picks which one to ask.
Sources
- Anthropic, Pricing, «Model pricing»: Claude Sonnet 5.5, «$2 / MTok» base input, «$2.50 / MTok» for 5-minute cache writes, «$0.10 / MTok» for cache hits and «$10 / MTok» output; «All prices are in USD.» And, under prompt caching: «5-minute cache write: 1.25x base input price» and «Cache read (hit): […] 0.05x on Claude Opus 5.5 and Claude Sonnet 5.5».
- Anthropic, Using the Messages API: «The Messages API is stateless, which means that you always send the full conversational history to the API.»
- OpenAI, Conversation state: «Even when using previous_response_id, all previous input tokens for responses in the chain are billed as input tokens in the API.»
- Anthropic, Steering thinking, «Pricing»: «Tokens Claude uses while thinking (billed as output tokens)» and «You are billed for the full thinking process, not the thinking content visible in the response.»
- OpenAI, Reasoning models: «While reasoning tokens are not visible via the API, they still occupy space in the model’s context window and are billed as output tokens.» and «Depending on the problem’s complexity, the models may generate anywhere from a few hundred to tens of thousands of reasoning tokens.»
- Anthropic, Prompt caching:
enabled with the
cache_controlfield in the request, and «By default, the cache has a 5-minute lifetime. The cache is refreshed for no additional cost each time the cached content is used.» - The arithmetic, in dollars: 20,000 × 2 / 1,000,000 = 0.04; 20 × 2 / 1,000,000 = 0.00004; 2,000 × 10 / 1,000,000 = 0.02; 200 × 10 / 1,000,000 = 0.002; total, 0.06204. With the cache, 20,000 × 0.10 / 1,000,000 = 0.002, and the total, 0.02404; storing those 20,000 tokens in the cache, 20,000 × 2.50 / 1,000,000 = 0.05. What you see, (0.00004 + 0.002) / 0.06204 = 3.3%.
- Reportman AI: home page (the blind audit, optional and on by default), plans (monthly fee, approximate daily cloud queries, one-off credit packs and «Unlimited Local Queries» on every plan) and local AI (local AI on every plan, a distributed network of machines and the Agent as a service, with privileges granted by email).
Toni Martir, arquitecto de software · · sources checked on