Skip to content

feat: API rate limiting with slowapi middleware#23

Open
HeetRanpura wants to merge 1 commit into
advikdivekar:mainfrom
HeetRanpura:feature/api-rate-limiting
Open

feat: API rate limiting with slowapi middleware#23
HeetRanpura wants to merge 1 commit into
advikdivekar:mainfrom
HeetRanpura:feature/api-rate-limiting

Conversation

@HeetRanpura
Copy link
Copy Markdown
Contributor

  • Add slowapi==0.1.9 dependency
  • Configure Limiter keyed on client IP (get_remote_address)
  • Add SlowAPIMiddleware and RateLimitExceeded exception handler
  • Rate limit /analyze/{session_id}: 5 requests per IP per 10 minutes
  • Rate limit /conversation/{session_id}: 10 requests per IP per minute
  • Returns HTTP 429 with retry-after header when limit is exceeded
  • Protects Gemini API budget from abuse and accidental loops

@HeetRanpura HeetRanpura force-pushed the feature/api-rate-limiting branch from cf42580 to 50eac5a Compare April 23, 2026 20:52
- Add slowapi==0.1.9 to requirements
- Configure Limiter keyed on client IP (get_remote_address)
- Add SlowAPIMiddleware and RateLimitExceeded exception handler
- Rate limit /analyze/{session_id}: 5 req per IP per 10 minutes
- Rate limit /conversation/{session_id}: 10 req per IP per minute
- Returns HTTP 429 with Retry-After header when exceeded
@HeetRanpura HeetRanpura force-pushed the feature/api-rate-limiting branch from 50eac5a to dee1d72 Compare April 23, 2026 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant