Routing

Routing decides which model and provider serve a request. New integrations should start with model: "auto", then control the range with tier and API key policy.

Common Requests

GoalRequest
Automatic routingmodel: "auto"
Select a tiermodel: "auto" + `tier: “economy"
Pin one modelmodel: "GLM-5"
Force a key to one modelSet fixed model in API key policy
Block modelsSet blacklist in API key policy

Tiers

TierUse
economyCost-first, batch, low-risk tasks
standardBalanced default
premiumQuality-first or critical production tasks

Wallet Fallback

When the request uses model: "auto" and the current tier lacks balance, JoyToken may try another tier allowed by policy.

Current tierFallback order
premiumstandard -> economy
standardpremium -> economy
economystandard -> premium

Pinned model requests do not automatically switch models. If balance or budget is insufficient, the request returns 402 insufficient_quota.

Confirm Routing

SignalMeaning
X-DAOE-Used-ModelActual selected model
X-DAOE-Used-ProviderProvider that served the request
metadata.modelFinal JoyToken model
metadata.tierBilling and routing tier
metadata.billingCredits and token usage

Troubleshooting

SymptomCheck first
tier not allowedAPI key policy allows the tier
model not allowedfixed model or blacklist
IP not allowedserver egress IP is allowlisted
auto failspolicy, tier, and balance still leave candidate models
pinned model failsmodel availability, wallet, and budget