> ## Documentation Index
> Fetch the complete documentation index at: https://docs.neuraltrust.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Smart routing

> Route each request by prompt complexity across Simple, Medium, and Hard tiers — pick cheaper models for easy prompts and stronger models for hard ones, configured on the consumer Routing tab.

**Smart routing** is a [load balancing](/trustgate/routing/load-balancing) strategy that
classifies each prompt's complexity and sends the request to the matching **tier**
(registry + model). Use it when you want cost-efficient defaults for easy traffic and
stronger models only when the prompt needs them.

In the console it is the first option under **Strategy** → **Load balancing**.

## Complexity labels

Every tier uses one of three fixed labels. Operators never set numeric thresholds — only
these labels appear in the UI:

| Label      | Typical traffic                                                                |
| ---------- | ------------------------------------------------------------------------------ |
| **Simple** | Short, low-stakes, or straightforward prompts. Prefer cheaper / faster models. |
| **Medium** | Everyday product traffic that needs a balanced model.                          |
| **Hard**   | Long, multi-step, or demanding prompts. Prefer stronger models.                |

Each label can be used **at most once** per consumer. You need **at least two** tiers
(for example Simple + Hard, or Simple + Medium + Hard).

## When to use it

| Use smart routing when…                                                        | Prefer another strategy when…                                                |
| ------------------------------------------------------------------------------ | ---------------------------------------------------------------------------- |
| You have two or more model strengths (e.g. mini vs flagship) for the same app. | Traffic should split evenly or by fixed weight regardless of prompt content. |
| You want clients to send `"model": "auto"` and let the gateway choose.         | Every request must hit one fixed model (use **Simple routing**).             |
| Different complexity bands may share a registry but need **different models**. | You only need ordered failover (use **Fallback**).                           |

## How it works

1. The client calls the consumer (typically with `"model": "auto"` — see
   [Model resolution](/trustgate/routing/model-resolution)).
2. TrustGate classifies the prompt into a complexity band: **Simple**, **Medium**, or
   **Hard**.
3. It selects the tier configured for that label.
4. The request is forwarded to that tier's **registry** and **model**.
5. If the pick fails and [fallback](/trustgate/routing/fallback) is configured, TrustGate
   can retry another path.

Example configuration:

| Complexity | Registry    | Model             |
| ---------- | ----------- | ----------------- |
| **Simple** | OpenAI prod | `gpt-4o-mini`     |
| **Medium** | OpenAI prod | `gpt-4o`          |
| **Hard**   | Anthropic   | `claude-sonnet-…` |

A straightforward prompt lands on **Simple**; a demanding multi-step prompt lands on
**Hard**. Tiers that share a registry with different models are supported and common.

## Configure in the console

1. Open **Consumers** → select a consumer → **Routing**.
2. Set **Routing mode** to **Static**.
3. Open **Strategy** → **Load balancing** → **Smart routing**.
4. Open **Complexity tiers**.
5. Add **at least two tiers** (the UI blocks save with fewer).
6. For each tier set:
   * **Complexity** — **Simple**, **Medium**, or **Hard** (each label once).
   * **Registry** — upstream provider connection.
   * **Model** — model used when that band is selected.
7. Save. Open **Connect** — snippets use `"model": "auto"`.

### Rules the UI enforces

| Rule                          | Why                                                                  |
| ----------------------------- | -------------------------------------------------------------------- |
| **≥ 2 tiers**                 | A single tier is not meaningful routing; use Simple routing instead. |
| **Unique complexity labels**  | Each of Simple / Medium / Hard may appear only once.                 |
| **Registry + model required** | Every tier must resolve to a concrete upstream model.                |

You can point several tiers at the **same registry** with **different models** — that is
supported and common (one OpenAI connection, mini vs full model per band).

## Clients and `auto`

With smart routing enabled, applications should send:

```json theme={null}
{ "model": "auto", "messages": [ … ] }
```

The consumer **Connect** tab and [Playground](/trustgate/console/playground) already use
**Auto** for this strategy. Do not hard-code a single model id unless you intentionally
want to bypass complexity selection (and the model is allowed on the consumer).

## Tips

* Put the cheapest capable model on **Simple** so most easy traffic stays inexpensive.
* Use **Medium** for the default production model when you need three bands.
* Reserve **Hard** for models that justify the cost on difficult prompts.
* Pair with [LLM Budget](/trustgate/policies/rate-limiting#llm-budget) if you need hard
  spend ceilings on top of routing.
* Watch [Analytics](/trustgate/console/analytics) (Cost / LLM) after rollout to confirm tier
  mix matches expectations.
* Use [Fallback](/trustgate/routing/fallback) if an upstream outage should retry another
  registry instead of failing the request.

## Related

* [Load balancing](/trustgate/routing/load-balancing) — other algorithms (round-robin,
  weighted, least-connections, random).
* [Model resolution](/trustgate/routing/model-resolution) — `auto`, short names, and model
  filters on the consumer.
* [Consumers](/trustgate/concepts/consumers) — Routing tab overview.
