techdiagrams.net
← All templates

LLM serving gateway

One gateway for all model traffic: cheap-first routing cascade, fallback models, hedged requests, prefix/KV caching, continuous batching and a hard budget governor.

Open in editor — free, no login Download JSON
MODEL FLEET — SIZED BY THE ROUTER, NOT BY HOPEpromptwithin budgetprefix hit? skip prefilleasy 80% · also the fallbackhard 20%batched decodehedge at p95Product teamsevery AI feature in the orgLLM GatewayauthN · quotas · budget governorModel routercheap-first cascadePrefix / KV cacheshared system promptsSmall modelfast · handles ~80%Continuous batcherin-flight batching · GPU-saturatingFrontier model — replica Athe expensive 20%Frontier model — replica Bhedge targetthe cascade is the cost model:small model $0.10/M handles 80%,frontier $10/M handles 20% —blended cost drops ~7× vs frontier-only.

What this design does

Every team calling model APIs directly is a cost incident waiting to happen. This gateway centralizes the discipline: a router sends the easy 80% to a small fast model and escalates only what needs the frontier model; shared prompt prefixes skip prefill via KV cache; a continuous batcher keeps GPUs saturated; slow requests hedge to a second replica; and a budget governor enforces per-team quotas before the bill does. When the frontier model is down, the cascade degrades gracefully instead of erroring.

The patterns it composes

Import it, attach your own numbers, and verify the design against failures — or read the engineering notes.