> For the complete documentation index, see [llms.txt](https://docs.uptiq.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.uptiq.ai/platform/control-center/ai-gateway/how-model-routing-works.md). Agents can also search and read this documentation through its [MCP server](https://docs.uptiq.ai/~gitbook/mcp).

# How Model Routing Works

Understand families, providers, gateways, credentials, and tiers before you configure them.

For each model request, the gateway selects a family, resolves a tier to a model, and sends the request through an available provider.

Read this page before you open [Gateway Settings](https://docs.uptiq.ai/platform/control-center/ai-gateway/gateway-settings.md). The screens there expose one field per concept below, and the fields make more sense once the routing model is clear.

## Routing building blocks

{% columns %}
{% column %}

#### Model and family

A **model** is an individual endpoint, such as *Claude Sonnet 4.5* or *GPT 4o*.

A **model family** groups related models from one vendor. Configuration applies at the family level, not to individual models.
{% endcolumn %}

{% column %}

#### Provider and gateway

A **provider** hosts and serves a model.

A **gateway** routes a family's requests to its configured providers and applies authentication and failover.
{% endcolumn %}
{% endcolumns %}

A **tier** sits on top: it names a capability level, and each family maps its own model to each tier.

## Who controls what <a href="#who-controls-what" id="who-controls-what"></a>

Model access narrows at each level:

1. **The platform catalog** lists the model families and models that exist.
2. **Your organization** enables the providers and models its accounts may use.
3. **Your account** configures each family in [Gateway Settings](https://docs.uptiq.ai/platform/control-center/ai-gateway/gateway-settings.md), within the organization's selection.

A model that exists on the platform isn't necessarily available to your account. The account also can't use a provider or model the organization hasn't enabled. [Model Catalog](https://docs.uptiq.ai/platform/control-center/ai-gateway/model-catalog.md) lists only what your account can route to.

## Model families

Enable only the families your organization approves. Exactly one enabled family is the default: it handles any request that doesn't name a family, and setting a new default removes the previous one.

| Family        | What it offers                                                                    |
| ------------- | --------------------------------------------------------------------------------- |
| **Anthropic** | Claude Sonnet, Opus, and Haiku. Reasoning, long context, and vision.              |
| **Gemini**    | Gemini Pro and Flash. Long context, fast, low-cost inference. Default as shipped. |
| **OpenAI**    | GPT 4o, GPT 4.1, GPT 5.x, and the o-series. General reasoning and tool use.       |

**Gemini and Google name the same family.** [Gateway Settings](https://docs.uptiq.ai/platform/control-center/ai-gateway/gateway-settings.md) labels it Gemini; [Model Catalog](https://docs.uptiq.ai/platform/control-center/ai-gateway/model-catalog.md) labels it Google. The underlying family is the same.

## Providers

A family can use more than one provider. When several providers are enabled for a family, the gateway has more than one path to the same model.

Some families are available only during set hours. Outside them, [Model Catalog](https://docs.uptiq.ai/platform/control-center/ai-gateway/model-catalog.md) shows **Unavailable now** with the schedule, and requests to the family fail.

| Family    | Available providers                                |
| --------- | -------------------------------------------------- |
| Anthropic | Anthropic direct; GCP Model Garden; Amazon Bedrock |
| Gemini    | Google AI Studio; Google Agent Platform            |
| OpenAI    | OpenAI direct; Azure OpenAI                        |

The provider you choose decides more than availability. It decides which cloud account runs the inference, which region it runs in, and who the provider bills.

Amazon Bedrock accepts any form of Bedrock model ID. Requests to Vertex AI go to regional endpoints.

## Gateways and credentials

{% tabs %}
{% tab title="AI Gateway" %}
The default gateway. It provides managed routing, retries, caching, failover, and observability. Configure each provider in the family with a **UPTIQ managed key** or **Bring your own key**.
{% endtab %}

{% tab title="OpenRouter" %}
An alternative gateway that uses your organization's own OpenRouter API key. OpenRouter is bring-your-own-key only: there is no **UPTIQ managed key** for it, and no fallback to one when the key is missing. The key is checked when you enter it. The models offered are the platform's models in the family that OpenRouter can serve, within your organization's model selection; other models on your OpenRouter account aren't listed. Requests for the family are proxied through OpenRouter to whichever upstream serves the model.
{% endtab %}
{% endtabs %}

| Credential option      | Who supplies it   | Who is billed                   |
| ---------------------- | ----------------- | ------------------------------- |
| **UPTIQ managed key**  | The platform      | Your credit balance             |
| **Bring your own key** | Your organization | The provider bills you directly |
| **OpenRouter key**     | Your organization | OpenRouter bills you directly   |

A single family can mix managed and bring-your-own-key providers under **AI Gateway**.

{% hint style="warning" %}
OpenRouter chooses the upstream provider itself, so you don't control which one serves a request or where it runs. Where region residency matters, use **AI Gateway** with your own key against your own provider tenancy instead.
{% endhint %}

## Model tiers

An application requests a **tier**, not a model name. The tier resolves to whichever model the family currently maps to it.

This is the point of the whole arrangement. An administrator can move the Smart tier from one model to a newer one, and every agent that asks for Smart picks up the change. No agent is edited, and no model name is hard-coded anywhere.

{% columns %}
{% column %}

#### Economy

Routing, classification, extraction, and reranking. Prioritizes speed and cost for high-volume work.
{% endcolumn %}

{% column %}

#### Smart

Synthesis, specialist tasks, reports, and drafts. The balanced choice for most agents.
{% endcolumn %}

{% column %}

#### Premium

The hardest reasoning. Prioritizes quality over latency and cost.
{% endcolumn %}
{% endcolumns %}

{% hint style="warning" %}
Nothing stops you from mapping all three tiers to the same model, and the product doesn't warn when you do. Choose distinct models where you want a real difference in cost or capability.
{% endhint %}

## What routes through the gateway

An agent sends every model call through AI Gateway: the conversation itself and the smaller calls it makes behind the scenes. Those background calls ask for a tier, not a model, so remapping a tier in [Gateway Settings](https://docs.uptiq.ai/platform/control-center/ai-gateway/gateway-settings.md) changes them too.

| Call                    | Model used                                                                                                                                       |
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| Planning and execution  | The agent's [Planning Model and Execution Model](https://docs.uptiq.ai/platform/console/agent-builder/build/agent-behavior.md#advanced-controls) |
| Knowledge queries       | Economy tier when the agent's **Response Mode** is **Flash**; Smart tier when it's **Balanced**                                                  |
| Document summaries      | The agent's execution model, or the Economy tier if it has none                                                                                  |
| Document classification | Economy tier                                                                                                                                     |
| Conversation titles     | Economy tier                                                                                                                                     |

Because the gateway handles every one of these calls, it also handles their failover. See [When a call can't be served first time](#when-a-call-cant-be-served-first-time).

### Model families for agents <a href="#model-families-for-agents" id="model-families-for-agents"></a>

An agent's **Model Family** field lists the families the gateway serves for your organization. Agents can use the **Google** (Gemini) and **OpenAI** families. Other families, such as Anthropic, aren't offered for agents in production yet. Where they appear, they're marked **Dev only**.

The agent builder only offers what your deployment can serve:

* A family the gateway can't serve isn't listed.
* A model the gateway can't serve is greyed out in the **Planning Model** and **Execution Model** lists.
* A new agent starts on models the gateway can serve. If the default family isn't available, it starts on one that is.
* A saved family or model that's no longer available stays visible, marked **Unavailable**, so the field is never blank.

## How a request routes

```
Application request
  → named family, or the default family
  → Economy, Smart, or Premium tier
  → the model mapped to that tier
  → the family's gateway
  → an eligible provider
  → model response
```

A tier that maps to a model whose provider isn't configured fails at request time. Confirm availability in [Model Catalog](https://docs.uptiq.ai/platform/control-center/ai-gateway/model-catalog.md) before you assign a tier.

### When a call can't be served first time <a href="#when-a-call-cant-be-served-first-time" id="when-a-call-cant-be-served-first-time"></a>

The gateway works through a ranked list of candidates: each eligible provider for the mapped model, then the family's other tiers in fallback order.

| Requested tier | Fallback order                    |
| -------------- | --------------------------------- |
| Economy        | Economy, then Smart, then Premium |
| Smart          | Smart, then Premium, then Economy |
| Premium        | Premium, then Smart, then Economy |

* **Rate limits, timeouts and provider errors.** The gateway retries, then moves on to the next candidate.
* **Outages.** A model and provider pair that keeps failing is marked as in outage and moved to the end of the list, so it is tried last. A successful call clears the mark.
* **Errors that end the request.** The gateway stops in three cases. The request is longer than the model's context window. A provider's content policy or safety filter blocks it. Or it would exceed a credit usage limit. It doesn't try another candidate, because the same request would fail there too.
* **Streamed replies.** The gateway can fail over only before the first part of the reply is streamed. Once output has started, a failure ends the request with an error rather than switching models part-way through.
* **When every candidate fails.** The agent tells the user, in plain words, whether the provider was rate-limited or unavailable, rather than showing a generic error.

### Stopping a streamed reply <a href="#stopping-a-streamed-reply" id="stopping-a-streamed-reply"></a>

When someone stops an agent's reply while it streams, the gateway stops the model request. It doesn't try another model, and the stop isn't counted as a provider failure.

If output had already started, the call is charged an estimate for the prompt and the partial reply. If it was stopped before any output, nothing is charged.

#### Requests for JSON or a response schema <a href="#requests-for-json-or-a-response-schema" id="requests-for-json-or-a-response-schema"></a>

A call can ask for a JSON reply, or for a reply that matches a fixed schema. The gateway tries the models that can honour that format first. If none of the remaining candidates can, the call still goes to the best one left, with the format dropped, rather than failing.

{% hint style="warning" %}
**A reply isn't guaranteed to be JSON.** The requested format is a preference, not a guarantee, so validate the shape of the reply in your own code. Today, only OpenAI, Google and RunPod models enforce a response schema.
{% endhint %}

## Custom providers <a href="#custom-providers" id="custom-providers"></a>

A platform administrator can add a provider that serves models over an OpenAI-compatible API, such as a self-hosted model server. It is set up with a base URL, including `/v1`, and an API key. RunPod models are served this way.

For these models:

* Replies stream as they are generated, and reasoning streams when the model shares it.
* The model can call the agent's tools.
* A request for a response schema is enforced; a request for JSON asks the model for valid JSON.
* The maximum reply length applies. Temperature isn't sent to a model that doesn't support it.
* Reasoning effort **minimal** turns thinking off. **Low** and **medium** are sent to the model. **High** leaves the model server's own default.

If the base URL doesn't point to a compatible model server, the call fails with an invalid-response error.

## Native on Cloud

Native on Cloud keeps model hosting and inference inside a cloud tenancy your organization controls. Route through GCP Model Garden, Google Agent Platform, or Azure OpenAI where the deployment must make no calls to public AI APIs.

Region is set on the provider credential rather than centrally in the gateway, because it's the provider resource that's region-bound. An Azure OpenAI endpoint belongs to the region its resource was created in, and a GCP credential carries its project and region.

For how this works in a bank-owned deployment, see [Security FAQ](https://docs.uptiq.ai/platform/control-center/detailed-security-and-runtime-faq.md).

## What's next

{% content-ref url="/pages/343aaa4879c5a104577605f40e609d50bd458c53" %}
[Gateway Settings](https://docs.uptiq.ai/platform/control-center/ai-gateway/gateway-settings.md)
{% endcontent-ref %}

{% content-ref url="/pages/0234ae24d9852b23bf66d3b16e74afcbacbfc9c2" %}
[Model Catalog](https://docs.uptiq.ai/platform/control-center/ai-gateway/model-catalog.md)
{% endcontent-ref %}

{% content-ref url="/pages/dzL0uehLrltnUN0AaRLD" %}
[Credit usage](https://docs.uptiq.ai/platform/control-center/cost-control/credit-usage.md)
{% endcontent-ref %}

{% content-ref url="/pages/3jztUoFeNO8fhlTwaw7T" %}
[Security FAQ](https://docs.uptiq.ai/platform/control-center/detailed-security-and-runtime-faq.md)
{% endcontent-ref %}

{% content-ref url="/pages/I59HzEvpXa0tjAaqrtTo" %}
[Glossary](https://docs.uptiq.ai/platform/start-here/glossary.md)
{% endcontent-ref %}

***

{% columns %}
{% column width="83.33333333333334%" %}

<p align="right"><em>Maintained by</em> <mark style="color:green;">Abhishek Paul</mark><br><code>AI-assisted, human-approved</code></p>
{% endcolumn %}

{% column width="16.666666666666664%" %}

<div align="left"><img src="https://1326225582-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0qmgQjJ5aArDTj2ACFHG%2Fuploads%2Fgit-blob-d034645b4f8f8ee661985f5306b60ded3289653c%2Fmaintainer-abhishek-paul.png?alt=media" alt="" width="60"></div>
{% endcolumn %}
{% endcolumns %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.uptiq.ai/platform/control-center/ai-gateway/how-model-routing-works.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
