A payments team adds an AI check to every transaction. In the pilot it handles a few thousand requests a day and the monthly invoice is a rounding error, so nobody models it. Six months later the check sits on the path of every card payment, every account change and every support message, and finance asks why a feature that was supposed to be a line item has become one of the largest on the cloud bill. Engineering has no clean answer. Costs are scattered across model calls, retries, a vector store, an observability pipeline and a pool of GPUs that sits at 15 percent utilization overnight. Nobody can say what one decision costs, or what it would cost if volume doubled.
Volume is the entire problem. A design that is fine at 100,000 requests a month becomes a different system at 100 million, because every inefficiency you ignored gets multiplied by a thousand. This article is about the economics of judgment calls, the small, frequent, structured decisions an AI service makes inside a product: choose one of these options, extract these fields, score this input. Jev, the judgment-model service from TypeSafe, is built around that style of call. The principles below apply to it and to any comparable service, hosted or self-run. The article quotes no vendor prices, because they change and depend on your contract. It gives you the model for working out your own numbers.
1. What 100 million requests a month actually means
Start with arithmetic, because 100 million sounds enormous and turns out to be manageable on throughput and punishing on cost. A 30-day month has 2,592,000 seconds, so 100 million requests is an average of about 39 requests per second. Traffic is never flat. If the busiest minute runs at five times the average (an assumption, replace it with your own peak-to-mean ratio from real logs), you design for roughly 190 requests per second. That is a modest load for any well-built service.
The cost side behaves differently. Suppose an average call carries 600 input tokens and produces 20 output tokens (again an assumption for illustration). One hundred million calls then push 60 billion input tokens a month. Trimming 100 tokens from the prompt removes 10 billion of them. Shaving 5 percentage points off the share of calls that need escalation, or off the retry rate, removes 5 million calls a month. At this scale, small percentages are the whole budget conversation, and prompt length, retry policy and routing become the main levers, far ahead of the choice of cloud region or instance family.
- Average rate: requests per month ÷ 2,592,000 seconds.
- Design rate: average × your measured peak-to-mean ratio.
- Concurrency in flight: design rate × latency in seconds (Little's law, covered in section 5).
- Token volume: requests × (input tokens + output tokens), tracked separately because they are usually priced differently.
2. The unit of account is cost per correct decision
Teams usually track cost per call. That number is easy to read from an invoice and misleading, because a cheap call that is wrong costs more than an expensive one that is right. The quantity worth optimizing is the cost of a decision that you can rely on:
cost per correct decision = (model cost + retries + escalations + infrastructure + review labor) ÷ accuracy-adjusted decisions
Each term hides a decision. Retries and escalations are traffic you pay for twice. Review labor is the human time spent on cases the system flags, and at 100 million requests even a 0.1 percent review rate is 100,000 cases a month. Accuracy matters because errors have a price that does not appear on the model invoice: a wrongly blocked payment is a lost sale and a support ticket, and a wrongly approved one is a chargeback. Write down the cost of a false positive and of a false negative for each decision type. Without those two numbers you cannot tell whether a cheaper, slightly worse model is a saving or a loss.
3. The cost drivers of a judgment call
A judgment call is cheaper than free-form generation for structural reasons: the output is short and constrained, so most of the cost sits on the input side. That shapes where to look.
| Driver | Scales with | Main lever | Watch out for |
|---|---|---|---|
| Input tokens | Prompt length × requests | Trim instructions, send only needed fields, drop boilerplate | Cutting context that the decision actually needs |
| Output tokens | Answer length × requests | Constrained choices, short structured fields, no free-text rationale in the hot path | Losing the explanation you need for audits |
| Model size or tier | Per-call price or GPU time | Route easy cases to a small model | Routing errors that send hard cases to the weak tier |
| Retries and timeouts | Failure rate × retry count | Bounded retries with backoff, idempotency keys | Retry storms during partial outages |
| Fan-out | Calls per user action | Batch related judgments into one call, drop redundant checks | Several teams each adding "just one" call to the same flow |
| Idle capacity | Self-hosted GPU hours × (1 − utilization) | Autoscaling, shared pools, batching | Paying for peak capacity around the clock |
| Observability | Logged bytes per request | Sample payloads, keep structured summaries | Log storage costing more than the model calls |
The last row surprises people. At 100 million requests, storing full prompts and responses for every call can rival the inference bill. Log decisions and identifiers for every request, and full payloads for a sample plus every error and every low-confidence case.
4. Cascades: cheap judge first, escalate when unsure
The largest single saving at this scale usually comes from not sending every request to the strongest model. A cascade routes each request to the cheapest tier that can handle it, and escalates only when that tier signals doubt. Most traffic is easy: the benign transaction, the clearly formatted invoice, the obvious intent. A small, fast judgment model resolves those, and the minority of ambiguous cases move up.
The expected cost per request is the sum, over tiers, of the probability that a request reaches the tier times that tier's cost. The script below computes it. The unit costs are relative placeholders (the cheapest tier equals 1 unit), not prices. Replace them, and the escalation rates, with figures measured on your own traffic.
type Tier = {
name: string;
costPerCall: number; // relative units: cheapest tier = 1
escalateRate: number; // fraction of this tier's requests sent to the next tier
p50Ms: number; // median latency of this tier
};
function cascade(tiers: Tier[], monthlyRequests: number) {
let reach = 1; // probability that a request gets this far
let expectedCost = 0;
let expectedMs = 0;
const calls: Record<string, number> = {};
for (const t of tiers) {
expectedCost += reach * t.costPerCall;
expectedMs += reach * t.p50Ms;
calls[t.name] = Math.round(reach * monthlyRequests);
reach *= t.escalateRate;
}
return { expectedCost, expectedMs, calls };
}
// Illustrative inputs only. Measure your own.
const tiers: Tier[] = [
{ name: "small-judge", costPerCall: 1, escalateRate: 0.15, p50Ms: 120 },
{ name: "mid-judge", costPerCall: 8, escalateRate: 0.05, p50Ms: 400 },
{ name: "frontier", costPerCall: 120, escalateRate: 0, p50Ms: 2500 },
];
const result = cascade(tiers, 100_000_000);
console.log(result);
console.log("all-frontier baseline:", 120, "units per request");
With those assumed inputs the expected cost is 1 + 0.15 × 8 + 0.15 × 0.05 × 120 = 3.1 units per request, against 120 units if every request went to the top tier. The point of the exercise is the shape, not the ratio: the last tier is rare enough that its large unit cost contributes less than a third of the total, and the cheapest tier carries most of the volume. The same script shows the sensitivity. Doubling the first tier's escalation rate from 0.15 to 0.30 raises the expected cost to 1 + 0.30 × 8 + 0.30 × 0.05 × 120 = 5.2 units. Accurate escalation decisions are worth more than a slightly cheaper top tier.
What makes a cascade work
- Calibrated confidence. The first tier must know when it does not know. A model that is confidently wrong sends hard cases straight to a bad answer. Calibrate on labeled data and set the escalation threshold from the measured trade-off between cost and error.
- A fallback that is safe. Define what happens when the top tier is down or times out: queue for review, apply a conservative default, or fail closed. Decide per decision type, in advance.
- Monitoring of the escalation rate. A rising escalation rate is the earliest sign of input drift and the earliest sign of a cost problem. Alert on it.
When not to cascade
Skip the cascade when volume is low enough that routing logic costs more engineering time than it saves, when every case is genuinely hard, or when latency requirements make a second hop unacceptable. The latency of an escalated request is the sum of the tiers it visited, so a request that goes all the way up pays all three latencies.
5. Throughput and latency: Little's law and the queueing cliff
Capacity planning for a judgment service comes down to one identity. The number of requests in flight equals the arrival rate times the time each request spends in the system (Little's law). At a design rate of 190 requests per second and an assumed median latency of 150 ms for the first tier, about 29 requests are in flight at peak. That tells you how many concurrent connections, workers or inference slots you need before any safety margin.
Do not run those slots at full utilization. As utilization approaches 100 percent, queueing delay grows sharply, and tail latency, not the median, is what users and upstream timeouts experience. A common planning target is to hold steady-state utilization well below saturation, for example around 60 percent, so a burst has room to absorb. For the figures above, 29 in-flight requests at 60 percent utilization means provisioning for roughly 48 slots. Treat that as an illustration of the method, and derive your own target by load testing.
Batching trades latency for efficiency
Self-hosted inference gets much cheaper per request when requests are batched, because the accelerator reads the model weights once for many requests. The cost is waiting: a request may sit in a queue until a batch fills or a short timer fires. Set the maximum wait to a small fraction of your latency budget. Continuous batching in modern serving engines reduces the waiting, since new requests join a running batch, but it does not remove the trade-off.
Timeouts, hedging and load shedding
- Set a timeout per tier from the observed p99, not from the median, and make every call carry an idempotency key so a retry cannot double-apply a decision.
- Hedged requests (sending a second copy after a short delay) cut tail latency but add load. Use them on the fast tier only, and cap them to a small fraction of traffic.
- When overloaded, shed the least valuable work first: skip optional enrichments, serve cached decisions, and degrade to the safe default, before the whole service queues up and times out.
6. Caching and deduplicating decisions
A surprising amount of traffic repeats. The same device checks in every minute, the same template arrives again, the same question is asked by a thousand users. A decision cache can remove a large share of calls, and its savings land at the front of the funnel, before any tier is paid for.
- Exact-match caching is safe and boring. Key on a hash of the normalized input plus the prompt version and the model version. Including those versions matters: a cached answer produced under an old prompt is a stale decision.
- Semantic caching (matching on embedding similarity) saves more and can silently return the wrong answer for a near-miss. Use it only where a wrong answer is cheap, and set a strict similarity threshold.
- Time to live should follow how fast the underlying facts change. A fraud score on a fresh account should expire in minutes. A classification of a static document can live for days.
- Privacy: a cache is a second copy of user data. Apply the same retention and access rules as the primary store.
Also deduplicate in flight. If ten identical requests arrive within the same moment, run one and fan its result out to the rest.
7. Buying metered calls or running your own
At low volume a hosted, per-call service wins because you pay only for use and carry no operational burden. At high volume the question gets real. The break-even is a formula you can fill in:
self-hosted monthly cost = (accelerator hours × hourly rate) ÷ utilization + staff time + networking + monitoring
Compare it with the hosted monthly invoice at your volume. The term most often underestimated is utilization. A GPU sized for peak traffic and idle overnight bills for the whole day. Staff time is the second: someone must handle upgrades, scaling, incident response and model updates, and that person's time has a price. Hidden benefits favor self-hosting when you have steady load, strict data-residency rules or a need to fine-tune. Hidden benefits favor hosted when load is spiky, your team is small or you value not owning on-call for inference.
- Measure real peak and average load for a month before deciding.
- Price the self-hosted option at the utilization you expect to achieve, not at 100 percent.
- Add staff time and failure handling honestly, including the cost of an outage.
- Get a committed-volume quote from the hosted vendor, because list price at 100 million requests is rarely what you would pay.
- Prefer a design that lets you switch, with decisions defined by typed inputs and outputs rather than vendor-specific prompts, so the answer can change as volume does.
8. Governing spend: attribution, budgets and common mistakes
The incident that started this article, nobody knowing what one decision costs, is a governance failure, and it is fixable with plumbing.
- Tag every call with the feature, the decision type, the tier and the prompt version. Without tags, the invoice is one number.
- Report cost per correct decision for each decision type weekly, next to the escalation rate and the error rate.
- Set budgets with alerts at the decision-type level, and a hard ceiling per feature so a runaway loop stops itself.
- Keep a kill switch for each tier, with the safe fallback defined, so you can shut off an expensive path in minutes.
- Verify before claiming a saving. A cost reduction counts only after you re-measure error rate and latency on live traffic. A routing change that saves money and quietly raises errors is a regression.
Common mistakes
- Optimizing price per token while ignoring prompt length, which usually dominates.
- Choosing the escalation threshold once and never revisiting it as the input mix drifts.
- Retrying without a cap or without backoff, turning a brief outage into a bill spike.
- Logging full payloads for every request and discovering the storage cost later.
- Letting several teams add their own judgment calls to the same user action.
- Benchmarking with a clean test set and deploying into messy production input.
9. A worked pass and what to do Monday
Take the payments team. They process 100 million checks a month, with an assumed peak of five times average. Their first move is measurement: tag calls, learn the real peak-to-mean ratio, the real token counts, the retry rate and the share of cases that really need the strongest model. Say they find that prompts carry 300 tokens of boilerplate the decision never uses. Removing it takes 30 billion input tokens a month out of the bill without touching accuracy. They then add an exact-match cache keyed on normalized input plus prompt version, which removes the repeats at the front. A two-tier cascade follows, with the escalation threshold chosen from a labeled sample so the measured error rate stays inside the limit finance set for false approvals. Finally they publish cost per correct decision on a weekly dashboard and put a kill switch on the top tier. None of these steps needs a new model. All of them need data the team did not have in month one.
- Tag every judgment call by feature, decision type, tier and prompt version this week.
- Measure peak-to-mean ratio, token counts, retry rate and per-tier latency from real logs.
- Write down the cost of a false positive and a false negative for each decision type.
- Run the cascade script with your measured numbers and see which input moves the result most.
- Trim the prompt, cap retries and add an exact-match cache before reaching for anything more exotic.
- Set a per-feature budget ceiling and a tested fallback for each tier.
Short FAQ
Is a small judgment model always cheaper than a large general model? Per call, usually yes. Per correct decision, only if its accuracy on your task is adequate. Measure both.
Where do savings usually come from first? Prompt length, retries, caching and routing, in that rough order, before any infrastructure change.
How do I know the cascade is not hiding errors? Sample decisions from every tier, including the ones that were not escalated, send them to labeling and track error rate per tier over time.
What changes if volume grows another ten times? Utilization, batching and the build-or-buy break-even shift first. Rerun the model with the new inputs rather than extrapolating, and keep verification gates on each change, so cost work never ships an unmeasured behavior change.