OAuth usage API (/api/oauth/usage) returns persistent 429 rate limit

Status Closed — not planned
Reported on v2.1.69
Maintainer reply None cached
Activity 7 comments · opened Mar 5, 2026 · closed Mar 6, 2026

Description

The OAuth usage API endpoint (api.anthropic.com/api/oauth/usage) is returning persistent HTTP 429 (rate_limit_error) responses, preventing the HUD statusline from displaying rate limit / token usage information.

Environment

  • Claude Code version: 2.1.69
  • OS: Ubuntu Linux 6.17.0-14-generic
  • oh-my-claudecode plugin: 4.1.8 (uses this API for HUD statusline)

Steps to Reproduce

  1. Have valid OAuth credentials (~/.claude/.credentials.json with non-expired accessToken)
  2. Call the usage API:
node -e "
const creds = JSON.parse(require('fs').readFileSync(require('os').homedir() + '/.claude/.credentials.json', 'utf-8'));
const c = creds.claudeAiOauth || creds;
const https = require('https');
const req = https.request({
  hostname: 'api.anthropic.com',
  path: '/api/oauth/usage',
  method: 'GET',
  headers: {
    'Authorization': 'Bearer ' + c.accessToken,
    'anthropic-beta': 'oauth-2025-04-20',
    'Content-Type': 'application/json',
  },
  timeout: 10000,
}, (res) => {
  let data = '';
  res.on('data', chunk => data += chunk);
  res.on('end', () => console.log('Status:', res.statusCode, 'Body:', data));
});
req.on('error', e => console.log('Error:', e.message));
req.end();
"
  1. Consistently returns: Status: 429 Body: {"error":{"message":"Rate limited. Please try again later.","type":"rate_limit_error"}}

Expected Behavior

The usage API should return rate limit utilization data (five_hour, seven_day percentages) when called with valid OAuth credentials at reasonable intervals.

Actual Behavior

Persistent 429 responses regardless of retry interval. The /usage command in Claude Code also fails to display usage information.

Impact

  • HUD statusline cannot display rate limit information
  • Users cannot monitor their token usage during sessions

View original on GitHub ↗

7 Comments

github-actions[bot] · 5 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/30930
  2. https://github.com/anthropics/claude-code/issues/30221
  3. https://github.com/anthropics/claude-code/issues/8473

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

sk-ruban · 5 months ago

have the same issue too!

ksc98 · 5 months ago

same issue!

moonchan-park · 5 months ago

Closing as duplicate of #30930 — same persistent 429 on /api/oauth/usage endpoint. Upvoted the original issue.

skibidiskib · 5 months ago

Community workaround available

I built a drop-in statusLine.command replacement that bypasses the OAuth API
entirely by using Claude Desktop's web session cookies to call the claude.ai
web API — a separate rate limit bucket unaffected by Claude Code sessions.

Result:
🚀 Opus 4.6 [main]
✅ 126K (63%) | 36% (1h 34m left)
🟢 68.0% / $25.35 | (2d 5h 30m left)

How it works:

  1. Decrypts Claude Desktop's Chromium cookies from macOS Keychain

(AES-128-CBC, v10 format)

  1. Calls GET https://claude.ai/api/organizations/{orgId}/usage in-process

(Cloudflare blocks child processes)

  1. Caches for 30s with file-based locking so all sessions share one API call

Install (macOS, requires Claude Desktop):
```bash
npm install -g claude-web-usage
bash "$(npm root -g)/claude-web-usage/install.sh"

Restart Claude Code and usage data appears in the statusline.

GitHub: https://github.com/skibidiskib/claude-web-usage
npm: https://www.npmjs.com/package/claude-web-usage
License: MIT

prakersh · 5 months ago

Workaround: OAuth Token Refresh

We found that rate limits are per-access-token, not per-account. Refreshing your OAuth token gives you a fresh rate limit window.

How to bypass:

curl -X POST https://console.anthropic.com/v1/oauth/token \
  -H "Content-Type: application/json" \
  -d '{
    "grant_type": "refresh_token",
    "refresh_token": "YOUR_REFRESH_TOKEN",
    "client_id": "9d1c250a-e61b-44d9-88ed-5944d1962f5e"
  }'

Important: Refresh tokens are one-time use. You must save both the new access_token AND refresh_token from the response — otherwise your next refresh will fail.

---

We also implemented this fix in onWatch, an open-source quota tracking tool for Claude Code, Codex, Copilot, and other AI tools. It now automatically handles 429s by refreshing tokens and updating your Keychain/keyring.

Implementation: onllm-dev/onWatch@0ab1009

If you find this useful, consider giving the repo a star!

github-actions[bot] · 5 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.