Design a rate limiter for a model API, then add compound and payload-aware rules
MediumSystem design45 minSWEMLEPro outline
The question
Design the rate limiting layer for a public model API. Start with requests per user per minute.
Then the interviewer adds rules: a limit per IP at the same time, and a limit on tokens per minute so a huge prompt counts more than a small one. Finally, implement the core check.
What the interviewer is looking for
- Clarifies limits, keys and what happens on rejection
- Compares token bucket, fixed window, sliding log and sliding window counter
- Makes compound rules all or nothing
- Handles payload cost, including requests bigger than the limit
- Discusses a shared store and what happens when it is slow or down
Your answer
Saved in this browser only. Nobody else sees it.
Why this question
Written by BlogLLM in the style of a publicly reported xAI question type: Rate limiter later extended to compound rules and payload-aware limits.
Reported in: aced.io, customcareer.miami.edu
Practice question written by BlogLLM based on publicly reported interview formats. Not an official xAI question.