Design Per-Key Rate Limiting for a Hosted Model Inference API
Last updated: November 29, 2026
Quick Overview
Design rate limiting for a public API that serves hosted LLM and vision model endpoints, enforcing per-API-key limits on requests per minute and tokens per minute across many regional gateways.
NVIDIA
November 29, 20260
0
0 solved
Design rate limiting for a public API that serves hosted LLM and vision model endpoints, enforcing per-API-key limits on requests per minute and tokens per minute across many regional gateways.
A rate limiting question in the style of NVIDIA's hosted model catalog and NIM microservice endpoints, where each request consumes scarce GPU time and token counts vary widely between requests. The interviewer checks that you pick a sensible algorithm, know where the counters live, and handle the fact that output tokens are only known after generation.
What the Interviewer Expects
- Chooses token bucket or sliding window and explains the burst behavior
- Limits on both request count and tokens, since GPU cost tracks tokens
- Stores counters in a fast shared store with atomic updates
- Reserves estimated tokens up front and reconciles after the response
- Returns 429 with Retry-After and rate limit headers
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 rate limit when the shared counter store is unreachable?
- How would you give enterprise customers guaranteed capacity rather than just a cap?
- How do you stop one customer's long prompts from hurting others' latency even within their limits?
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
Functional: per-key limits such as 60 requests per minute and 100,000 tokens per minute, different per tier and per model; clear errors when exceeded. Non-functional: added latency under a few millise...
High-Level Design
Requests hit an API gateway that authenticates the key and looks up its limits from a config cache. A rate limit check runs before the request is queued for a GPU worker. Counters live in a Redis clus...