Provider routing
Filter and order the hosts that serve a request.
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. Each value is a number or a decimal string, such as 1 or "1". image, audio and request are accepted and have no effect. |
require_parameters |
boolean | Accepted; no effect yet. |
preferred_max_latency |
number or object | Accepted; no effect yet. |
preferred_min_throughput |
number or object | Accepted; no effect yet. |
enforce_distillable_text |
boolean | Accepted; no effect yet. |
options |
object | Accepted; no effect yet. |
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}}}'These are OpenRouter's fields, with OpenRouter's types. A field OpenRouter does not have, in provider or max_price, a value of the wrong type, a bad sort value, or a data_collection other than allow or deny returns 400.
Account settings
The rules on a workspace's Routing page apply to every request from that workspace's keys, and the Privacy settings to every key of your account. See Workspaces. Changes reach the gateway within about 10 seconds.
| Setting | Page | Effect |
|---|---|---|
| Default provider choice | /settings/preferences | The same as provider.sort. Pinned means no sort. A request that sets provider.sort overrides it. |
| Allow fallbacks off | /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. |
| Allowed providers | /settings/preferences, or the Provider access card on /guardrails | Only these hosts serve. A request's provider.only can narrow the list but never widen it, so a request that names only other hosts gets 404. |
| Ignored providers | /settings/preferences, or the Provider access card on /guardrails | These hosts never serve. They are added to the request's provider.ignore, and a request cannot remove them. |
| Max price | /settings/preferences | The same as provider.max_price.completion, in USD per 1M output tokens. A request that sets provider.max_price.completion overrides it, and a request that sets it to null has no max price. Like max_price, it never drops your own provider keys. |
| Zero data retention only on | /settings/privacy | The same as provider.zdr: true, and a request cannot turn it off. See Zero data retention. |
/settings/preferences opens your default workspace's Routing page, and /guardrails its Guardrails page. Both edit the same allowed and ignored providers lists of that workspace, so neither one wins: the last save applies.
When no host is left
Filters run in this order: API shape, only, the allowed providers setting, ignore (with the ignored providers setting), quantizations, data_collection, zdr, max_price, and settings rules (a host that routes on its own, such as an OpenRouter-compatible gateway, never serves while any Routing or Privacy setting applies). The first filter that leaves no host ends routing with 404:
{
"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.
Model allow and block lists
Each workspace's Guardrails page has a Model access card with two lists. /guardrails opens the default workspace's page. The lists apply to every request from that workspace's keys, on chat completions, completions, messages, responses and embeddings. Changes reach the gateway within about 10 seconds.
| List | Effect |
|---|---|
| Allowed models | Only these models can be used. Leave it empty to allow every model. |
| Blocked models | These models can never be used. |
- A model on both lists is blocked: the block list wins over the allow list.
- A variant matches its base model. Allowing
openai/gpt-6-lunaalso allowsopenai/gpt-6-luna:nitroandopenai/gpt-6-luna:floor, and blocking it blocks both. See Model variants. - Each list holds at most 200 models from the catalog.
- The gateway checks
modeland every entry ofmodels(see Model fallbacks). It drops each model the lists do not allow and tries the rest in order. Embeddings take nomodels, so onlymodelis checked there. - The request fails with 403 only when no model is left.
With deepseek/deepseek-v4-flash as the only allowed model, this request skips openai/gpt-6-luna and is served by deepseek/deepseek-v4-flash:
curl https://api.plaingateway.com/api/v1/chat/completions \
-H "Authorization: Bearer $PLAINGATEWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "openai/gpt-6-luna", "models": ["deepseek/deepseek-v4-flash"], "messages": [{"role": "user", "content": "Hello"}]}'Without the models entry, nothing is left, and the answer is 403. The message names the first model in the request:
{
"error": {
"message": "Model openai/gpt-6-luna is not allowed in this workspace (Guardrails)",
"code": 403
}
}On /messages the same message comes in Anthropic's error shape.