← All writing

LLM engineering· April 18, 2026 · 12 min

The Real Cost of an AI Feature: A Breakdown

The API bill is the smallest line item on a production AI feature. The other seven are the ones that quietly kill the project.

The Spreadsheet That Lied

Every AI feature I have reviewed in the last eighteen months arrived with a one-cell cost model. Someone multiplied tokens-per-request by the published Anthropic or OpenAI price, divided by a thousand, and pasted the result into a finance deck. The number was always wrong by a factor of three to ten.

It is not because the math was wrong. It is because the spreadsheet only had one row.

Here is what an AI customer support assistant actually costs at the scale where it starts to matter: 50,000 tickets per month, single tenant, English-only, integrated into Zendesk. I have built three of these. The numbers below are within 10% of the median.

Line Item 1: Inference

This is the line everyone budgets.

Claude Sonnet, at roughly $0.003 per 1k input tokens and $0.015 per 1k output tokens. A typical support ticket pulls in around 5,000 input tokens (system prompt + RAG context + chat history + tool definitions) and emits about 800 output tokens (response + tool calls). That works out to roughly $0.0195 per ticket, or about $975 per month for 50k tickets.

Round it up to $1,100 once you factor in retries and the agent's habit of calling the same tool twice.

This is the cheap number. Everyone gets this one right.

Line Item 2: Embeddings

The knowledge base behind the assistant is a 500k-chunk corpus — product docs, runbooks, archived ticket resolutions. At Voyage's $0.00013 per 1k tokens and roughly 200 tokens per chunk, the steady-state re-embedding bill is around $130 per month if you re-embed nightly.

The trap is the spikes. The day someone uploads a new 200k-document product manual, you re-embed the corpus and burn $400 in an afternoon. The day a marketer "fixes" the doc style guide with a global find-and-replace, every chunk's hash changes and you re-embed the entire corpus. I have watched a team burn $1,800 in 48 hours because a CMS migration touched the modification timestamp on every document.

Budget $200/month and a $1,000 quarterly buffer. Add a cap in your ingest job that refuses to re-embed more than 20% of the corpus in a 24-hour window without a manual override.

Line Item 3: Vector Storage

This is where the "build vs. buy" decision actually has teeth.

OptionMonthly cost (500k chunks, 1536-dim)Notes
Pinecone (s1 pod, 1 replica)~$1,000Easy, supports filters, billed by pod-hour
Qdrant Cloud (1B tier)~$600Better filter performance, cheaper
Weaviate Cloud~$700Strong hybrid search built-in
Self-hosted pgvector on RDS~$400r6g.xlarge + storage. You own ops.
Self-hosted Qdrant on a single c7g.2xlarge~$220Cheapest if you can spell HNSW

The right answer at 500k chunks is almost always managed. Below 10M chunks the marginal eng-hours of running your own ANN index are not worth the $400 you save per month. I have done it both ways. The first time something gets stuck in a snapshot-restore loop at 2am, the math flips.

Budget $600/month, with a clear migration path off Pinecone once you cross 5M chunks or $4k/month — Pinecone's pricing curve gets steep faster than its competitors'.

Line Item 4: Evals

If your AI feature does not have a nightly golden-set eval run, it is not in production. It is in extended beta with paying customers.

A reasonable eval suite is 300–500 labeled (input, expected_output) pairs, run nightly through the full pipeline, with an LLM-as-judge scoring faithfulness, helpfulness, and policy compliance. Each pair costs roughly the same as a real request, plus a judge call that runs about $0.01 per item.

At 500 items nightly, that is roughly $5 per night of inference and another $5 of judge calls. Call it $300/month. Add a weekly regression suite that runs 2,000 items against a half-dozen prompt variants and you are at $500/month.

This is the line item teams cut first when they are over budget. It is also the line item that — when missing — turns a routine prompt edit into a Sunday night incident.

Line Item 5: Observability

You need traces. Every LLM call, every tool call, every retrieval, with full input and output captured for sampled requests.

The managed options:

  • Langfuse Cloud: roughly $100–$500/month depending on observed traces and retention. Excellent prompt management. Their self-hosted is free if you want to run Postgres + Clickhouse yourself.
  • Helicone: $100–$300/month for similar volume. Simpler model, weaker eval workflow.
  • Datadog LLM Observability: $0.50–$1 per million traces on top of the existing Datadog bill. Easy if you are already on Datadog, painful if you are not.
  • Self-hosted Arize Phoenix: free in license, ~$150/month in compute, plus the eng-hours nobody tracks.

For the 50k-ticket assistant, expect $250/month on Langfuse and four hours of eng time per month maintaining dashboards and alerts. Budget $300.

Line Item 6: Human-in-the-Loop

This is the line item that breaks the budget.

A support assistant that is good enough to ship needs human review on roughly 5–15% of its outputs. Either the model flagged itself uncertain, or a downstream classifier flagged the response as risky, or the customer hit thumbs-down and a human now has to look. At 50k tickets per month, 10% review rate, two minutes of reviewer time per item, $30/hour fully loaded — that is 1,667 reviewer-hours at $30/hr, which is $50,100 per month.

That is not a typo. Human-in-the-loop is forty times the inference bill.

This is the cost that ends projects. Teams that have not modeled HITL find out three months in that the feature is unprofitable, and respond by either (a) shipping without the safety net and absorbing the policy violations, or (b) quietly killing the feature.

The lever is not "eliminate review." It is "reduce review rate." Every percentage point of HITL you can shave off a 50k-ticket workload is $5k/month. A better classifier that drops review from 10% to 6% pays for a fine-tuning run, an eval engineer, and a small reranker every month.

Budget HITL as a function of accepted policy risk, not as a fixed line item.

Line Item 7: Engineering

