Skip to content

Add Claude Usage Stats plugin (Dev/ClaudeUsage)#2167

Merged
sprak3000 merged 1 commit into
matryer:mainfrom
peterkoczan:add-claude-usage-stats
Jul 9, 2026
Merged

Add Claude Usage Stats plugin (Dev/ClaudeUsage)#2167
sprak3000 merged 1 commit into
matryer:mainfrom
peterkoczan:add-claude-usage-stats

Conversation

@peterkoczan

Copy link
Copy Markdown
Contributor

Claude Usage Stats

Category: Dev
File: Dev/ClaudeUsage/claude_usage.15s.py
Source: https://github.com/peterkoczan/claude-usage-bar

What it does

Shows real-time Claude Code token usage in the macOS menu bar. Numbers are pulled directly from Anthropic's rate-limit response headers, so they match the "Plan usage limits" page in the Claude.ai desktop app to the percent.

Menu bar: today's output tokens + current usage % (colour-coded)
Dropdown:

  • Session bar (5h rolling) with exact % + "resets in Xh Ym"
  • Weekly bar (7-day) with exact % + reset countdown
  • Burn rate (tokens/hour, last 3h)
  • Today / 7d / 30d breakdown with estimated cost
  • Top projects by token usage

How it stays accurate

Every Anthropic API response includes anthropic-ratelimit-unified-5h-utilization and anthropic-ratelimit-unified-7d-utilization headers. The plugin makes one minimal max_tokens=1 call per minute and reads these headers — the same data the Claude.ai desktop displays. Results are cached so the display refreshes every 15 s without extra API overhead.

Requirements

  • macOS
  • Claude Code installed and authenticated (OAuth token stored in macOS Keychain)
  • Python 3 (ships with macOS, no extra packages needed)

Checklist

  • Plugin is executable (chmod +x)
  • Uses #!/usr/bin/env python3
  • xbar metadata headers included
  • No external dependencies beyond stdlib + Claude Code

Real-time Claude Code token usage in the macOS menu bar.
Session + weekly progress bars that match Claude.ai desktop exactly,
burn rate, reset countdowns, project breakdown, cost estimates.

Source: https://github.com/peterkoczan/claude-usage-bar
@sprak3000 sprak3000 added chmod chmod +x needed python labels Jul 9, 2026
@sprak3000 sprak3000 merged commit 9f8dc8e into matryer:main Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chmod chmod +x needed python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants