02

1:48 - 3:48

Model Gateway: Controlled Model Access at Scale

Watch from 1:48

The Model Gateway is Uber's common entry point for model requests. Instead of every team integrating directly with every model provider, callers use one OpenAI/Anthropic-compatible endpoint. The gateway then applies shared controls before routing each request to an appropriate model.

The important idea is not only convenience. A common ingress point concentrates responsibilities that are difficult to manage consistently when every application implements them separately:

  • authenticate the caller;
  • protect personally identifiable information (PII);
  • apply safety and policy checks;
  • route requests to frontier or open-source models;
  • keep gateway overhead within a stated bound; and
  • record attribution and execution traces.

This makes model access a managed platform capability rather than a collection of one-off provider integrations.

Source boundary: The points above describe the chapter's account of the Model Gateway. The examples and mental models below explain why those choices matter; they are teaching context, not additional claims about Uber's implementation.

The basic mental model: one controlled ingress, many providers

Without a gateway, an organization might have a structure like this:

Project A ──► Provider 1
Project B ──► Provider 2
Project C ──► Provider 1 or 3

Each project would need to solve authentication, privacy handling, policy enforcement, routing, usage attribution, and observability. The organization would also need to update many integrations when a provider changes its API.

The gateway changes the shape of the system:

                         ┌──► Frontier model
Project ──► Model Gateway ├──► Open-source model
                         └──► Other eligible provider

The gateway does not mean that all models are identical. It hides provider plumbing behind a familiar client surface, while the routing decision can still select different model families. Model choice remains a system concern, but individual callers do not each have to build the transport and governance around that choice.

What happens to a request?

Consider an engineer using a standard model client. The engineer supplies a project identifier along with the request. That small amount of caller-visible configuration gives the platform a way to associate the request with a project and apply the common gateway path.

A simplified sequence is:

  1. The client sends a request. The application uses the compatible endpoint rather than a provider-specific endpoint.
  2. The gateway identifies the caller. Authentication establishes who or what is making the request.
  3. The gateway protects sensitive input. The described flow includes PII anonymization.
  4. The gateway applies guards. Safety and policy checks can reject, transform, or constrain requests according to the platform's rules.
  5. The gateway chooses a route. The request can be sent to an eligible frontier or open-source model.
  6. The gateway records responsibility and execution. Project attribution and traces connect the request to its later analysis.
  7. The client receives the model response. The provider-specific details remain behind the common access layer.

The project identifier is therefore more than a billing label. It can be the key that connects access control, usage ownership, and later evidence about how the model was used.

At about 3:27, the visible code illustrates the familiar client surface and project identifier. The adjacent gateway behavior is described by the talk; the code itself does not expose every internal control.

Why common ingress matters

Privacy and policy are easier to make consistent

If privacy protection is implemented separately by many teams, the organization must keep all those implementations correct and up to date. A gateway provides one place where the organization can apply anonymization and policy checks to model traffic.

This does not make privacy or policy automatic. It gives those requirements a common enforcement location. The organization still needs clear rules, tests, exception handling, and ownership. The platform benefit is that callers do not have to rediscover the same controls for every new model integration.

Routing becomes a platform decision

Different requests can have different needs. One may need a powerful frontier model. Another may be suitable for an open-source model. A common gateway can keep the caller interface stable while the platform selects an eligible destination.

The abstraction is useful because it separates two concerns:

Concern Caller sees Gateway manages
Request shape A compatible model client Provider-specific plumbing
Identity A caller and project identifier Authentication and attribution
Data handling The request payload PII anonymization and policy controls
Model destination A requested capability or model choice Routing to eligible providers
Operations A response Traces, overhead measurement, and shared controls

The gateway hides implementation differences. It does not remove the differences in model capability, cost, latency, or behavior. Those differences still matter when selecting a route and evaluating the result.

Accountability follows the request

Central attribution makes it possible to ask questions such as: Which project made this request? Which route handled it? What controls ran? How long did the gateway layer take? What happened during the resulting agent execution?

The source specifically connects the gateway with traces. A trace is a record of execution steps. In an agentic system, that record can include more than a single model response because the model may participate in a larger chain of calls and tool actions.

