Rate Limiter Routing
Apply per-user quotas and route based on rate-limit results.
Use Case
Configuration
{
"model": "router/dynamic",
"router": {
"type": "conditional",
"pre_request": [
{
"name": "daily_user_limit",
"type": "rate_limiter",
"limit": 2,
"period": "hour",
"entity": "user_id",
"target": "requests"
}
],
"routes": [
{
"conditions": {
"all": [
{
"pre_request.daily_user_limit.allowed": {
"$eq": true
}
}
]
},
"name": "main_requests",
"targets": {
"$any": [
"anthropic/*"
],
"sort_by": "price",
"sort_order": "min"
}
},
{
"name": "other_requests",
"targets": {
"$any": [
"openai/gpt-4.1-nano"
],
"sort_by": "price",
"sort_order": "min"
}
}
]
}
}How It Works
Variables Used
Customization
Last updated
Was this helpful?