{"record":{"id":"97562c1a2352957b","repo":"Significant-Gravitas/AutoGPT","slug":"you-ve-reached-your-window-usage-limit-resets-i","errorCode":null,"errorMessage":"You've reached your {window} usage limit. Resets in {time_str}.","messagePattern":"You've reached your (.+?) usage limit\\. Resets in (.+?)\\.","errorType":"http","errorClass":"RateLimitExceeded","httpStatus":429,"severity":"warning","filePath":"autogpt_platform/backend/backend/api/features/chat/routes.py","lineNumber":1463,"sourceCode":"\n    # Subscription-backed Codex turns do not spend platform model dollars, so\n    # neither the platform paywall nor its USD usage windows apply. Admission,\n    # pending-message frequency, and concurrent-turn caps remain enforced by\n    # the shared scheduling path below.\n    if user_id and is_platform_route:\n        try:\n            daily_limit, weekly_limit, _ = await get_global_rate_limits(\n                user_id,\n                config.daily_cost_limit_microdollars,\n                config.weekly_cost_limit_microdollars,\n            )\n            await check_rate_limit(\n                user_id=user_id,\n                daily_cost_limit=daily_limit,\n                weekly_cost_limit=weekly_limit,\n            )\n        except RateLimitExceeded as e:\n            raise HTTPException(status_code=429, detail=str(e)) from e\n        except RateLimitUnavailable as e:\n            # Fail-closed on Redis brown-out: the user may already be at or\n            # past their USD cap and we cannot prove otherwise. 503 + a short\n            # Retry-After is the right UX (transient outage, retry shortly),\n            # not 429 (\"you hit your limit\").\n            raise HTTPException(\n                status_code=503,\n                detail=\"Rate limit service degraded, retry shortly\",\n                headers={\"Retry-After\": \"30\"},\n            ) from e\n\n    # Enrich message with file metadata if file_ids are provided.\n    # Also sanitise file_ids so only validated, workspace-scoped IDs are\n    # forwarded downstream (e.g. to the executor via enqueue_copilot_turn).\n    sanitized_file_ids: list[str] | None = None\n    if request.file_ids:\n        files = await resolve_workspace_files(user_id, request.file_ids)\n        sanitized_file_ids = [wf.id for wf in files] or None","sourceCodeStart":1445,"sourceCodeEnd":1481,"githubUrl":"https://github.com/Significant-Gravitas/AutoGPT/blob/9c8bb5550f446ba5d3046b78896578742495b3cf/autogpt_platform/backend/backend/api/features/chat/routes.py#L1445-L1481","documentation":"HTTP 429 from POST /chat/stream (routes.py:1463). After resolving the user's global limits, the endpoint calls check_rate_limit which tracks USD spend per daily and weekly window in Redis. When used >= limit, it raises RateLimitExceeded whose str(e) becomes the detail: 'You've reached your {window} usage limit. Resets in {time_str}.' with window='daily' or 'weekly' and a human-readable countdown.","triggerScenarios":"POST /chat/stream when the user's tracked spend reached daily_cost_limit_microdollars or weekly_cost_limit_microdollars (per tier via get_global_rate_limits). Every subsequent message this window gets the same 429.","commonSituations":"Long CoPilot sessions with expensive models exhausting the daily cap; heavy weeks hitting the $5 default weekly cap; new users with small trial-tier limits surprised mid-task.","solutions":["Wait for the stated reset time (UTC midnight for daily, Monday 00:00 UTC for weekly) — the message embeds the countdown.","If eligible, use POST /usage/reset to spend credits and clear the DAILY counter (only when the weekly cap is not also exhausted — see error 147).","Switch to a cheaper model/mode for the rest of the window if the product allows it.","Admins: raise daily/weekly cost limits for the affected tier if the caps are too aggressive."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// check usage before sending if the session frequently hits caps\nconst u = await getUsageStatus();\nif (u.daily.used >= u.daily.limit || u.weekly.used >= u.weekly.limit) {\n  showLimitReached(u); // offer reset or countdown\n} else {\n  await post('/chat/stream', body);\n}","typeGuard":null,"tryCatchPattern":"try { await post('/chat/stream', body); } catch (e) {\n  if (e.status === 429) { showLimitReached(e.detail); return; } // detail embeds window + reset countdown\n  throw e;\n}","preventionTips":["Parse the 429 detail — it names the window (daily/weekly) and reset time","Do not auto-retry 429s; offer the paid daily reset only when weekly isn't exhausted","Track spend client-side per model to warn users before the cap"],"tags":["http","rate-limit","usage","chat","fastapi"],"backgroundTag":null,"analyzedSha":"9c8bb5550f446ba5d3046b78896578742495b3cf","analyzedAt":"2026-08-14T17:17:21.957Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}