This is important for more than chargeback. If a project makes repeated model requests, traces can provide evidence for finding patterns, investigating failures, and improving later evaluations. Observability becomes part of the learning loop rather than merely a billing record.

A gateway's latency is not the answer's latency

One easy measurement mistake is to confuse the time added by gateway middleware with the total time needed to answer a request.

Imagine a teaching example in which:

  • the gateway's middleware takes 80 milliseconds; and
  • the selected provider takes 1.8 seconds to generate the answer.

The first number describes the gateway layer. The second describes provider generation. End-to-end response latency includes both, along with other network and processing time.

Total response time
  = gateway overhead
  + network/provider work
  + model generation
  + any other request processing

A bound on gateway overhead is still valuable. Shared controls should not add unbounded delay. But an 80 ms middleware target must not be presented as an 80 ms answer time. Good platform measurement names the layer being measured.

The visible gateway architecture

The chapter's first visual places the gateway between callers and model providers. Its middleware includes blocks for identity, anonymization, guards, caching, and routing.

At about 2:28, the visual makes the controlled-ingress design concrete. It shows the gateway as the place where these shared concerns sit between applications and providers.

The blocks suggest a pipeline, but the deeper design principle is centralization. Each block answers a different platform question:

  • Identity: Who is calling, and is the caller authorized?
  • Anonymization: Can sensitive information be protected before it reaches a model?
  • Guards: Does the request satisfy safety and organizational policy?
  • Cache: Can eligible prior work be reused instead of repeated?
  • Routing: Which supported model destination should handle this request?

These controls are related, but they are not interchangeable. A cache can reduce repeated work. It does not authenticate a caller. A router can select a model. It does not by itself provide a privacy boundary. Putting them in one managed path makes their interaction visible and governable.

Traces turn access into evidence

Suppose a project sends many model requests while building an agentic workflow. The gateway can associate those requests with the project and preserve traces of the path taken. Over time, those traces can help answer questions such as:

  • Which requests are failing or being blocked?
  • Which model routes are used for a workflow?
  • Where is time spent: gateway middleware or model generation?
  • What execution patterns should a later evaluation test?

The source does not claim that a trace alone solves evaluation. The useful connection is narrower: centralized traces create evidence that later evaluation and improvement loops can consume. Without that evidence, teams may know only that an answer was unsatisfactory. With it, they have more information about the request path that produced the result.

This is one reason the gateway belongs in a broader agent platform. It supplies a controlled foundation for later stages. The next layers can build on the same pattern: shared infrastructure provides capabilities, while traces and outcomes provide feedback about how those capabilities work in practice.

What this layer does—and does not—solve

The Model Gateway solves a specific platform problem: controlled, observable, provider-flexible access to models at organizational scale.

It does not by itself:

  • decide whether a product idea is valuable;
  • supply all the context an agent needs;
  • provide an execution environment for code changes;
  • define the procedure for completing a software task; or
  • prove that a model response or generated change is correct.

Those responsibilities belong to other layers and later validation loops in the lesson. The gateway is the front door. A strong front door controls entry, routes traffic, and records what happened, but it is not the whole software factory.

Chapter takeaway

Uber's Model Gateway treats model access as shared infrastructure. A compatible endpoint gives teams a simple client surface. The gateway adds identity, privacy, policy, routing, attribution, and traces around that surface. The result is not merely easier model switching. It is a common control and evidence path that makes model use safer to operate and easier to improve at scale.

Source visuals

The six managed-software-factory building blocks.

The navigation names Model Gateway, MCP Gateway, DevPods, Agent Skills, Context Graph, and AI Assistant, providing the map used by the next chapters.

Source at 1:50
Model Gateway middleware between callers and providers.

The visible identity, anonymization, guard, cache, and routing blocks make the controlled-ingress mechanism concrete.

Source at 2:28
A standard client configured with a project identifier.

The code illustrates how complexity stays behind a familiar client surface while the adjacent gateway supplies controls.

Source at 3:27
100% Space + drag to pan | Ctrl/Cmd + wheel to zoom