Two engineers, each spending roughly 20% of their week on this feature — prompt iteration, eval triage, incident response, integration work. At a fully-loaded $250k per engineer, 20% of two engineers is $100k/year, or about $8,300/month.

This is steady-state. The first six months will be closer to 60% of one senior engineer plus 30% of a second — call it $18k/month during build-up.

Engineering cost dwarfs every dollar of API spend for any feature under about $20k/month of inference. Teams routinely propose optimizations that save $300/month of tokens and cost an engineer two weeks. The break-even on a two-week optimization is roughly $2,000/month of recurring savings. Anything less and you are setting fire to opportunity cost.

The Shadow Cost

There is an eighth line item that nobody puts in the deck: failed agent runs that retry.

A poorly bounded agent loop — one that retries on transient tool errors without an exponential backoff, or that re-plans after every failed tool call — can double or triple the inference cost of a single user request. I have audited an agent that averaged 4.2 LLM calls per ticket because the planner kept re-deciding it needed to "double-check" the retrieval. The author thought it averaged 1.

Set a max-retries budget per request, enforced in your gateway. Three LLM calls. Two tool calls. One re-plan. Anything past that fails closed with an escalation. Without this cap, your inference line item is a probability distribution with a long right tail, and your finance team will discover the tail in the worst possible month.

The Real Number

For our 50k-ticket-per-month assistant:

Line itemMonthly cost% of total
Inference$1,1001.7%
Embeddings$2000.3%
Vector storage$6000.9%
Evals$5000.8%
Observability$3000.5%
Human-in-the-loop (10%)$50,10077.4%
Engineering (steady)$8,30012.8%
Shadow cost buffer (15%)$3,6005.6%
Total$64,700100.0%

The inference bill is 1.7% of the real cost. Cutting it in half saves $550 a month. Cutting the HITL rate from 10% to 8% saves $10,000 a month.

That is the entire reason to read this post.

When Self-Hosting Pays Off

Self-hosting your inference — running Llama 3.1 70B or DeepSeek-V3 on your own GPUs, or using a dedicated-throughput tier from Anthropic or Together — starts to make sense when three conditions overlap:

  1. You are spending more than $5k/month on the same model for predictable workload. Below that, the GPU rental dominates.
  2. Your workload is steady within a 2x peak-to-trough ratio. Spiky workloads waste reserved capacity.
  3. You have latency-sensitive paths where a 200ms p95 advantage from a colocated model is worth real money.

For our 50k-ticket assistant at $1,100/month, self-hosting does not pay. For the 800k-ticket sibling product at $17,600/month with a 1.4x peak-to-trough ratio, it does — moving the workload to dedicated throughput cut the bill to roughly $9,000/month and improved p95 latency by 400ms.

The Optimization Order

If your inference bill genuinely is the constraint, the order of operations that consistently yields the most savings per eng-hour:

  1. Model selection. Drop from Sonnet to Haiku for the 70% of requests that are easy. Route only the hard ones to Sonnet. Typical savings: 40–60% of inference cost in a week of work.
  2. Prompt caching. Anthropic's prompt caching is 90% cheaper on reads. Cache the system prompt, the tool definitions, and any static RAG context. Typical savings: 30–50% of input cost.
  3. Routing. Build a small classifier (a fine-tuned 8B model or a cheap call to Haiku) that decides whether the request even needs the agent. Many "AI" requests can be answered by a deterministic FAQ lookup. Typical savings: 20–40% of total calls.
  4. Fine-tuning. Last resort. A fine-tuned smaller model can replace Sonnet on a narrow domain, but you now own the eval, the deployment, and the drift problem. Only worth it past $10k/month of steady inference.

Notice that fine-tuning is last, not first. It is the most expensive lever to maintain and the slowest to ship. Teams reach for it first because it feels like real engineering. It usually is not the right answer until you have already done the boring three above.

What Didn't Work

We once tried to cut the inference bill on a different product by caching responses at the LLM-output level — hash the full prompt, store the response in Redis, return it on hit. The idea was that customer support questions repeat constantly: "how do I reset my password?" gets asked 400 times a day.

The hit rate looked great: 38% on a one-week trial. Then we noticed the complaints. The cache was returning the right answer to slightly wrong questions because the hash matched on the user-facing text but ignored the account context. A user on the Enterprise plan asked about SSO and got the Free-tier answer cached from the previous user. Faithfulness, judged against the live response, dropped from 0.91 to 0.76.

We pulled the cache. The right place to cache is not output-level. It is at the retrieval step (cache the embedding and the top-k results, keyed by the query plus the tenant_id) and at the prompt-prefix level (Anthropic's prompt caching, which is correct by construction because the cache key is the prompt prefix, not a hash of the user input). Both worked. Output caching for an agent that takes per-user context is a foot-gun.

The week of work spent on output caching saved zero dollars. The half-day spent enabling Anthropic prompt caching saved $400/month.

Comparing Four Features

A snapshot from four real features I have worked on, all in production:

FeatureVolumeInferenceHITLEngTotal/moInference as %
Support assistant (this post)50k tickets$1,100$50,100$8,300$64,7001.7%
Email summarizer (read-only)200k emails$2,400$0$4,200$7,60031.5%
Sales call analyzer6k calls$900$7,200$4,200$14,4006.3%
Code review bot (internal-only)1.5k PRs$720$0$2,100$2,90024.8%

The features without HITL are the cheap ones, and inference is a meaningful fraction of their cost. The features with HITL are dominated by it. The feature with the highest token cost is the email summarizer, but its total is an eighth of the support assistant's.

If you are choosing what AI feature to build next, this table is the entire decision matrix. The right next feature is the one with the lowest HITL ratio, not the one with the lowest token bill.

A Closing Note

The model bill is the first cost. The seventh cost is the one that kills the project.