Reliability
When a provider fails, the request moves to the next provider serving the same model. What happens before and during a response, and what you pay.
A request can fail because a provider is down, slow, rate limited or out of capacity. Spare retries it on the next provider that serves the same model before you see an error, so most provider failures never reach your code. It never switches to a different model.
Before the response starts
Every request to https://api.spareinference.ai gets this, with no setup. Each model has several providers;
when the one serving your request fails, the next one in line takes it.
| What happened | Falls back? |
|---|---|
| The provider returned a server error, or was unavailable | Yes |
| The provider timed out | Yes |
| The provider rate limited the request (429) | Yes |
| The provider rejected the request's parameters, or its own credentials | Yes; another provider may accept it |
| The provider doesn't serve the model after all | Yes |
| Your request is malformed, your key is invalid or lacks a scope | No: every provider would refuse it |
| Your balance can't cover it (402) | No |
If every provider fails, you get the last provider's error, with x-bitrouter-error-source: upstream so
you can tell it came from the providers and not from Spare. The error codes are the
same as without fallback.
While a response is streaming
What happens when a provider fails after it has started streaming, what your client receives, and how the partial response is billed.
Which providers are tried
The providers tried are the ones your request allows: with a routing preset
that sets routing.only or routing.ignore, fallback stays inside that list. Each request's
settlement and the console's Activity page show which
provider finally served it, and you pay the price of that provider.
Requests that fail
If every provider fails, the request isn't charged.
Falling back to a different model
Spot only ever answers with the model you asked for. To fall back to another model, such as your own Claude model when Spot can't answer, see Model fallbacks.
How is this guide?