Region Based Routing
Simple routing based on user's geographic region for data residency and performance optimization.
Use Case
Configuration
{
"model": "router/dynamic",
"router": {
"type": "conditional",
"routes": [
{
"name": "european_users",
"conditions": {
"all": [
{
"metadata.region": {
"$eq": "Europe"
}
}
]
},
"targets": {
"$any": [
"openai/gpt-5",
"anthropic/claude-opus-4.1"
],
"sort_by": "ttft",
"sort_order": "min"
}
},
{
"name": "north_american_users",
"conditions": {
"all": [
{
"metadata.country": {
"$in": ["US", "CA", "MX"]
}
}
]
},
"targets": {
"$any": [
"openai/gpt-4.1",
"google/gemini-2.5-pro"
],
"sort_by": "ttft",
"sort_order": "min"
}
},
{
"name": "asian_users",
"conditions": {
"all": [
{
"metadata.region": {
"$eq": "Asia"
}
}
]
},
"targets": {
"$any": [
"deepseek/deepseek-chat",
"kimi-k2"
],
"sort_by": "ttft",
"sort_order": "min"
}
},
{
"name": "global_fallback",
"conditions": {
"all": []
},
"targets": "openai/gpt-4.1-mini"
}
]
}
}How it works
Variables Used
Geographic Detection
Customization
Last updated
Was this helpful?