---
title: "Model fallbacks"
description: "Name other models to try when the first one fails."
---

# Model fallbacks

Set `model` to the model you want and `models` to the ones to try next, in order. `models` alone also works; its first entry is then the first choice.

```sh
curl https://api.plaingateway.com/api/v1/chat/completions \
  -H "Authorization: Bearer $PLAINGATEWAY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "openai/gpt-5.6-luna", "models": ["deepseek/deepseek-v4-flash"], "messages": [{"role": "user", "content": "Hello"}]}'
```

The gateway lists every eligible host of the first model, then of the next, and tries them in that order. An eligible host is one left after the `provider` filters.
It moves to the next host on a connection error, a timeout before the host answers, a 5xx, a 429 or a 408.
With `provider.allow_fallbacks: false`, or with **Allow fallbacks** off in your [account settings](provider-routing.md#account-settings), each model gets one host. The models in `models` are still tried in turn.
It does not move on after another 4xx, such as a context length error: you get that error.
Once a stream has started, it never moves on.
The `model` field of the answer and `X-PG-Host` show what served the request.
