Senior

How would you design an LLM gateway for a company?

How to answer it in an AI engineer interview: what is being tested, a step-by-step framework, a sample answer and the mistakes to avoid.

$19.99 on Gumroad, instant download40% off with code EARLYBF until Nov 3, 11:59 PM PTEARLYBF: 40% off until Nov 3

Smaller start: Score your answers against 50 rubrics, $9. 50 AI engineer questions, one rubric each, PDF on Gumroad.

Practiced one out loud? Paste your answer into the free self-check and get a score in 30 seconds

What the interviewer is testing

Whether you can design shared platform infrastructure for LLM use: reliability, cost control, security and observability across many teams.

Answer framework

  1. Unified API: one interface for many providers and self-hosted models, so teams do not integrate each one.
  2. Access control: per-team keys, quotas, rate limits and budgets.
  3. Routing: choose models by policy, with fallbacks on errors and timeouts, and retries with backoff.
  4. Efficiency: response and prompt caching, and streaming passthrough.
  5. Governance and observability: logging with PII redaction, cost attribution per team, data-residency rules and dashboards.

Sample answer

A gateway sits between internal applications and model providers. Its first job is a single API, often OpenAI-compatible, that can reach several hosted providers and our own models. Teams integrate once, and the platform team can add or swap models without every application changing code.

Second is control. Each team gets its own credentials, quotas, rate limits and monthly budget, and provider keys never leave the gateway. Routing policies decide which models a team may use and where traffic goes: for example, a cheaper model by default, a stronger one for specific use cases, and automatic fallback to another provider when one returns errors or exceeds a latency threshold. Retries use backoff and respect provider rate limits.

Third is efficiency and governance. Exact-match caching and provider prompt caching cut cost on repeated requests. Streaming is passed through without buffering. Every request is logged with team, model, tokens, cost and latency, with personal data redacted, so we can attribute spend and debug. Policy hooks can block sensitive data from going to external providers and keep regulated data in approved regions. The gateway itself must be highly available, since it is now on the critical path for every AI feature.

Likely follow-ups

What is the biggest risk of a central gateway? It becomes a single point of failure and a latency hop, so it needs redundancy, low overhead and a careful rollout.

Common mistakes

The PlaybookWant the full method?

The 0 to 1 AI Engineer Interview Playbook covers the answer frameworks, system-design walkthroughs and an 8-week plan.

Get the playbook 40% off with code EARLYBF until Nov 3, 11:59 PM PTEARLYBF: 40% off until Nov 3

Smaller start: Score your answers against 50 rubrics, $9. 50 AI engineer questions, one rubric each, PDF on Gumroad.

Interviewing for PM or TPM? See the full PM package, $59 on Gumroad: a resume system, a PM, TPM and PGM interview handbook, a 1:1 cheat sheet and a PM playbook. PM and TPM content, not AI engineer prep.

Related questions

Based on question #75 in the full question bank.