LLM gateway with provider failover

A Java shop puts a service mesh or API gateway in front of internal services. An LLM gateway does that plus three things a mesh does not: it counts tokens as well as requests, it holds long streaming connections open, and it decides which vendor's model answers.

45 min round 6 computed numbers 4-part eval plan 8-point rubric
⚠️ Planning numbers, not measurements. Hardware and model facts are dated on the numbers sheet; traffic, prices and efficiency are labelled assumptions. Replace them with your own measurements (the vLLM load-test exercise) before quoting them.

The prompt

Design an internal gateway that gives every team one API over multiple LLM providers, with rate limits and failover.

Attempt it first: the 45-minute round

Set the timer, answer out loud or on paper, then score yourself against the rubric before you read the model answer below.

  1. Framing (5 min) — Ask questions, fix the scale and the latency/quality/cost targets, state assumptions with numbers.
  2. Architecture (10 min) — Draw the boxes end to end: data in, the model call, storage, serving, feedback.
  3. Deep dive (15 min) — Pick the hardest part and do the arithmetic: tokens/s, KV memory, QPS → replicas, cost per 1,000 requests.
  4. Trade-offs (10 min) — Name what you would trade (batch vs latency, quality vs cost, build vs buy) and what breaks.
  5. Wrap-up (5 min) — Evaluation plan, monitoring, failure modes, and what you would do next.
45:00
Not started

Self-grade

Tick what you did. 0 of 8.

The model answer, step by step

Five steps, one tap each. The readout gives the step's answer and lists the numbers it uses; the same numbers are highlighted in the table underneath.

LLM gateway with provider failover, one tap per step

👉 Predict first, then tap. Every number below is computed from the assumptions in the table.

1. Framing

5 min

2. Architecture

10 min

3. Deep dive

15 min

4. Trade-offs

10 min

5. Wrap-up

5 min

Tap a step above.
QuantityHow it is computedValue
Peak requests per second, all teamsassumption300
Average stream duration, secondsassumption8
Open streams one gateway node can hold (assumed)assumption1,000
Availability zonesassumption3
Provider error/timeout rate (assumed, independent)assumption2%
Tokens per request (input + output)assumption1,500
Tokens per minute one provider key allows (assumed)assumption4,000,000
Concurrent open streams (Little's law)rps × duration2,400
Nodes to hold them⌈streams ÷ per-node⌉3
Nodes so losing one AZ still fits⌈need × azs ÷ (azs − 1)⌉5
Requests failing on both providerspFail × pFail0.04%
Tokens per minute at peakrps × 60 × tokens27,000,000
Provider keys/accounts needed⌈tokens/min ÷ per-key limit⌉7
Takeaway. The headline figure — nodes so losing one az still fits — is 5 (⌈need × azs ÷ (azs − 1)⌉). Say the assumption, show the formula, then give the number.

The evaluation plan

Go deeper on this site

Check yourself