AI EngineeringInterview preparation
Intermediate·Concept·2 min read

Gateways, routing, fallback, quotas, and observability

Practice this question

🟠 SHOULD KNOW · A gateway centralizes model-access policy; it does not replace application-level authorization.

Overview

  • An AI gateway sits between your application and model providers.
  • It can normalize access, choose approved models, enforce quotas, collect usage, and handle eligible fallback.
  • It is similar to an API gateway specialized for model traffic.

Why this matters

Several applications otherwise duplicate provider credentials, routing, logging, and spending controls.

An everyday example

A company's travel desk applies approved suppliers and budgets to employee bookings.

A technical example

All AI services call one internal endpoint with tenant/task identity; the gateway selects an approved provider and records usage.

How it works

  1. Authenticate service
  2. Apply tenant/model/data policy
  3. Check budget and limits
  4. Select provider
  5. Normalize events/errors
  6. Record usage
  7. Return result.

Architecture and flow

Application → AI gateway → approved provider adapters → model services.

The insurance assistant example

The insurer separates customer-chat budgets from overnight document processing and prevents fallback outside allowed regions.

When to use it

Multiple providers/apps, centralized policy, or spending/usage control requirements.

When to avoid it

A single small service can start with a direct SDK and clear limits. Avoid adding a gateway as an unmeasured latency bottleneck.

Interview answer

“An AI gateway centralizes provider access, quotas, routing, fallback, and telemetry while business authorization stays in the application.”

Benefits, trade-offs, and production considerations

  • The gateway is a sensitive dependency and failure point.
  • Secure credentials, test streaming/backpressure, preserve original usage/error semantics, and make fallback data policy explicit.
  • Tool writes must not be duplicated by gateway retries.
Adapted from 13_AI.MD · “Gateways, routing, fallback, quotas, and observability”. Code examples are study fragments. Difficulty and core labels are editorial estimates; version-specific behavior should be checked against your project.