Track cheat sheet
Running LLM APIs cheat sheet
Calling model APIs in production: 429s that mean different things, quotas, token budgets, prompt caches, fallbacks and retired models.
Key concepts
- Not every 429 is a rate limit
- Model providers use 429 for rate limits, ramp limits and spend caps, and only the first clears by waiting.
- Under quota per minute, throttled per second
- A per-minute quota is enforced over seconds, so bursts are throttled though the minute is under quota.
- Headroom you reserved but never used
- Some providers count max_tokens against the per-minute token limit before the answer exists.
- The cache that never hit
- Prompt caches match the exact prefix, so one changing value near the top makes every request a miss.
- Denial of wallet
- LLM cost follows tokens, so one account with huge inputs can spend everyone's budget.
- Fallback kept uptime, broke quality
- A fallback model is a different product: uptime stays green while answers change.
- Pinned until it retires
- Pinned model snapshots are retired on a schedule, and requests to them then fail.
Decision rules
- Branch on the error code: back off, slow the ramp, or fail fast and page.
- Pace requests evenly with a token bucket; queue batch work behind interactive traffic.
- Size max_tokens per route from real answer lengths; know each provider's counting rule.
- Stable content first, changing content last; graph the cache-read share.
- Per-user token budgets and input limits at the gateway; spend cap as the backstop.
- Evaluate every model in the chain, record which one served, alert on fallbacks.
- Inventory callers by key and service; migrate behind evals well before the date.
Common traps
- Retrying every 429 the same way, including a cap that lasts until next month.
- Firing a minute's work at :00 and trusting a per-minute dashboard.
- max_tokens: 8,000 everywhere 'to be safe', and throttling at a fraction of real use.
- A timestamp or request ID at the top of the system prompt.
- One organisation-wide cap as the only control, cutting off every user at once.
- An untested fallback and a dashboard that only counts successes.
- A forgotten batch job still naming the old snapshot on retirement day.
Lessons and boss fights
- Not every 429 is a rate limit · 3 min
- Under quota per minute, throttled per second · 3 min
- Headroom you reserved but never used · 3 min
- The cache that never hit · 3 min
- Denial of wallet · 3 min
- Fallback kept uptime, broke quality · 3 min
- Pinned until it retires · 3 min
Real outages on this track: Forty-eight tries per failure · Headroom that never came back · The models that vanished
BuildBreak · Running LLM APIs · each line comes from its lesson, where the sources are linked.