Skip to content
commitius

Why do AI API credits run out so fast?

As a chat grows, every message resends the whole history, output costs more than input and tools are counted separately. Where credits go and how to keep them.

Can DemirFounder & author · 3 min read
The Claude logo with its orange starburst on grid paper, an arrow drawn from it to the word API

Because every new message in a conversation sends the whole conversation so far again, and you pay for all of it again. On top of that, the text the model writes costs several times more than the text it reads, the system prompt and tool definitions are counted again on every request, and web search is billed separately. So most of your credit goes not to the conversation itself but to the history carried again each time. With a few settings the same work costs far less.

Why does a long conversation cost so much?

The model does not remember the previous exchange. With every message you send the whole conversation again, and the model reads all of it again. Anthropic's documentation says this plainly. The input of each turn contains all previous conversation history plus the new message, and the system prompt, tool definitions, tool results, images and documents count too. If the messages are of similar length, the input you pay for at the twentieth message is roughly twenty times that of the first. Even a user asking a short question sends an expensive request at the end of a long conversation.

Why does the answer cost more than the input?

Models price the text they read and the text they write separately. According to Anthropic's pricing page, on Claude Sonnet 5.5 one million input tokens cost $2 and one million output tokens cost $10. So when the model writes at length for you, it grows a line that is five times more expensive. The part where the model thinks before answering is billed as output too. For tasks that do not need a long answer, asking for a short reply and setting an output limit saves money directly.

How do tools and web search eat credits?

When you give the model tools, their definitions are added to the input of every request. When the model calls a tool, the result goes back as input to the next request. An assistant that calls a tool several times in a row has made several separate requests for a single user question. Web search is billed on top. At Anthropic a thousand searches cost $10, and the results count as input both in that turn and in later turns.

How do you keep your credits?

  • Cache the fixed part. If the system prompt, a product catalogue or a long document is the same on every request, write it once with prompt caching and read it cheaply after that. According to the pricing page, a cache read on Sonnet 5.5 costs one twentieth of the normal input price.
  • Limit the conversation history. Replace old messages with a short summary, or send only the last few turns.
  • Choose the model for the job. Give classification or short answers to a small model, and save the large model for truly hard questions.
  • Send work that is not urgent in batches. Anthropic's Batch API gives a 50 percent discount on input and output. It suits jobs like product descriptions or translations that run overnight.
  • Remove tools you do not need and shorten tool results. Return the fields the answer needs, not the whole record.
  • Measure spending. Every response says how many tokens it used. Log it, find the most expensive questions and start there.

We set up caching, the history limit and spend logging from day one as part of website AI assistant setup. If you are thinking of adding an assistant to your site, we explained how to estimate the cost and what the assistant should see in How do I add an AI assistant to my website?

Share

Working on something similar?

Tell us in a few sentences what you want to do, and we will work out the right way together.