infrastructure
Routing & Fallback
How LW AI routes requests and handles automatic fallback for high availability.
LW AI uses intelligent routing and automatic fallback mechanisms to ensure high availability and optimal performance for every request.
Request Routing
Region-Based Routing
All requests use the single endpoint https://api.atrouter.cn. GeoDNS routes each request to the nearest region automatically:
- Mainland China users → Beijing cluster (lowest latency)
- Other international users → Singapore infrastructure
Model Routing (Astra V1 Pro)
When using the fusion model, requests are routed to the best underlying model based on:
| Factor | Description |
|---|---|
| Task complexity | Simple → Flash, Complex → Pro |
| Domain | Finance/energy → Yantronic V1 Pro |
| Language | Chinese → GLM, English/Code → DeepSeek |
| Current load | Balances across models for throughput |
Automatic Fallback
If the primary model or infrastructure is unavailable, LW AI automatically falls back to maintain service:
Model Fallback
Primary Model → Fallback Model (same capability tier)For example, if deepseek/deepseek-v4-pro is overloaded:
- Request routed to
deepseek/deepseek-v4-pro - If unavailable, falls back to
z-ai/glm-5.1(same tier) - Response returned with
model_routedheader indicating the actual model used
Infrastructure Fallback
Primary Region → Secondary RegionIf the Beijing region experiences issues:
- Requests to
https://api.atrouter.cnfail over inside the domestic cluster - Latency may increase slightly
- Service remains available
Fallback Behavior
| Scenario | Behavior | User Impact |
|---|---|---|
| Model overloaded | Fallback to equivalent model | Minimal — same quality tier |
| Model offline | Fallback to equivalent model | Minimal — response includes actual model used |
| Region degraded | Cross-region proxy | Slight latency increase |
| Complete outage | Maintenance page | API returns 503 with retry-after header |
Disabling Fallback
For applications that require strict model control, you can disable fallback:
response = client.chat.completions.create(
model="deepseek/deepseek-v4-pro",
messages=[...],
extra_body={"allow_fallback": False}
)When fallback is disabled, unavailable models will return a 503 Service Unavailable error instead of routing to an alternative.
Monitoring
- Check
model_routedin response headers to see which model actually handled your request - Use Service Status for real-time infrastructure health
Related
- Fusion Model — Multi-model orchestration
- Performance — Latency benchmarks
- Service Status — Real-time status