# Fallbacks and availability

> What happens when a model fails, is slow, or is taken away, and how your route keeps answering.

Applies to: the Sypnia engine (open source, self-hosted) and Sypnia Cloud (paid service).  
Source: https://ai.docs.sypnia.com/models/fallbacks-and-availability/

For agents: Fallbacks: tried in order on provider error (5xx), rate limit from provider, timeout before first token (default 20 s, route param first_token_timeout_s), refusal for capacity; not on 4xx caused by the request (bad schema, content blocked). Streaming: only before the first token is sent; after that an error event. Each attempt is a child span; only the attempt that answered is charged (a failed attempt that already produced tokens is charged its tokens). All fail → 503 provider_unavailable with the attempts. Retired models: the catalog marks retiring date; routes using it get a notice 30 days before; pinned routes move to the default for the task on retirement.

## When the next model takes over

A route's `fallbacks` are tried in order when the model:

- answers with a provider error or is overloaded;
- has not started answering after **20 seconds** (change it with `params.first_token_timeout_s`);
- refuses for lack of capacity.

Fallbacks are **not** tried when the request itself is the problem: an invalid schema, a blocked content check, a context too long for every model. You get that error at once.

When answering in a stream, a fallback can only take over before the first words are sent. After that, a failure arrives as an `error` event in the stream, so your app can say «something went wrong, try again».

## What you are charged

Only the attempt that answered is charged. A failed attempt that had already produced some tokens is charged those tokens. Every attempt is a step in the trace, so you can see which model answered and why the others did not.

When every model fails, you get `503 provider_unavailable` with each attempt and its reason.

## When a model goes away

Providers retire models. The catalog shows a model's retirement date, and every project with a route using it gets a notice **30 days** before. On the day, a route still on that model moves to the task's default (Cloud) or to its first fallback (self-hosted), and the change is recorded in the routes' history.
