F9 · Floor 9 · Platform Ops
Unbounded Consumption: The Midnight Bill
Nothing went down. The API just spent $38,000 while everyone slept. In this lesson you investigate the incident, reproduce the attack yourself, then fix it.
Unbounded Consumption in brief
Unbounded consumption is letting users consume unlimited compute: floods of requests, huge prompts and outputs, endless agent loops, or mass querying to copy the model. With pay-per-token AI, the result is often a huge bill rather than an outage, which is why it's called denial of wallet.
What you'll learn
- Rate-limit and set quotas per user, per API key and per organisation, enforced on the server.
- Cap input size and output tokens on the server. Never let the client decide.
- Make free accounts cost something to create (verification, payment method, organisation quotas).
- Set spend caps, alerts and circuit breakers, plus step and budget limits for every agent task.
- Watch for extraction patterns and limit what you expose (such as log-probabilities).
Why it matters
Teams have woken up to five-figure AI API bills after leaked keys, unthrottled public endpoints or runaway agent loops. Researchers have also shown that querying a model at scale can produce a cheaper copy of its behaviour, which is why many providers limit outputs like log-probabilities and watch for extraction patterns.
Designing cost-safe LLM APIs
Layer the controls: limits on requests and tokens per key, per user and per organisation; server-side caps on context length and output tokens; queue length and timeout limits; and abuse friction at sign-up, such as email or phone verification, a payment method or manual review for higher tiers.
Budgets belong at every level: per request, per agent task (max steps, max tokens, max wall-clock time), per customer and for the whole service, with alerts well before the hard stop and a circuit breaker that throttles rather than fails outright.
Model extraction is quieter. Watch for systematic topic sweeps and very high volumes, limit log-probabilities and other rich outputs, and watermark or fingerprint outputs where you can. Your terms of service should forbid training on outputs.