Design Per-Organization Rate Limits for a Model API

Last updated: November 29, 2026

Quick Overview

Design the system that enforces requests-per-minute, input-tokens-per-minute and output-tokens-per-minute limits for every organization calling a hosted model API, across a globally distributed gateway fleet.

Anthropic
System Design
Software Engineer
Anthropic
November 29, 2026
Software Engineer
System Design Round
System Design
Medium

0

0

0 solved


Design the system that enforces requests-per-minute, input-tokens-per-minute and output-tokens-per-minute limits for every organization calling a hosted model API, across a globally distributed gateway fleet.

The Claude API enforces tiered usage limits per organization on requests and on tokens, and output tokens are not known until generation finishes. Interviewers use this to see whether you can adapt a classic rate limiter to a workload where cost is uncertain at admission time, and whether you reason about accuracy versus latency across many gateway replicas.

What the Interviewer Expects
  • Separates request, input-token and output-token limits and explains why tokens are the real capacity unit
  • Chooses a token bucket or sliding window and justifies it
  • Handles unknown output cost with a reservation that is reconciled after completion
  • Designs a shared counter store with local batching to keep latency low
  • Defines failure behavior when the counter store is unavailable
  • Returns useful headers and 429 responses with retry-after
Key Topics to Cover
rate limiting
token bucket
distributed counters
quotas
API gateways
How to Approach This
  1. Start by clarifying functional and non-functional requirements with the interviewer.
  2. Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
  3. Draw a high-level architecture first, then deep dive into 1-2 critical components.
  4. Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
  5. Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
  • How would you handle a long streaming response that runs past the minute window it started in?
  • A customer has several workspaces that share an org-level limit. How do you model nested limits?
  • How would you prevent a burst from many regions at once from overshooting the global limit?
  • How do limits interact with prompt caching, where cached input tokens are cheaper to serve?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice System Design Problems
Sample Answer
Requirements

Functional: per-org limits on RPM, input TPM and output TPM, set by usage tier and overridable per customer; reject with 429 and retry-after; expose remaining budget in response headers. Non-functio...

High-Level Design

Request path: gateway authenticates the API key to an org, looks up the org's limits (cached config from a limits service), then checks three token buckets. Input tokens are counted at the gateway wit...


Submit Your Answer
Markdown supported