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
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?
Check yourself · 2 of 5
What does time to first token measure?
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?
Check yourself · 4 of 5
Why are shorter answers often the most effective way to cut both cost and latency?
Check yourself · 5 of 5
What is the main difference between an alert and a hard cap?
Topics
- 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
- 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
- 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
- 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
- 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
- Reducing latency (Claude docs) (opens in a new tab)DocsFree
Names the levers: model choice, output length, prompt length and streaming, with guidance on each.
- Latency optimization (OpenAI API docs) (opens in a new tab)DocsFree
Seven principles for cutting latency, including fewer output tokens, fewer requests and parallel calls.
- LLM inference benchmarking metrics (NVIDIA NIM docs) (opens in a new tab)DocsFree
Defines time to first token, inter-token latency, end-to-end latency and throughput precisely.
Scenarios
Helps to know first
110 questions · last verified 2026-12