Design Per-Tenant Rate Limits Across Multiple LLM Providers
Last updated: November 29, 2026
Quick Overview
Design a service that enforces per-customer request and token quotas for model calls while also respecting each upstream LLM provider's rate limits, so one busy customer cannot starve others.
Sierra
November 29, 20260
0
0 solved
Design a service that enforces per-customer request and token quotas for model calls while also respecting each upstream LLM provider's rate limits, so one busy customer cannot starve others.
Sierra routes agent traffic to several model providers and serves many enterprise customers at once. This question checks that you can pick a rate limiting algorithm, place it correctly, and reason about fairness when upstream capacity is the true bottleneck.
What the Interviewer Expects
- Choose token bucket or similar and explain why
- Limit on tokens as well as requests
- Keep counters in a shared low-latency store
- Model upstream provider limits separately from tenant quotas
- Define behavior when a limit is hit (queue, fall back, reject)
Key Topics to Cover
How to Approach This
- Start by clarifying functional and non-functional requirements with the interviewer.
- Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
- Draw a high-level architecture first, then deep dive into 1-2 critical components.
- Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
- Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
- How do you charge tokens before you know the output length?
- How would you add priority so voice calls win over batch summarization?
- What happens if Redis is unavailable?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
Each tenant has limits like 500 requests per second and 2 million tokens per minute. Each provider account has its own limits. The check must add under 5 ms. A tenant that exceeds its quota is throttl...
High-Level Design
A model gateway sits in front of all providers. For each call it checks two buckets in Redis: the tenant bucket and the chosen provider bucket. Buckets use token bucket semantics, implemented ...