feat: API rate limiting with slowapi middleware#23
Open
HeetRanpura wants to merge 1 commit into
Open
Conversation
Contributor
HeetRanpura
commented
Apr 23, 2026
- 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
cf42580 to
50eac5a
Compare
- 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
50eac5a to
dee1d72
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.