Model fallbacks
Try the next model when a request fails
Please write them in order in the “models” section.
If there is a surge in requests or if there are any issues with the supplier, we will move on to the next model. The models that have been answered can be seen in the model section of the response.
client.chat.completions.create(
model="anthropic/claude-opus-5.5",
messages=[{"role": "user", "content": "Hello"}],
extra_body={"models": ["openai/gpt-6-luna"]},
)When will they leave?
| Situation | What they do |
|---|---|
| The supplier is busy or has encountered errors (5xx). | Let’s move on to another supplier of the same model. Then, we’ll move on to the next model in that category. |
| No connection is established. | Let’s try it again after that. |
| Compliance with safety standards of the supplier | Let’s move on to the next candidate. If there’s no answer, we will inform you that the candidate has failed to meet the safety standards. |
| And there’s also an issue with the requested price being incorrect (400). | Here, I’ll inform you of the errors. |
- It can hold up to 5 items in the
modelssection. - The fees actually correspond to the price of the actual model. Those attempts that fail will not incur any fees.
- Once the answers start to appear, we don’t stop there. Instead, we continue to move on to the next model. This is because the text that has already been received gets mixed together with the new text.