Fix plan display showing wrong tier and usage stuck at 0%#6
Open
amanzainal wants to merge 2 commits intobabakarto:masterfrom
Open
Fix plan display showing wrong tier and usage stuck at 0%#6amanzainal wants to merge 2 commits intobabakarto:masterfrom
amanzainal wants to merge 2 commits intobabakarto:masterfrom
Conversation
- Add _resolve_plan_name() to parse rateLimitTier strings into clean plan names with multiplier (e.g. "default_claude_max_20x" -> "Max 20x") - Add _fetch_oauth_direct() using api.anthropic.com/api/oauth/usage endpoint which returns five_hour/seven_day utilization percentages - Add _enrich_plan_from_account() to fetch live rate_limit_tier from /api/oauth/account, fixing stale local credentials showing wrong plan - Update _parse_api_usage() to handle the actual Claude API response format (five_hour/seven_day with utilization field) Fixes babakarto#5
- Dark mode: full dark palette for Claude tab with warm gradient, toggled via ☾/☀ button, persisted to ~/.codexbar/config.json - Compact mode: minimal layout showing only plan badge and usage bars, hides cost section and footer, toggled via ⤒/⤓ button - Pin to top: keeps popup open when clicking away, toggled via 📋/📌 button with visual indicator - Draggable: click and drag the tab bar to reposition the popup - All preferences persist across restarts
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.
Summary
Fixes #5 — Plan indicator showed "Max 5x" instead of the correct "Max 20x", and session/weekly usage were stuck at 0%.
Root causes:
rateLimitTierin~/.claude/.credentials.json, which can become stale after a plan changedaily_usage/session_limitetc., but the actual Claude API returnsfive_hour/seven_dayobjects with autilizationpercentage fieldChanges:
_resolve_plan_name()— new static method that parsesrateLimitTierstrings into clean plan names with multiplier (e.g."default_claude_max_20x"→"Max 20x")_fetch_oauth_direct()— new primary OAuth fetch path usingapi.anthropic.com/api/oauth/usage(same endpoint as upstream macOS CodexBar), which returnsfive_hour/seven_daywithutilizationpercentages_enrich_plan_from_account()— fetches the liverate_limit_tierfrom/api/oauth/accountto get the accurate plan with multiplier, even when CLI is the usage data source_parse_api_usage()update — web API fallback now also handlesfive_hour/seven_day+utilizationresponse formatTest plan
_resolve_plan_name()correctly maps all tier strings (Max 5x/20x, Pro, Team, Enterprise, Free, Ultra)/api/oauth/usagereturns live utilization data (session 35%, weekly 43%)/api/oauth/accountreturns liverate_limit_tier: "default_claude_max_20x"