# Provider selection (/docs/fleet/provider-selection)

> For AI agents, the [documentation index](https://bitrouter.ai/llms.txt) lists all pages. Append .md to a documentation URL to read its Markdown.

By default every request goes to the best provider available at that moment, balancing price, speed and
reliability, and moves to the next provider of the same model if one fails. You can change what "best"
means and which providers are allowed.

## Pick what to optimize for \[#pick-what-to-optimize-for]

Add a profile to the model id:

| Model you send                   | Picks the provider with                                       |
| -------------------------------- | ------------------------------------------------------------- |
| `deepseek-v4.1-flash`            | The best balance of price, speed and reliability (`balanced`) |
| `deepseek-v4.1-flash:cost`       | The lowest price                                              |
| `deepseek-v4.1-flash:latency`    | The fastest first token                                       |
| `deepseek-v4.1-flash:throughput` | The most tokens per second                                    |

An unknown suffix is not an error: the request runs as `balanced`.

## Allow or exclude providers \[#allow-or-exclude-providers]

Provider lists live in a [preset](https://bitrouter.ai/docs/fleet/provider-selection#presets), so you set them once instead of on every request:

```json
{
  "name": "eu-only",
  "model": "deepseek-v4.1-flash",
  "routing": {
    "only": ["provider-a", "provider-b"],
    "sort": "cost"
  }
}
```

| Field            | Effect                                                             |
| ---------------- | ------------------------------------------------------------------ |
| `routing.only`   | Only these providers may serve the request. Empty means any        |
| `routing.ignore` | These providers never serve it                                     |
| `routing.sort`   | The default profile: `balanced`, `cost`, `latency` or `throughput` |

Then send `"model": "@eu-only"`. A profile on the request still wins over the preset's `sort`:
`@eu-only:latency` uses the preset's providers but picks the fastest. If none of the allowed providers can
serve a request, it fails rather than going to one you excluded. Choosing providers never adds a fee: you
pay the [live price](https://bitrouter.ai/docs/pricing).

## Provider fallback \[#provider-fallback]

When a provider fails, the request moves to the next one serving the same model, and stays inside the
providers the preset allows. See [Reliability](https://bitrouter.ai/docs/spot/reliability).

## Presets \[#presets]

A routing preset is a named set of defaults that a request picks up by naming it. Use one to change the
model, prompt or providers behind an app without redeploying it: the app sends `@support-bot`, and you
change what `@support-bot` means in the console.

```python
resp = client.chat.completions.create(
    model="@support-bot",
    messages=[{"role": "user", "content": "Where is my order?"}],
)
```

### What a preset holds \[#what-a-preset-holds]

| Field           | Used for                                                                                                                                                      |
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `name`          | What requests call it by. Letters, digits, `-` and `_`                                                                                                        |
| `model`         | The model to run, for example `deepseek-v4.1-flash`                                                                                                           |
| `system_prompt` | A system prompt for requests that don't send one                                                                                                              |
| `params`        | Generation parameters such as `temperature` or `max_tokens`, for requests that don't set them                                                                 |
| `routing`       | Which providers may serve it and what to optimize for; see [Provider selection](https://bitrouter.ai/docs/fleet/provider-selection#pick-what-to-optimize-for) |

The request always wins: a system prompt or parameter it sends is kept, and the preset only fills what's
missing. A preset can't set `model`, `messages` or `stream` inside `params`.

### Calling a preset \[#calling-a-preset]

| Model you send                     | Runs                                                                                                                                   |
| ---------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| `@support-bot`                     | The preset's model, with its defaults                                                                                                  |
| `@support-bot/deepseek-v4.1-flash` | That model instead of the preset's, with the preset's other defaults                                                                   |
| `@support-bot:latency`             | The preset, picking the fastest provider; see [profiles](https://bitrouter.ai/docs/fleet/provider-selection#pick-what-to-optimize-for) |

A request that names a preset that doesn't exist, or one that is disabled, fails with a `400`. It never
falls through to a default model.

### Manage presets \[#manage-presets]

* **In the console:** **Strategies**. Create, edit, disable and delete presets there.
* **From code:** the [routing presets API](https://bitrouter.ai/docs/api/routing-presets), with a key that has the
  `routing_preset:read` and `routing_preset:write` scopes.

```bash
curl https://api.spareinference.ai/v1/namespaces/me/routing-presets \
  -H "Authorization: Bearer $SPARE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "support-bot", "model": "deepseek-v4.1-flash", "system_prompt": "Answer in two sentences.", "params": {"temperature": 0.2}}'
```

Changes apply from the next request. Disabling a preset keeps it for later; deleting it is permanent.