Fix persistent 429 on usage endpoint by sending claude-code User-Agent - #34
Open
bubbabright wants to merge 1 commit into
Open
Fix persistent 429 on usage endpoint by sending claude-code User-Agent#34bubbabright wants to merge 1 commit into
bubbabright wants to merge 1 commit into
Conversation
The /api/oauth/usage endpoint places requests without a claude-code User-Agent into an aggressively rate-limited bucket that returns HTTP 429 regardless of poll interval, and does not recover for the rest of the session. This makes the extension show "Error / HTTP 429" indefinitely. Adding a `User-Agent: claude-code/<version>` header moves requests into the normal bucket and the endpoint returns usage data as expected. Refs: anthropics/claude-code#31021, #30930, #31637 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Need this! |
Author
I made a similar change, plus added a few features that could benefit from another pair of eyes: https://github.com/bubbabright/claude-usage-extension |
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.
Problem
The
/api/oauth/usageendpoint places requests without aclaude-codeUser-Agent into an aggressively rate-limited bucket that returns HTTP 429 regardless of poll interval, and does not recover for the rest of the session. In this extension that surfaces as a permanentError/HTTP 429in the panel, making usage monitoring unusable.This is a known upstream issue affecting every third-party tool that polls this endpoint:
Fix
Add a
User-Agent: claude-code/<version>header to the usage request. This moves the request into the normal rate-limit bucket and the endpoint returns usage data as expected.Testing
Verified directly against the live endpoint:
Single-line behavioral change plus an explanatory comment; no other files touched.
🤖 Generated with Claude Code