cd /news/large-language-models/your-ai-feature-costs-more-in-produc… · home › topics › large-language-models › article
[ARTICLE · art-178370] src=dev.to ↗ pub= topic=large-language-models verified=true sentiment=· neutral

Your AI feature costs more in production than your estimate. Here is the arithmetic.

A developer writing for AI Pulse Daily laid out the arithmetic behind why AI chat features routinely cost several times their pre-launch estimates, identifying five compounding effects: quadratic growth in re-sent conversation history, output tokens priced several times higher than input tokens, full-price retries on timeouts and malformed responses, a heavy-tailed request-length distribution, and prompt ordering that defeats caching. The writeup walks through a support-bot example in which twenty turns consume roughly 39,000 input tokens rather than the 9,000 a per-message estimate assumes, and recommends logging input tokens, output tokens and retry counts per request to predict bills within a few percent.

recommendation

Log input tokens, output tokens and retries per request, budget on 95th-percentile input length rather than the mean, and order prompts with stable content first so caching discounts the repeated prefix.

more in playbook: Controlling LLM cost
by read3 min views1 publishedNov 30, 2026

Most AI features are costed once, in a spreadsheet, before launch: "about 800 tokens per request, a few thousand requests a day, fine." Then the invoice arrives and it is several times the estimate. The gap is rarely a pricing surprise. It is arithmetic that the estimate skipped.

Here is where the money actually goes, in the order that usually matters.

A chat feature that keeps history re-sends the whole history with each new message. Turn one sends 500 tokens. Turn ten sends those 500, plus nine replies and nine answers, plus the system prompt. By turn twenty you are paying for thousands of input tokens to ask one short question.

Do the sum for a support bot with a 300-token system prompt and 150-token turns:

Twenty turns of conversation cost roughly 39,000 input tokens, not the 9,000 a per-message estimate assumes. The curve is quadratic in the number of turns. Two fixes, both cheap:

At every major vendor, generated tokens are priced several times higher than input tokens, because generation is the expensive part. An estimate that counts "tokens" as one number will be low whenever the feature produces long answers.

Count them separately. A 400-token answer can cost more than a 3,000-token prompt.

Timeouts, 429s, malformed JSON that fails validation, and empty responses all get retried, and every retry is a full-price request. A 5 percent retry rate sounds harmless until you notice it applies to the expensive requests most often: long prompts and long outputs are the ones that time out.

Log retries as their own counter. If retries are above 2 percent, the problem is usually prompt size or an output format that the model keeps breaking, not the provider.

Averages hide the tail. If most requests are 800 tokens and the top 5 percent are 20,000 (a pasted document, a long thread, a table), the tail can be most of the bill. Budget on the 95th percentile length, not the mean, and put a hard cap on input size with a clear error message.

Prompt caching discounts the repeated prefix: the system prompt, instructions, and any fixed reference material. It does nothing for the part that changes every request. So the saving depends on how you order the prompt: stable content first, variable content last. If your prompt puts the user's question at the top and the instructions at the bottom, caching saves you almost nothing.

Three numbers per feature, logged per request:

With those three you can predict the bill within a few percent and see which fix pays. Without them you are guessing at which of the five effects above is eating the budget.

Cost per request is not a number you look up, it is a number you compute from turn count, output length, retries and the length of the tail. The vendors publish per-token prices; the multipliers are yours.

I write about AI tool pricing at AI Pulse Daily, where prices are checked against the vendor's own page before anything is published.

── more in #large-language-models 4 stories · sorted by recency
── more on @ai pulse daily 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/your-ai-feature-cost…] indexed:0 read:3min 2026-11-30 · —