Problems / Design a product, hard

Build an LLM inference API like the Claude API: the full interview

Design the platform behind an LLM API the way Anthropic, Google and Meta ask it: streamed answers with a fast first token, long-context calls on a cached prefix, per-org rate limits, multi-region GPU fleets, a Batch API, exactly-once usage billing, safety classifiers and a developer console, then survive launch day, a lost GPU region, bots, a jailbreak campaign, a usage-stream outage, a huge batch job and a DDoS attack.

Unlock it once for 25 credits; everything inside it is free (runs, changes, Submit, results, hints). Sign in with Google to start; new accounts get free credits.

What it must do

Scale

Request types to route: messages (50%, write), agent (15%, write), batch (5%, write), meta (15%, read), console (10%, read), usage (5%, read). Budget: $18,000,000 a month.

Estimate first

The test cases

You start from an empty canvas. When you run the tests, each one simulates your design with its own traffic and failures:

TestWhat it doesPasses when
Normal dayThe normal day: the traffic in the brief, nothing broken.Success ≥ 99%; Success ≥ 99% (messages); First token p99 ≤ 1.5 s (messages); First token p99 ≤ 4.0 s (agent); p99 latency ≤ 150 ms (meta); p99 latency ≤ 400 ms (console); Success ≥ 99% (batch); p99 latency ≤ 300 ms (batch)
Launch day: 3× trafficAt 5 s a new model launches: all traffic triples for 8 s, far past what the GPU fleets can serve.Success ≥ 99% (meta); p99 latency ≤ 300 ms (meta); Success ≥ 99% (batch); First token p99 ≤ 2.5 s (messages); Success ≥ 70%
A GPU region goes darkAt 5 s the primary chat GPU fleet fails (a power event takes out the region’s GPU cluster) and stays down for its restart time; every answer streaming from it is cut off.Success ≥ 98% (messages); First token p99 ≤ 2.5 s (messages)
Bots on stolen API keysAt 5 s 3,000 requests a second from a botnet arrive at the Messages API for 10 s, sent with leaked and stolen API keys, alongside real traffic.Attack blocked ≥ 90%; Success ≥ 99%; First token p99 ≤ 1.5 s (messages); First token p99 ≤ 4.0 s (agent)
A jailbreak campaignAt 5 s 400 requests a second of prompt-injection and jailbreak attempts arrive for 10 s, sent with real API keys alongside real traffic.Attack blocked ≥ 90%; Success ≥ 99%; First token p99 ≤ 1.5 s (messages); First token p99 ≤ 4.0 s (agent)
The usage stream goes downAt 5 s the usage event stream crashes; it comes back after its restart time (10 s unless you set one). While this test runs, brokers redeliver unacknowledged messages after 5 s and 0.2% of acknowledgements are lost, as in production: only idempotent consumers avoid duplicates.No lost events; No duplicate side effects; Success ≥ 99% (messages)
A runaway agent loopAt 5 s one customer’s agent gets stuck in a loop: long-context agent calls jump 5× for 8 s; every other request type is unchanged.Success ≥ 99% (messages); First token p99 ≤ 1.5 s (messages)
A huge batch job landsAt 5 s a customer submits a batch of millions of prompts: the batch workers take 10× longer for 10 s.Success ≥ 99% (batch); p99 latency ≤ 300 ms (batch); First token p99 ≤ 1.5 s (messages); First token p99 ≤ 4.0 s (agent)
DDoS attackAt 5 s 30,000 requests a second of flood traffic arrive for 10 s, alongside real users.Attack blocked ≥ 95%; Success ≥ 99%; First token p99 ≤ 1.5 s (messages); First token p99 ≤ 4.0 s (agent)
Budget: $18,000,000/monthThe normal day's design must cost at most $18,000,000 a month.Cost ≤ $18,000,000/month

Must include

More design a product problems