Increase rate limits and add Retry-After header on /api/analyze

Made-with: Cursor
This commit is contained in:
ValueOn AG 2026-03-29 23:29:23 +02:00
parent c70c03c637
commit 7ca59120dc
2 changed files with 4 additions and 3 deletions

3
app.py
View file

@ -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

View file

@ -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