From 7ca59120dc6d7523e3554dea9b241518de67b974 Mon Sep 17 00:00:00 2001 From: ValueOn AG Date: Sun, 29 Mar 2026 23:29:23 +0200 Subject: [PATCH] Increase rate limits and add Retry-After header on /api/analyze Made-with: Cursor --- app.py | 3 ++- config.ini | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app.py b/app.py index 1e00470..4d26ed1 100644 --- a/app.py +++ b/app.py @@ -776,7 +776,8 @@ async def _analyzeDocument( if not allowed: raise HTTPException( status_code=429, - detail=f"Rate limit exceeded. Retry after {info['retryAfter']} seconds." + detail=f"Rate limit exceeded. Retry after {info['retryAfter']} seconds.", + headers={"Retry-After": str(int(info["retryAfter"]) + 1)}, ) try: # Get internal model name diff --git a/config.ini b/config.ini index baf9e7c..5253b71 100644 --- a/config.ini +++ b/config.ini @@ -21,5 +21,5 @@ AUTH_PASSWORD = poweron SECRET_KEY = c8bc1cede035171dedf01f220623e185aa8b83670ef607e97d928d271ac94200 # Rate Limiting -RATE_LIMIT_REQUESTS_PER_MINUTE = 60 -RATE_LIMIT_BURST_SIZE = 10 +RATE_LIMIT_REQUESTS_PER_MINUTE = 120 +RATE_LIMIT_BURST_SIZE = 30