Usage widgets prefer stale rate_limits payload over live usage API, showing ~1% below /usage
Author: WYHSniperCreated Aug 26, 2026Updated Aug 26, 2026
From Claude Code status line:
From Anthropic usage page:
From /usage command:
I've configured the status line to refresh every minute, but it sits consistently ~1% below what the Anthropic usage page and /usage report.
Claude generated the content below:
I traced this through the source (v2.2.27). The status line prefers Claude Code's rate_limits stdin payload over the live usage API:
- extractUsageDataFromRateLimits (src/utils/usage-prefetch.ts) builds UsageData from rate_limits.five_hour / rate_limits.seven_day (used_percentage, resets_at).
- prefetchUsageDataIfNeeded returns that early — no API call — whenever it satisfies every configured widget's requirements. With session-usage, weekly-usage, and reset-timer configured, it does.
- On the fetch path, mergeUsageData spreads rateLimitsData after apiData, so the payload value wins even when a fresh API response is available.
I understand from usage-prefetch.test.ts that this is intentional and avoids an API call on every render. The consequence is that the displayed percentage tracks the rate_limits snapshot rather than GET /api/oauth/usage, which is what /usage and the usage page read, and the snapshot appears to trail the live value by about 1%.
Source: sirmalloc/ccstatusline