# Enable rate limiting (100 requests/minute per client)praisonai serve recipe --rate_limit 100# Stricter limit for public APIpraisonai serve recipe --rate_limit 30 --auth api-key
When combined with --workers N, the configured --rate_limit is divided across workers (rate_limit // workers, floor 1) so the aggregate stays close to the value you set. A startup warning prints exactly what value each worker enforces. For exact cross-process limiting, front the service with a shared-store limiter (API gateway or Redis).
# Start server with low limit for testingpraisonai serve recipe --rate_limit 5# In another terminal, make rapid requestsfor i in {1..10}; do curl -s http://localhost:8765/v1/recipes | head -c 50 echo " - Request $i"done
Expected output after 5 requests:
{"error":{"code":"rate_limited","message":"Too many requests"}}
# HELP praisonai_http_requests_total Total HTTP requests# TYPE praisonai_http_requests_total counterpraisonai_http_requests_total{path="/health",method="GET",status="200"} 5# HELP praisonai_http_request_duration_seconds HTTP request duration# TYPE praisonai_http_request_duration_seconds histogrampraisonai_http_request_duration_seconds_sum{path="/health",method="GET"} 0.025praisonai_http_request_duration_seconds_count{path="/health",method="GET"} 5
As of PraisonAI PR #5231, --workers N > 1 actually spawns N uvicorn worker processes; previously the CLI accepted the flag but silently ran a single worker.