docs/Models & Routing
Model Fallbacks & High Availability Routing
Automatic failover across models to eliminate rate limit errors (429) and provider downtime (502).
How Fallbacks Protect Production Traffic
Production AI applications frequently suffer from unexpected upstream rate limits (HTTP 429), regional datacenter outages, or server overload (HTTP 502/503).
Unlocked AI solves this through the `models` array parameter. Provide an ordered list of fallback models. If the primary model fails or returns a provider error, Unlocked AI immediately cascades to the next model in the list within milliseconds without breaking your user's connection.
Atomic Credit Settlement
Credits are debited only for the model that successfully fulfills the request. If a fallback occurs, your account balance is atomically reconciled to match the exact model that generated the completion.
Implementing Fallback Arrays
Pass the `models` array in your JSON body or via `extra_body` in Python / TypeScript:
from openai import OpenAI
client = OpenAI(
base_url="https://unlockedai.net/v1",
api_key="<YOUR_UNLOCKED_API_KEY>",
)
# Unlocked AI will cascade: Claude Sonnet 5.5 -> GPT-5 -> DeepSeek R1
response = client.chat.completions.create(
model="claude-sonnet-5.5",
messages=[{"role": "user", "content": "Analyze mission-critical transaction log."}],
extra_body={
"models": ["claude-sonnet-5.5", "gpt-5", "deepseek-r1"]
}
)
print(f"Responded by: {response.model}")
print(response.choices[0].message.content)Need an Unlocked AI Key or Credits?
Generate secret API keys backed by non-expiring pay-as-you-go credits starting at $5. No monthly minimums.