Rate Limiting
Configuration
AI_SDK = {
"RATE_LIMITING": {
"ENABLED": True,
"BACKEND": "django_cache",
"PER_USER_TOKENS_PER_MINUTE": 50000,
"PER_USER_TOKENS_PER_DAY": 500000,
},
}The @ai_rate_limit Decorator
@ai_rate_limit Decoratorfrom djangosdk.ratelimit.decorators import ai_rate_limit
@ai_rate_limit(tokens_per_minute=10000, tokens_per_day=100000)
def chat_view(request):
agent = SupportAgent()
response = agent.handle(request.POST["message"])
return JsonResponse({"text": response.text})Rate Limit Backend
Custom Backend
Per-User Limits
Last updated
Was this helpful?