Dynamic model fallbacks
Graceful degradation instead of broken user experiences.
When a tenant nears its budget, or a provider starts failing, PALM SOUQ reroutes the request in the gateway: to a cheaper model, another provider, or a cached answer. Your users keep working and your margin stays intact.
{
"chain": "support-agent",
"version": 23,
"primary": "claude-sonnet-4.5",
"rules": [
{ "when": { "provider_error_rate_gt": 0.05, "for": "60s" },
"route_to": "gpt-4.1" },
{ "when": { "tenant_budget_pct_gte": 90 },
"route_to": "claude-haiku-4.5",
"notify": "quota.downgraded" },
{ "when": { "tenant_budget_pct_gte": 100 },
"serve": "response_cache",
"on_miss": "claude-haiku-4.5" }
],
"preserve": ["tools", "system", "max_tokens"]
}Chain builder
Build a chain, then push the budget past the threshold.
Choose the models, move the budget slider, simulate a provider error spike. The serving node and the cost per call update from the PALM SOUQ price table.
Primary
Claude Sonnet 4.5
$0.0270/call
servingProvider failover
GPT-4.1
$0.0168/call
Budget ≥ 90%
Claude Haiku 4.5
$0.0090/call
Budget ≥ 100%
Response cache
$0 on hit
Budget at 72%, under the 90% downgrade threshold. Primary provider healthy.
$0.0270 /call
primary price
Switching policies
Three triggers, evaluated on every request.
Rules are checked in order in the edge worker, inside the same latency budget as quotas and breakers.
- 01
Budget downgrade
A tenant crosses a share of its monthly budget, 90% by default. Move them from a frontier model such as GPT-4o to GPT-4o mini or DeepSeek V3.2, and send quota.downgraded so your app can tell the user.
- 02
Provider failover
A provider's error rate or latency passes a threshold for a sustained window. Route to a model from a different provider, for example OpenAI to Anthropic Claude Sonnet 4.5, and return when health checks recover.
- 03
Cache at cap
At 100% of budget, answer repeated read-only queries from the response cache at zero model cost, and send cache misses to the cheapest model in the chain instead of returning an error.
Downgrade economics
What a downgrade saves, per thousand calls.
Each call priced at 6,000 input and 600 output tokens, uncached, from current list prices in the PALM SOUQ price table.
| Primary | Per 1k calls | Fallback | Per 1k calls | Saved |
|---|---|---|---|---|
| GPT-4.1 | $16.80 | GPT-4.1 mini | $3.36 | 80% |
| GPT-4o | $21.00 | GPT-4o mini | $1.26 | 94% |
| Claude Sonnet 4.5 | $27.00 | Claude Haiku 4.5 | $9.00 | 67% |
| GPT-5 | $13.50 | GPT-5 mini | $2.70 | 80% |
| Gemini 2.5 Pro | $13.50 | Gemini 2.5 Flash | $3.30 | 76% |
| GPT-4.1 | $16.80 | DeepSeek V3.2 (chat) | $1.93 | 89% |
Zero-downtime routing
Change routing in the console, not in a release.
Every routing chain is a versioned policy. Edit it in the dashboard or through the API, preview its effect on last week's traffic, publish to all edge PoPs in seconds, and roll back with one click.
| Ver | When | By | Change | State |
|---|---|---|---|---|
| v23 | Nov 6, 14:02 | ananya@ | Downgrade threshold 85% → 90% for pro tier | live |
| v22 | Nov 2, 10:41 | rohan@ | Added gpt-4.1 as cross-provider failover | superseded |
| v21 | Oct 28, 18:15 | nisha@ | Response cache at 100% for read-only features | rolled back |
| v20 | Oct 21, 09:30 | rohan@ | Fallback claude-3.5-haiku → claude-haiku-4.5 | superseded |
Fallback questions
Does a fallback change the response format my code receives?
No. When the fallback is in the same provider family, the request and response shapes are identical. For cross-provider failover between OpenAI-style and Anthropic-style APIs, PALM SOUQ translates the request and the response so your client receives the format it sent, including tool calls.
How do I know a request was served by a fallback?
Every response carries X-PalmSouq-Served-Model and X-PalmSouq-Route headers, and the decision is written to the audit log with the rule that fired. Metering uses the model that actually served the call, so tenant COGS stays exact.
Can I exclude some features from downgrades?
Yes. Rules match on tier, tenant, feature and user, so a contract-review feature can stay on the frontier model while chat suggestions downgrade first. Exclusions and priorities are part of the same versioned policy.
How are routing changes deployed?
Policies are versioned in the console or through the API and pushed to every edge PoP within seconds. There is no SDK update and no application redeploy. Any version can be rolled back with one click, and the change log records who changed what.
Degrade gracefully instead of locking customers out.
Route your agent traffic through PALM SOUQ in 2 minutes. Change one base URL, pass a tenant header, and every token is attributed and governed.
14-day free production trial · 100k requests included · no card required