Skip to content

solbish/stats

 
 

Repository files navigation

Claude Module for Stats

Monitor your Claude AI usage directly from the macOS menu bar.

Claude Module

This is a fork of Stats with added Claude AI usage monitoring.

Installation

Homebrew

# Uninstall original Stats if installed
brew uninstall --cask stats 2>/dev/null

brew tap solbish/tap
brew install --cask solbish/tap/stats
xattr -cr /Applications/Stats.app

Manual

Download Stats.dmg, open it, move to Applications, then run:

xattr -cr /Applications/Stats.app

Requirements

Stats is supported on the released macOS version starting from macOS 12 (Monterey).

Claude Module Preview

Features

  • 5-Hour Usage - Track your rolling 5-hour usage limit with real-time countdown
  • 7-Day Usage - Monitor your weekly usage quota
  • 24-Hour History Chart - Visualize usage patterns over time
  • Peak Hours Indicator - Know when Claude is busiest (8 AM - 2 PM ET weekdays)
  • Best Time Analysis - Find optimal times to use Claude based on historical data
  • Multiple Widgets - Mini, Line Chart, Bar Chart, Pie Chart display options

Screenshots

Menu Bar Widget

Menu Bar

The Claude module displays in your menu bar showing current 5-hour utilization.

Popup View

Popup

Click the menu bar icon to see detailed usage information:

  • 5-hour and 7-day usage bars with percentages
  • Reset countdowns for each limit
  • Model breakdown (Opus/Sonnet usage)
  • 24-hour history chart
  • Peak hours status
  • Best time recommendations

Peak Hours Visualization

Peak Hours

The 24-hour history chart highlights peak hours (8 AM - 2 PM ET weekdays) as shaded areas. The status bar shows current off-peak/peak state with a countdown timer to the next change.

Settings

Settings

Configure authentication and update intervals.


Setup & Login

The Claude module supports two authentication methods. Claude.ai Web is the primary method with more frequent updates.

Method 1: Claude.ai Web (Recommended)

This method uses browser cookies to fetch usage data directly from claude.ai.

Step 1: Install Cookie Extractor Extension

Install the "Cookies Extractor" extension for Chrome/Edge:

  • Chrome Web Store
  • Or search "Cookies Extractor" in your browser's extension store

Step 2: Get Your Cookies

  1. Go to claude.ai and log in
  2. Click the Cookies Extractor extension icon in your browser toolbar
  3. Click "Copy as JSON Cookie"

Step 3: Import to Stats

  1. Open Stats settings (click the Stats icon in menu bar > Settings)
  2. Navigate to the Claude module
  3. Click "Import from Clipboard"
  4. You should see "Import Successful" confirmation

The status will change from "Not configured" to "OK" with the last fetch time.

Update Interval

Choose how often to refresh data:

  • 10 seconds (for active monitoring)
  • 30 seconds
  • 1 minute (default)
  • 2 minutes
  • 5 minutes

Method 2: Claude Code CLI (Fallback)

If you use the Claude Code CLI, you can import tokens from your Keychain.

Prerequisites

  1. Install Claude Code CLI: npm install -g @anthropic-ai/claude-code
  2. Log in: claude login

Import Token

  1. Open Stats settings > Claude module
  2. In the "Claude Code (fallback)" section, click "Import from Keychain"
  3. Grant Keychain access if prompted

Update Interval

  • 1 minute
  • 2 minutes
  • 5 minutes (default)
  • 10 minutes

Note: Claude Code method has a longer default interval because API rate limits are more strict.


Understanding the Display

Usage Bars

Indicator Meaning
Green (0-50%) Low usage, plenty of capacity
Yellow (50-80%) Moderate usage
Orange (80-95%) High usage, consider pacing
Red (95-100%) Near limit, may experience throttling

Reset Countdowns

  • 5-Hour Reset: Rolling window - resets portion used 5 hours ago
  • 7-Day Reset: Weekly quota - resets portion used 7 days ago

Peak Hours

Claude experiences higher load during:

  • Peak: 8 AM - 2 PM ET, Monday-Friday
  • Off-Peak: All other times

The indicator shows:

  • Current status (PEAK/off-peak)
  • Time until status changes

Best Time

Based on your usage history, the module analyzes and recommends hours with lowest average usage.


Widgets

Choose your preferred menu bar display:

Widget Description
Mini Compact percentage display
Line Chart Usage trend over time
Bar Chart 5-hour and 7-day comparison
Pie Chart Visual usage vs remaining

Configure widgets in Stats settings > Claude > Widgets.


Troubleshooting

"Not configured" Status

  1. Ensure you're logged into claude.ai in your browser
  2. Try re-exporting cookies with "Copy as JSON Cookie"
  3. Make sure clipboard contains the JSON before clicking Import

"Error: Session expired"

Your session token has expired. Re-export cookies from your browser.

"Error: Rate limited"

Increase the update interval in settings to reduce API calls.

Claude Code Import Failed

  1. Ensure Claude CLI is installed: which claude
  2. Ensure you're logged in: claude status
  3. Check Keychain Access has the claude credentials

Data Not Updating

  1. Check the "Last updated" time in the popup
  2. Verify internet connection
  3. Try clearing and re-importing credentials

Privacy & Security

  • Credentials are stored in macOS Keychain (encrypted)
  • No data is sent to third parties
  • All communication is directly with claude.ai
  • Session tokens are masked in the UI (only last 8 characters shown)

FAQ

Stats icons do not appear in the menu bar

macOS 26 introduced a new privacy control under System Settings → Menu Bar. Apps must be explicitly allowed there to display menu bar items. If Stats is running with at least one module active and one widget enabled, but none of its icons show up in the menu bar, this is almost certainly the cause. More details you can find here.

Solution: open System Settings → Menu Bar and toggle Stats ON.

Desktop widgets not showing the data

Due to a problem with high data load in the system process (chronod) responsible for communication between the app and widgets, communication is disabled by default on the Stats side. To enable it, the macOS widgets option must be enabled in the Stats settings. More details you can find here.

Solution: open Stats Settings and toggle macOS widgets ON.

How to reduce energy impact or CPU usage of Stats?

Stats tries to be efficient as it's possible. But reading some data periodically is not a cheap task. Each module has its own "price". So, if you want to reduce energy impact from the Stats you need to disable some Stats modules. The most inefficient modules are Sensors and Bluetooth. Disabling these modules could reduce CPU usage and power efficiency by up to 50% in some cases.

How to contribute to the project?

If you want to develop a new feature or you've found something that doesn't work, the first step is to open an issue so the feature or problem can be discussed. Pull requests should only be opened for existing issues and after discussion; otherwise, they may be closed automatically. There are a few cases where this can be skipped: for language changes, and for contributors who have already made significant contributions and whose implementations align well with the project.


Feedback

Report issues or request features at: https://github.com/solbish/stats/issues


License

MIT License

About

Claude AI usage monitor for macOS menu bar

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Swift 92.9%
  • C++ 3.1%
  • Python 2.3%
  • C 1.0%
  • Objective-C 0.3%
  • Makefile 0.3%
  • Shell 0.1%