Skip to content

Add Claude Usage Monitor plugin (AI)#2185

Open
davidchou821 wants to merge 1 commit into
matryer:mainfrom
davidchou821:add-claude-usage-monitor
Open

Add Claude Usage Monitor plugin (AI)#2185
davidchou821 wants to merge 1 commit into
matryer:mainfrom
davidchou821:add-claude-usage-monitor

Conversation

@davidchou821

Copy link
Copy Markdown

What it does

Menu bar monitor for Claude subscription usage — shows the 5-hour window % and model-scoped weekly % at a glance (e.g. CC 42% ⁄51), turning orange at 60% and red at 85%, with a macOS notification at 90% (once per reset window).

The dropdown shows:

  • Plan limits: 5-hour window, weekly (all models), weekly (model-scoped) + reset times — same numbers as Claude Code's /usage, covering usage across claude.ai web, desktop and CLI (limits are shared)
  • Tokens / cost: today's output tokens, cache reads and API-equivalent cost with per-model breakdown, plus month-to-date, computed locally by ccusage
  • Multi-account switching: save several Claude logins (stored in Keychain, auto-refreshed via refresh token) and switch which one is monitored

Security notes

  • Reads Claude Code's OAuth token from the macOS Keychain — macOS shows a permission prompt on first read; the token is only ever sent to api.anthropic.com, passed via stdin (never on the command line), and never written to plain files
  • Single self-contained Python file, stdlib only

Dependencies

  • python3, Claude Code (logged in)
  • ccusage for the tokens/cost section (plan limits work without it)

Notes

  • Developed and tested with SwiftBar (uses sfimage for the menu bar icon, which xbar ignores gracefully); metadata included for xbarapp.com
  • Home repo with full README (EN/中文), installer and uninstaller: https://github.com/davidchou821/claude-usage-widget

🤖 Generated with Claude Code

Menu bar monitor for Claude subscription usage: 5-hour window and
weekly limits (shared across claude.ai web / desktop / Claude Code),
local token & API-equivalent cost stats via ccusage, multi-account
switching, and a system notification at 90% utilization.

Co-Authored-By: Claude Fable 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