https://github.com/dmelo/claude-code-stats
https://github.com/dmelo/claude-code-stats
claude claude-ai claude-code macos usage-data
Last synced: 3 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/dmelo/claude-code-stats
- Owner: dmelo
- License: mit
- Created: 2026-01-16T12:10:09.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2026-02-12T13:15:36.000Z (4 days ago)
- Last Synced: 2026-02-12T21:38:41.545Z (4 days ago)
- Topics: claude, claude-ai, claude-code, macos, usage-data
- Language: Swift
- Homepage:
- Size: 98.6 KB
- Stars: 7
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Claude Code Stats
A native macOS menu bar app that displays your Claude Code usage limits in real-time.

## Features
- **Real-time usage data** - Shows your actual usage from Anthropic's servers
- **Current Session** - 5-hour rolling window usage with reset countdown
- **Weekly Limits** - All models combined usage with reset time
- **Sonnet Only** - Separate tracking for Sonnet model usage
- **Auto-refresh** - Updates every 5 minutes automatically
- **Claude service status** - Live status from [status.claude.com](https://status.claude.com) shown in the footer (Operational, Degraded, Outage, Critical)
- **Version update detection** - Checks for new Claude Code releases hourly via GitHub; shows a red dot badge on the menu bar icon and a banner when an update is available, with a link to the changelog
- **Native macOS app** - Built with SwiftUI, lightweight and fast
- **Dark theme** - Matches macOS menu bar aesthetic
## Requirements
- macOS 14.0 (Sonoma) or later
- Active Claude Pro/Max subscription
- Claude Code installed and logged in
## Installation
### Option 1: Homebrew (Recommended)
```bash
brew tap dmelo/tap
brew install --cask claude-code-stats
```
### Option 2: Download Release
Download the latest `.app` from the [Releases](https://github.com/dmelo/claude-code-stats/releases) page and drag it to your Applications folder.
### Option 3: Build from Source
1. Clone the repository:
```bash
git clone https://github.com/dmelo/claude-code-stats.git
cd claude-code-stats
```
2. Open in Xcode:
```bash
open ClaudeCodeStats/ClaudeCodeStats.xcodeproj
```
3. Build and run (⌘R)
## Setup
1. Launch the app - a chart icon will appear in your menu bar
2. Click the icon, then click **⚙️** (settings) or **"Configure Session"**
3. Get your session cookie from claude.ai:
- Open https://claude.ai in your browser
- Open Developer Tools (`Cmd + Option + I`)
- Go to **Application** → **Cookies** → **https://claude.ai**
- Find `sessionKey` and copy its value
4. Paste the value in the app and click **Save**
## Usage
Click the menu bar icon to see your current usage:
| Metric | Description |
|--------|-------------|
| **Current Session** | Usage in the current 5-hour window |
| **Weekly Limit** | Combined usage across all models (resets weekly) |
| **Sonnet Only** | Sonnet-specific usage tracking |
The progress bars change color based on usage:
- 🟢 Green: 0-50%
- 🟡 Yellow: 50-75%
- 🔴 Red: 75-100%
## Start at Login
To launch automatically when you log in:
1. Open **System Settings** → **General** → **Login Items**
2. Click **+** and add ClaudeCodeStats
## Session Cookie Expiration
The claude.ai session cookie expires periodically. When you see an "unauthorized" error:
1. Click the ⚙️ icon
2. Get a fresh `sessionKey` from claude.ai (see Setup step 3)
3. Paste and save
## Building
```bash
cd ClaudeCodeStats
xcodebuild -project ClaudeCodeStats.xcodeproj -scheme ClaudeCodeStats -configuration Release build
```
The built app will be in `~/Library/Developer/Xcode/DerivedData/ClaudeCodeStats-*/Build/Products/Release/`
## Project Structure
```
ClaudeCodeStats/
├── ClaudeCodeStats.xcodeproj
└── ClaudeCodeStats/
├── ClaudeCodeStatsApp.swift # App entry point
├── ContentView.swift # Main popover view
├── Services/
│ ├── WebSessionService.swift # Claude.ai API client
│ ├── StatusService.swift # Claude service health status
│ └── VersionService.swift # Claude Code version update checker
└── Views/
├── UsageCardView.swift # Usage card component
├── ProgressBarView.swift # Progress bar component
└── SettingsView.swift # Settings screen
```
## Privacy
- Your session cookie is stored locally in UserDefaults
- The app communicates with claude.ai to fetch your usage data, status.claude.com for service health, and the GitHub API for version checks
- No data is sent to any third parties
## License
MIT License - see [LICENSE](LICENSE) for details
## Acknowledgments
- Built for use with [Claude Code](https://docs.anthropic.com/en/docs/claude-code) by Anthropic
- Inspired by the Warp terminal menu bar design