LearnTopic guide

LLM cost and unit economics

Cost questions check whether you can turn traffic into tokens and tokens into money, then cut the bill without hurting quality. Applied engineers are expected to estimate monthly spend from volumes and prices, know the levers (routing and cascades, prompt caching, batch APIs, shorter prompts and outputs, distillation, self-hosting at realistic utilisation) and measure cost per successful task. Leads are tested on unit economics, ROI attribution, budgets and build-versus-buy. Prices for a fixed level of capability have been falling by at least an order of magnitude a year (Epoch AI measured 9× to 900× a year depending on the task), so always state your price assumptions and show how sensitive the answer is to them.

Applied LLM · AI leadership8 key concepts25 questions

Start: Key concepts 6 lessons · about 18 min
Contents

Key concepts

Token arithmetic

Cost per request = input tokens × input price + output tokens × output price; output costs several times more per token (5× across Anthropic’s current price list). Count everything that is sent: system prompt, tool definitions, retrieved context, conversation history, retries, evaluation and judge traffic, and hidden reasoning tokens, which are billed as output. Tokenisers differ (Anthropic notes its newer tokeniser produces about 30% more tokens for the same text), so compare models on measured cost per task, not on list price per token.

Flow · 4 stepsFrom everything sent to cost per task

From everything sent to cost per taskThe flow starts with everything sent, including system prompt, tool definitions, retrieved context, conversation history, retries, evaluation and judge traffic, and hidden reasoning tokens billed as output. It prices the request as input tokens times input price plus output tokens times output price, with output costing several times more per token. The final comparison uses measured cost per task, because tokenisers differ and Anthropic's newer tokeniser produces about 30% more tokens for the same text.Everything sentsystem prompt, tools, context,history, retriesToken countcount everything sentCost per requestinput × input price + output ×output priceMeasure cost per taskAnthropic's newer tokeniser: ~30%more tokensCompare modelsmeasured cost per tasktokenscountpricemeasure1234InputComputeCompare
  1. Count everything sent Count the system prompt, tool definitions, retrieved context, history, retries, eval and judge traffic, and hidden reasoning tokens (billed as output).
  2. Price the request Cost per request = input tokens × input price + output tokens × output price; output costs several times more per token (5× across Anthropic's list).
  3. Measure cost per task Tokenisers differ (Anthropic's newer tokeniser produces about 30% more tokens for the same text), so compare on measured cost per task.
  4. Compare on task Compare models on measured cost per task, not on list price per token.

Everything sent is counted, priced per request, then compared as measured cost per task rather than list price per token.Diagram drafted by a local AI model (Inkling 2 Mini) from this page's text and drawn from data. Checked by an independent reviewer.
Data
Steps
StepTitleWhat happens
1Count everything sentCount the system prompt, tool definitions, retrieved context, history, retries, eval and judge traffic, and hidden reasoning tokens (billed as output).
2Price the requestCost per request = input tokens × input price + output tokens × output price; output costs several times more per token (5× across Anthropic's list).
3Measure cost per taskTokenisers differ (Anthropic's newer tokeniser produces about 30% more tokens for the same text), so compare on measured cost per task.
4Compare on taskCompare models on measured cost per task, not on list price per token.

Source: This page's text

Boxes
BoxGroupDetail
Everything sentInputsystem prompt, tools, context, history, retries
Token countComputecount everything sent
Cost per requestComputeinput × input price + output × output price
Measure cost per taskCompareAnthropic's newer tokeniser: ~30% more tokens
Compare modelsComparemeasured cost per task

Source: This page's text

Cost per successful outcome

The unit that matters is cost per resolved ticket, accepted summary or approved document: model cost divided by success rate, plus human review, escalations and the cost of errors. Compare it with the value per outcome to get a margin, and track that margin as usage and prices change.

Prompt and prefix caching

Providers and self-hosted engines reuse computation for an identical token prefix. On Anthropic’s API, a 5-minute cache write costs 1.25× the base input price, a 1-hour write 2×, and a read about 0.1× (lower on some newer models); other providers discount cached tokens automatically. Put static content first (instructions, tools, documents) and variable content last, keep history append-only and never put timestamps or request IDs at the top. A semantic response cache is different: it returns stored answers for similar questions and risks wrong or cross-tenant answers.

Batch APIs

For work that can wait, OpenAI’s and Anthropic’s batch APIs charge 50% of the synchronous price, with results within 24 hours (often much sooner). Nightly enrichment, evaluation runs, backfills and non-urgent triage are natural fits; batch and caching discounts can stack.

Routing, cascades and distillation

Send easy requests to a cheap model and hard ones to an expensive model, either with a learned router (RouteLLM trains routers on preference data) or a cascade that escalates when a verifier or calibrated confidence check fails (FrugalGPT). Plot quality against cost across thresholds and account for the latency and double cost of escalated requests. For narrow, high-volume tasks, distil a large model’s outputs into a small fine-tuned model, checking the provider’s terms first.

Self-hosting economics

Self-hosted cost per request = GPU cost per hour ÷ requests served per hour at the utilisation you actually achieve. Capacity must cover peaks and redundancy, so average utilisation sits well below capacity (about one-third if you provision for peaks at 3× the average), and on-call, upgrades and evaluation need people. Self-hosting tends to win on cost only at high, steady volume, or when residency, latency control or customisation force it; hybrids are common.

Agent and reasoning multipliers

Reasoning modes add output tokens you do not see; agents re-send a growing context at every step, so input grows roughly quadratically with step count, and Anthropic reported agents using about 4× and multi-agent systems about 15× the tokens of a chat. Budget steps and tokens per task, and cache the shared prefix. Effort or thinking-budget settings are now the main dial: Anthropic reported Opus 4.5 at medium effort matching Sonnet 4.5’s best SWE-bench Verified score with 76% fewer output tokens, so measure cost per task at each effort level.

ROI and budgets for leads

Take a baseline before rollout, use controlled comparisons (A/B tests, staggered rollouts, difference-in-differences), count full cost (people, compute, licences, change management) and separate adoption, productivity and business impact; be candid about attribution limits. A budget usually has lines for API and GPU spend, people, data and labelling, evaluation, tooling, security and compliance, and a contingency for price and volume changes.

Next: Worked examples Lesson 3 of 6 · about 6 min

Worked examples

Estimate an email-triage bill, then cut it five-fold

An email-triage feature handles 200,000 emails a day at about 1,500 input and 200 output tokens each. Estimate the monthly cost at $3/$15 per million input/output tokens (a mid-tier model) and at $0.25/$1.25 (a small model). Then cut the mid-tier bill at least five-fold. Prices are assumptions; check current list prices.

Volume. Input 200,000 × 1,500 = 300M tokens a day; output 200,000 × 200 = 40M a day. Over 30 days: 9B input and 1.2B output tokens.

Baseline.

  • Mid-tier: 9,000M × $3/M = $27,000; 1,200M × $15/M = $18,000 → $45,000 a month
  • Small: 9,000 × $0.25 = $2,250; 1,200 × $1.25 = $1,500 → $3,750 a month

Note that output is only 12% of the tokens but 40% of the mid-tier bill.

Cutting the mid-tier bill, lever by lever:

Lever Assumption Monthly cost
Start $45,000
Cache the static 1,000-token prefix effective input = 500 + 1,000 × 0.1 = 600 tokens (40%); input $27,000 → $10,800 $28,800
Shorter structured output 200 → 60 tokens; output $18,000 → $5,400 $16,200
Batch API for non-urgent mail 60% of volume at 50% off: × (0.4 + 0.6 × 0.5) = × 0.7 $11,340
Route to a small model 70% handled by a model 12× cheaper, 10% of those escalate and pay twice ≈ $4,860

Routing arithmetic: the expensive model still sees 30% + 7% = 37% of traffic → 0.37 × $11,340 = $4,196; the small model sees 70% at 1/12 the price → 0.7 × $11,340 / 12 = $662. Total ≈ $4,860, about 9× cheaper. With a 2.3-emails-per-second steady flow, the 5-minute cache stays warm, so cache writes are negligible. Rules that skip newsletters and auto-replies before any model call cut further.

Guard quality: run the regression eval suite on each lever, especially routing thresholds.

Follow-up: the bill doubles while traffic grows 10%. Attribute cost by feature, model and tenant, then check prompt growth (new few-shot examples, unbounded history), a collapsed cache-hit rate (someone put a timestamp at the top), retry storms, a routing change, longer outputs, eval jobs on production keys and abuse.

Flow · 6 stepsCutting the email-triage bill five-fold

Cutting the email-triage bill five-foldA left-to-right flow of the email-triage cost levers: a $45,000 baseline passes through prefix caching, shorter structured output, the batch API and routing to a small model, ending at about $4,860 a month. Each step names the lever and its effect on the bill.Baseline bill$45,000 a monthCache static prefixinput $27,000 → $10,800Shorter output200 → 60 tokensBatch API60% of volume at 50% offRoute to small model70% at 1/12 price≈ $4,860 a monthabout 9× cheaper123456BaselineLeversResult
  1. Baseline Start at $45,000 a month: 9B input and 1.2B output tokens over 30 days.
  2. Cache Cache the static 1,000-token prefix; effective input drops to 600 tokens, input $27,000 → $10,800.
  3. Shorter output Cut output from 200 to 60 tokens; output $18,000 → $5,400.
  4. Batch Send 60% of volume through the batch API at 50% off, a ×0.7 multiplier.
  5. Route Route 70% to a small model 12× cheaper; 10% of those escalate and pay twice.
  6. Result Total ≈ $4,860, about 9× cheaper; run the regression eval suite on each lever.

Each lever in turn cuts the mid-tier monthly bill from $45,000 to about $4,860, roughly 9× cheaper.Diagram drafted by a local AI model (Inkling 2 Mini) from this page's text and drawn from data. Checked by an independent reviewer.
Data
Steps
StepTitleWhat happens
1BaselineStart at $45,000 a month: 9B input and 1.2B output tokens over 30 days.
2CacheCache the static 1,000-token prefix; effective input drops to 600 tokens, input $27,000 → $10,800.
3Shorter outputCut output from 200 to 60 tokens; output $18,000 → $5,400.
4BatchSend 60% of volume through the batch API at 50% off, a ×0.7 multiplier.
5RouteRoute 70% to a small model 12× cheaper; 10% of those escalate and pay twice.
6ResultTotal ≈ $4,860, about 9× cheaper; run the regression eval suite on each lever.

Source: This page's text

Boxes
BoxGroupDetail
Baseline billBaseline$45,000 a month
Cache static prefixLeversinput $27,000 → $10,800
Shorter outputLevers200 → 60 tokens
Batch APILevers60% of volume at 50% off
Route to small modelLevers70% at 1/12 price
≈ $4,860 a monthResultabout 9× cheaper

Source: This page's text

When does self-hosting beat the API?

Compare a hosted small model at $0.25/$1.25 per million tokens with self-hosting an open-weight model of similar quality. Requests average 1,500 input and 200 output tokens. Assume a rented GPU costs $2.50 an hour and sustains 5 requests a second for this request shape (measure this in a load test), capacity is provisioned for peaks at 3× average with at least 2 replicas, and operating it takes half an engineer ($100k a year, about $8,300 a month). Find the break-even daily volume.

Hosted cost per 1,000 requests: 1.5M × $0.25/M + 0.2M × $1.25/M = $0.375 + $0.25 = $0.625.

Self-hosted cost per 1,000 requests at full utilisation: 5 × 3,600 = 18,000 requests per GPU-hour → $2.50 / 18 = $0.139. At the roughly one-third average utilisation that 3× peak provisioning implies: about $0.42. The headline 4.5× saving shrinks to about 1.5× before any staff cost.

Monthly totals (30 days; 720 GPU-hours = $1,800 per GPU per month):

Daily volume Hosted Peak req/s GPUs Self-hosted (GPUs + staff)
200k $3,750 6.9 2 $3,600 + $8,300 = $11,900
1M $18,750 34.7 7 $12,600 + $8,300 = $20,900
1.5M $28,125 52.1 11 $19,800 + $8,300 = $28,100
2M $37,500 69.4 14 $25,200 + $8,300 = $33,500

Peak req/s = 3 × daily volume / 86,400; GPUs = max(2, ⌈peak / 5⌉).

Break-even ≈ 1.5M requests a day under these assumptions. Below it the API wins clearly; above it self-hosting saves 10–30%, more if batch work fills the night-time troughs. Because hosted prices keep falling, recheck the comparison every quarter. In a UK bank or healthtech the deciding factors are often data residency, latency control and fine-tuning rather than price, and the hybrid answer (a self-hosted small model for the high-volume simple path, a frontier API for the hard cases) is common.

Showing ROI for a coding-assistant rollout

You rolled out an AI coding assistant to 200 engineers: $40 per seat per month in licences plus about $30 per seat per month of usage-based API spend, and half an engineer ($100k a year) for enablement and governance. Loaded engineering cost is about $200k per engineer per year. How do you show whether it paid off?

Full cost. ($40 + $30) × 200 × 12 = $168,000 + $100,000 = $268,000 a year.

Measurement design. Roll out in waves (four cohorts a month apart) and use difference-in-differences: compare each cohort’s change in a basket of delivery metrics (lead time for changes, merged PRs per engineer-week, incident and rollback rate as a quality guardrail) with not-yet-treated cohorts over the same weeks. Suppose treated cohorts improve throughput by 12% and controls by 3%: an effect of 9%, 95% confidence interval 4%–14%, with no rise in change-failure rate.

Value. Engineering spend is 200 × $200k = $40M a year.

  • Point estimate: 9% × $40M = $3.6M of capacity → ROI = (3.6 − 0.268) / 0.268 ≈ 12×
  • Lower bound: 4% × $40M = $1.6M → ROI ≈ 5×

Lead with the conservative figure.

Candour about limits. Capacity is not cash: value is realised only if freed time goes to roadmap work or avoids hiring. PR counts can be gamed, novelty effects fade, and rework or security issues add hidden cost, so re-measure at six months, keep the quality guardrails and report adoption (weekly active users), productivity and business impact separately.

Next: What changed Lesson 4 of 6 · about 2 min

What changed recently

  1. Frontier models are now sold on cost per task

    Anthropic priced Claude Opus 5.5 at $4/$20 per million input/output tokens, 20% below Opus 5, but led with claims that at default settings it costs 40% less than Opus 5 on typical workloads and matches or beats rivals on several benchmarks at 20–40% of their cost per task. Default effort is medium, while most headline scores use max effort. Compare models on measured cost per successful task at the effort you will actually run, not on list price.

    Source

  2. Effort settings become the main cost dial

    With Claude Opus 4.5, Anthropic cut Opus pricing to $5/$25 (from $15/$75) and added an effort parameter; at medium effort it matched Sonnet 4.5’s best SWE-bench Verified score while using 76% fewer output tokens. Reasoning budgets now move cost per task more than list prices do, so cost models must include effort level, output length and retries.

    Source

  3. Sparse attention arrives with a 50% price cut

    DeepSeek released V3.2-Exp with DeepSeek Sparse Attention and cut its API prices by more than 50% while reporting benchmark parity with the previous model. It is a clear case of architecture changes for cheaper long-context inference flowing straight into price, and a reason to assume continued falls for a fixed capability in multi-year plans.

    Source

  4. AI Index 2025: 280-fold fall in inference cost

    Stanford’s AI Index reported that the cost of querying a model at GPT-3.5 level fell more than 280-fold between November 2022 and October 2024, with hardware costs falling about 30% a year and energy efficiency improving about 40% a year. Use such figures to argue for short payback periods and price-review clauses, while noting that reasoning and agent workloads can still raise total spend.

    Source

Next: Pitfalls and interview angles Lesson 5 of 6 · about 2 min

Pitfalls

  • Forgetting that output tokens cost several times more than input, or leaving out tool definitions, history, retries and reasoning tokens.
  • Comparing per-token list prices across models whose tokenisers and verbosity differ instead of measuring cost per task.
  • Comparing a GPU-hour price with an API price without utilisation, redundancy and staff.
  • Putting timestamps, user IDs or retrieved documents at the start of the prompt, which destroys prefix-cache hits.
  • Downgrading to a cheaper model without a regression eval, or a one-off cost cut with no ongoing per-feature cost visibility.
  • Reporting usage or licences as value; ignoring human-review and rework costs.

How interviewers probe it

  • ‘Estimate the monthly cost’: show the arithmetic aloud, state price assumptions, then give a sensitivity range.
  • ‘Cut it five-fold’: list levers in order of effort and saving, with the quality checks for each.
  • ‘The bill doubled while traffic rose 10%’: a cost-attribution debugging exercise.
  • ‘Should we self-host?’: break-even with utilisation, redundancy and staff; residency and customisation; the hybrid option.
  • Lead: ‘The CFO wants spend halved in two quarters’, ‘Draft next year’s AI budget’, ‘Prove the copilots paid off’.
  • Product: ‘Does this AI feature make economic sense?’ — cost per successful outcome against value and pricing.
Next: Quiz Lesson 6 of 6 · about 3 min

Quiz

Three questions from this guide. Answer each in your head or out loud, show the model answer, then rate yourself. The cards join your practice deck and come back when they are due.

  1. Question 1 of 3 · Applied LLM · Technical · Medium

    Estimate the monthly LLM cost of an email-triage feature handling 200k emails a day at about 1,500 input and 200 output tokens each. Then cut it five-fold. Follow-up: next month the bill doubles while traffic grows 10% — what do you check?

  2. Question 2 of 3 · Applied LLM · Technical · Medium

    How do provider prompt caching and self-hosted prefix caching work, how do you structure prompts to benefit, and how is a semantic response cache different?

  3. Question 3 of 3 · Applied LLM · Technical · Medium

    When would you self-host an open-weight model instead of using a hosted API? Walk through the decision for a UK healthtech or bank.

Reading

Practise this topic

  1. Estimate the monthly LLM cost of an email-triage feature handling 200k emails a day at about 1,500 input and 200 output tokens each. Then cut it five-fold. Follow-up: next month the bill doubles while traffic grows 10% — what do you check?Applied LLM · Technical · Medium
  2. How do provider prompt caching and self-hosted prefix caching work, how do you structure prompts to benefit, and how is a semantic response cache different?Applied LLM · Technical · Medium
  3. When would you self-host an open-weight model instead of using a hosted API? Walk through the decision for a UK healthtech or bank.Applied LLM · Technical · Medium
  4. Design a router that sends easy requests to a cheap model and hard ones to an expensive model. How do you train and evaluate it?Applied LLM · Technical · Medium
  5. Your feature works with a large frontier model but costs too much. How would you distil it into a smaller model, and how do you know it’s good enough?Applied LLM · Technical · Medium
  6. Choose between three hosted models and one self-hosted open-weight model for a summarisation feature at 2 million requests a day. Describe the bake-off.Applied LLM · Technical · Medium
  7. LLM inference spend tripled in a quarter as usage grew. The CFO wants it halved within two quarters without hurting the product. Plan it.AI leadership · Case study · Hard
  8. How do you tell whether an AI feature makes economic sense?AI leadership · Case study · Medium
  9. How do you show that an AI investment paid off, including spread-out benefits such as staff copilots or coding assistants?AI leadership · Technical · Hard
  10. When would you run open-weight models yourselves instead of calling a commercial API?AI leadership · Technical · Hard
  11. Explain how a subword tokeniser such as byte-level BPE is trained and applied, then tell me how the choice of tokeniser shows up in cost, latency and quality for a product that serves Welsh, Turkish and English users, source code and numbers.Applied LLM · Technical · Easy
  12. Models now accept hundreds of thousands of tokens. When would you put everything in the context window instead of building retrieval, and what failure modes would you watch for?Applied LLM · Technical · Medium
  13. When is an orchestrator-plus-sub-agents architecture worth its cost compared with a single agent holding more tools?Applied LLM · Technical · Hard
  14. When does asking a model to reason step by step, or enabling a reasoning mode, help — and what does it cost?Applied LLM · Technical · Medium
  15. Your coding agent is connected to 25 MCP servers exposing about 300 tools, and tool definitions alone consume tens of thousands of tokens before the user’s request. Latency, cost and tool-selection accuracy are all suffering. What would you change?Applied LLM · Technical · Medium
  16. A document-QA product re-sends the same 60k-token contract across many sessions spread over hours, so GPU prefix-cache hits are rare. Would you offload KV cache to CPU memory or SSD and reload it instead of recomputing? Show the arithmetic.Applied LLM · Technical · Hard
  17. Model A costs $3 per million input tokens and $15 per million output tokens; model B costs $1 and $5. On your agentic task, A at medium reasoning effort averages 40k input and 6k output tokens with an 85% success rate; B averages 60k input and 14k output tokens with a 70% success rate. Each failure costs $2 of human handling. Which is cheaper per resolved task, and what else would you test?Applied LLM · Technical · Medium
  18. Design a pipeline that turns 50 million PDFs (born-digital reports, scanned forms, papers with tables and equations) into clean text for pretraining and retrieval. Choose between heuristic extractors and a vision-language OCR model, estimate the cost, and explain how you would measure quality.Applied LLM · System design · Hard
  19. You are planning a three-year LLM roadmap. Epoch AI estimated that the price of reaching a fixed capability level fell between 9× and 900× per year depending on the benchmark. How should that shape decisions on self-hosting, long-term contracts and fine-tuning investments?AI leadership · Case study · Hard
  20. Your coding agent runs for 300 turns and its context fills with tool output. Design a context-management strategy using what model APIs now offer (context editing, compaction, memory files), and explain how you keep prompt-cache hits high and check that nothing important is lost.Applied LLM · System design · Medium
  21. Your product serves a 70B model in FP8 on Hopper GPUs. Leadership asks whether moving to Blackwell with NVFP4 weights will halve the serving cost. Explain what NVFP4 is and how you would answer.Applied LLM · Technical · Medium
  22. A product team wants an orchestrator–worker multi-agent ‘deep research’ feature. Given published figures that multi-agent systems use around 15 times the tokens of a chat turn, how would you decide whether it is worth building, and which levers would you use to control cost and latency?Applied LLM · System design · Medium
  23. GPT-5 shipped as a fast model, a deeper reasoning model and a real-time router between them. Design and evaluate a similar router for your own assistant, which today sends every request to an expensive reasoning model.Applied LLM · System design · Hard
  24. You run a coding-agent product on a flat £20-a-month plan. Your heaviest 5% of users now cost more in model spend than they pay, because long agentic tasks cost many times more than simple requests. Cursor’s 2025 move from request quotas to usage-based credit pools ended in an apology and refunds. Redesign your pricing and plan the rollout.AI leadership · Case study · Medium
  25. After DeepSeek-R1 (MIT licence, January 2025) and OpenAI’s gpt-oss (Apache 2.0, August 2025), your CFO asks why you still pay a frontier API for an internal assistant handling 2 billion tokens a day. The 2026 AI Index says the best closed model leads the best open one by only about 3%. Make the recommendation.AI leadership · Case study · Hard

Study material compiled with AI: drafted by a local model (Inkling 2 Mini) from public sources, then checked against those sources by independent AI reviewers (Claude) in November 2026. Not reviewed line by line by a person.