Skip to content
mentoor

Cost and latency budgets

For engineers

Setting a cost and latency budget per LLM feature, measuring time to first token, p95 latency and cost per successful task, and cutting both without losing quality

See where you stand

110 questions across four stages: Understand, Apply, Solve and Judge.

Try 5 questions

Practice items, not counted towards your mastery. No account needed.

Check yourself · 1 of 5

A feature earns a 6 dollar revenue share per user per month, must keep a 75 percent margin, and each user runs 300 tasks a month. What is the cost ceiling per task?

Choose one answer

Check yourself · 2 of 5

What does time to first token measure?

Choose one answer

Check yourself · 3 of 5

A feature spent 9 dollars over 1 000 tasks, and 800 of them succeeded. What is the cost per successful task?

Choose one answer

Check yourself · 4 of 5

Why are shorter answers often the most effective way to cut both cost and latency?

Choose one answer

Check yourself · 5 of 5

What is the main difference between an alert and a hard cap?

Choose one answer

Topics

  1. Setting a cost and latency budget per feature4 min read · Deriving a per-task cost ceiling and a p95 latency target from what users expect, what the feature earns per user and the margin the business needs
  2. Measuring time to first token and p95 latency5 min read · Time to first token, total latency, output tokens per second, p50, p95 and p99, why averages hide the slow tail, and timing each step of an agent run
  3. Calculating cost per successful task5 min read · Input, cached, output and reasoning tokens times their prices, plus retries, tool loops and failed runs, divided by tasks that succeeded rather than by API calls
  4. Cutting cost and latency without losing quality5 min read · Routing to smaller models, trimming prompts, caching, batching, parallel calls, capping output and reasoning effort, and checking every change against evals before it ships
  5. Budget alerts and hard spend caps5 min read · Per-feature and per-user budgets, anomaly alerts on daily spend and p95 latency, and hard caps that stop a runaway agent loop before the invoice arrives

Start here

110 questions · last verified 2026-12