---
title: "Provider routing"
description: "Filter and order the hosts that serve a request."
---

# Provider routing

The `provider` object chooses which hosts can serve a request and in what order. A provider here means a host, named as in `X-PG-Host` (for example `DeepInfra`) or by its tag.
Requests without it use the model's default order, with the pinned host first.

| Field | Type | Effect |
|---|---|---|
| `order` | string[] | Try these hosts first, in this order, then the other eligible hosts. |
| `only` | string[] | Allow only these hosts. |
| `ignore` | string[] | Never use these hosts. |
| `sort` | string, or object with `by` | Order by `price`, `throughput` or `latency`. Throughput and latency use each host's configured figures. |
| `allow_fallbacks` | boolean | `false` tries only the hosts named in `order`, or only the first host without `order`. |
| `data_collection` | string | `deny` keeps only hosts marked as never keeping data. |
| `zdr` | boolean | `true` keeps only hosts marked zero data retention. |
| `quantizations` | string[] | Keep hosts running these quantizations; `unknown` matches a host that states none. |
| `max_price` | object | Highest `prompt` and `completion` price, in USD per 1M tokens, at our price. |

```sh
curl https://api.plaingateway.com/api/v1/chat/completions \
  -H "Authorization: Bearer $PLAINGATEWAY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "deepseek/deepseek-v4-flash", "messages": [{"role": "user", "content": "Hello"}], "provider": {"order": ["Azure"], "max_price": {"prompt": 1, "completion": 4}}}'
```

Any other field in `provider` or `max_price`, a bad `sort` value, or a `data_collection` other than `allow` or `deny` returns 400.

## Account settings

Two account settings apply to every request from your account's keys. Changes reach the gateway within about 10 seconds.

| Setting | Page | Effect |
|---|---|---|
| **Allow fallbacks** off | [/settings/preferences](https://plaingateway.com/settings/preferences) | The same as `provider.allow_fallbacks: false`: one host per model, and that host's error is returned. A request that sets `provider.allow_fallbacks` overrides it. |
| **Zero data retention only** on | [/settings/privacy](https://plaingateway.com/settings/privacy) | The same as `provider.zdr: true`, and a request cannot turn it off. See [Zero data retention](../features/zero-data-retention.md). |

The other choices on the Routing page (host order, allowed and ignored hosts, max price) are saved but do not change API requests. Send them in `provider`.

## When no host is left

Filters run in this order: API shape, `only`, `ignore`, `quantizations`, `data_collection`, `zdr`, `max_price`. The first filter that leaves no host ends routing with 404:

```json
{
  "error": {
    "message": "No endpoints found matching your provider.only list",
    "code": 404,
    "metadata": {
      "routing_funnel": [{"step": "Initial Endpoints", "endpoint_count": 2}, {"step": "Filter by API Shape", "endpoint_count": 2}],
      "failed_routing_step": "Filter by Only"
    }
  }
}
```

`routing_funnel` lists how many hosts were left after each step that ran. `failed_routing_step` names the step that left none.
