Skip to content

fix(usage): show Claude credit usage when a login has no rate-limit windows - #295

Open
BigWebstas wants to merge 1 commit into
johannesjo:mainfrom
BigWebstas:fix/claude-credit-usage
Open

BigWebstas wants to merge 1 commit into
johannesjo:mainfrom
BigWebstas:fix/claude-credit-usage

Conversation

@BigWebstas

Copy link
Copy Markdown

Description

Shows Claude credit usage in the status bar for logins that are billed per use instead of a Pro/Max subscription.

For those logins, the Claude usage endpoint returns no five_hour or seven_day window, only an extra_usage block with the spend and the monthly limit. The parser ignored that block, so it reported "no rate-limit windows" and the status bar stayed hidden even though the user had a dollar limit set.

  • Parser (electron/ipc/claude-usage.ts): reads extra_usage, plus the newer spend block, into a new optional creditUsage field with used, limit, currency and percent used. Amounts arrive in minor units and are converted using decimal_places or the exponent field, which default to 2.
  • Status bar: when a login has no rate-limit windows, credits become the headline, e.g. Credits $12.34 / $50.00 (25%). The hover popover always lists them. The meter turns amber at the usual 80% threshold.
  • Store and types: creditUsage is carried through UsageResult and UsageState, and cleared on logout along with the windows. Codex is unaffected.

Issues Resolved

None filed.

Check List

  • New functionality includes testing. (Parser, formatter, store and status bar tests.)
  • New functionality has been documented in the README if applicable. (Not applicable: no new setting or command.)

🤖 Generated with Claude Code

…indows

Logins billed per use get no five-hour or weekly window from the Claude
usage endpoint, only an extra_usage block, so the parser returned
nothing and the status bar stayed hidden. Parse extra_usage (and the
newer spend block) into creditUsage and show it as "$used / $limit":
inline in the bar when there are no windows, and in the popover.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant