Design a Multi-Tenant Low-Latency LLM Inference API
Last updated: November 29, 2026
Quick Overview
Design an OpenAI-compatible inference API that serves several open models on a pool of accelerator systems, streams tokens at very high per-user speed, enforces per-customer rate limits by requests and tokens, and stays available when a system fails.
Cerebras
November 29, 20260
0
0 solved
Design an OpenAI-compatible inference API that serves several open models on a pool of accelerator systems, streams tokens at very high per-user speed, enforces per-customer rate limits by requests and tokens, and stays available when a system fails.
A public inference cloud lives or dies on time to first token, decode speed and reliability, while each model replica is an expensive, scarce system. The interviewer wants a design that respects that scarcity: smart routing, token-aware rate limits, streaming, and graceful failure.
What the Interviewer Expects
- Separates the stateless API gateway from the scarce model replicas and a scheduler
- Designs token-based rate limiting (tokens per minute) as well as requests per minute
- Routes requests by model, load and prefix-cache affinity
- Streams over SSE with correct handling of client disconnects
- Covers failure of a replica mid-stream and capacity isolation between tiers
- Puts numbers on capacity and latency budgets
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 price and meter usage accurately when streams are cut off?
- How would you add a new model with little capacity without hurting existing ones?
- How do you protect free-tier traffic from starving paying customers?
- How do you roll out a new compiled model version safely?
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: chat and completion endpoints compatible with the OpenAI schema, streaming and non-streaming, several models, API keys per organization, usage metering. Non-functional: p50 TTFT a few hund...
High-Level Design
Clients hit a global load balancer, then a stateless gateway fleet that authenticates keys, validates requests, counts prompt tokens with the model's tokenizer, and checks rate limits in Redis. Admitt...