# Routing strategy

> How DigitSpace ranks a model's providers by price, speed and health, how to set the strategy per project, and how to override it per request.

Source: https://digitspace.ai/docs/routing/strategy · Last checked: 2026-10-31

A model is often served by more than one provider at different prices and speeds. The routing strategy decides the order they're tried in.

| Strategy  | Dashboard name   | Ranks offers by                                                        |
| --------- | ---------------- | ---------------------------------------------------------------------- |
| `auto`    | Balanced         | A mix of price and speed, half each by default. This is the default.   |
| `price`   | Cheapest         | Lowest estimated cost for this request, then success rate, then speed. |
| `latency` | Fastest response | Lowest expected response time, then cost.                              |

Whatever the strategy, **healthy offers come first**. An offer counts as healthy until it has at least 10 recent results and fewer than 90% of them succeeded.

## Set it for a project

In the dashboard, open **Routing** and choose a **Routing strategy**. Owners, admins and the project's project admins can change it.

On the Enterprise plan, **Custom settings** on the same page also set:

- **Providers to try:** how many offers a request may try, from 1 to 5 (3 by default).
- **Healthy threshold:** the success rate an offer needs to count as healthy, from 50% to 99%.
- **Balance:** the weight of cost against speed for the Balanced strategy.
- **Caller region:** see [Regions](/docs/routing/regions).

## Override it per request

Send the `X-DigitSpace-Routing` header with `price`, `latency` or `auto`. Any other value is ignored and the project's setting applies.

```bash
curl https://api.digitspace.ai/v1/chat/completions \
  -H "Authorization: Bearer $DIGITSPACE_API_KEY" \
  -H "X-DigitSpace-Routing: latency" \
  -H "Content-Type: application/json" \
  -d '{ "model": "gpt-6-luna", "messages": [{ "role": "user", "content": "Hi" }] }'
```

## How cost and speed are estimated

- **Cost** is the offer's input price times the estimated input tokens, plus its output price times `max_tokens` (512 when not set).
- **Speed** is the offer's median response time once it has 10 or more measured requests, otherwise 800 ms. Network distance between the caller's [region](/docs/routing/regions) and the provider's is added to it.
