A beautiful macOS menu bar plugin that tracks your Claude API usage and costs in real-time.
Real-time Claude API cost tracking with detailed breakdowns by model, project, and daily usage
- See today's Claude API costs at a glance in the menu bar
- Clean display showing only what matters most: today's spending
- Today's Usage - Track daily spending, sessions, and tokens
- Model Breakdown - Visualize costs by model with progress bars
- Project Analytics - Top 5 projects by cost
- Token Statistics - Detailed breakdown of all token types
- Clean, professional design optimized for macOS
- Visual progress bars and tree structures
- Supports both light and dark mode
- Icons and emojis for better readability
- Auto-refreshes every 10 seconds (configurable)
- Efficient JSONL parsing
- Memory-conscious for large datasets
- macOS (10.12 or later)
- xbar - Install via Homebrew:
brew install --cask xbar
- Python 3 (included with macOS)
- Claude API usage data in
~/.claude/projects/
-
Install xbar (if not already installed):
brew install --cask xbar
-
Install the plugin:
# Download and install in one command curl -sSL https://raw.githubusercontent.com/xixifast/claude-xbar-plugin/main/install.sh | bash
- Download
claude-usage.10s.py
from this repository - Copy to xbar plugins directory:
cp claude-usage.10s.py ~/Library/Application\ Support/xbar/plugins/ chmod +x ~/Library/Application\ Support/xbar/plugins/claude-usage.10s.py
- Refresh xbar or restart the app
The plugin refreshes every 10 seconds by default. To change this, rename the file:
claude-usage.5s.py
- Refresh every 5 secondsclaude-usage.30s.py
- Refresh every 30 secondsclaude-usage.1m.py
- Refresh every minuteclaude-usage.5m.py
- Refresh every 5 minutes
To update model pricing, edit the MODEL_PRICING
dictionary in the script:
MODEL_PRICING = {
"opus-4": {
"name": "Opus 4",
"input_per_million": 15.0,
"output_per_million": 75.0,
"cache_write_per_million": 18.75,
"cache_read_per_million": 1.50
},
# Add more models here...
}
The plugin displays:
-
Menu Bar: Today's cost
- Format:
🤖 $125.80
- Format:
-
Dropdown Menu:
- 💰 Overview: Total cost, sessions, and average cost per session
- 📅 Today: Today's cost, sessions, and token usage
- 🔤 Token Usage: Detailed breakdown with tree structure
- 🎯 By Model: Cost distribution with visual progress bars
- 📁 Top Projects: Top 5 projects by cost
- 🔧 Actions: Refresh and quick access to Claude projects
- Check if
~/.claude/projects/
exists and contains.jsonl
files - Ensure the plugin has read permissions
- Check Console.app for any Python errors
The plugin uses Claude's official pricing. If you see discrepancies:
- Check if your model names match the configured patterns
- Verify the pricing in
MODEL_PRICING
matches current rates
For large usage histories, consider:
- Increasing the refresh interval (e.g.,
claude-usage.1m.py
) - Cleaning old
.jsonl
files from~/.claude/projects/
claude-xbar-plugin/
├── README.md
├── LICENSE
├── claude-usage.10s.py # Main plugin script
├── install.sh # Installation script
├── assets/ # Screenshots and images
└── examples/ # Example configurations
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
Test the plugin locally:
python3 claude-usage.10s.py
MIT License - see LICENSE file for details
- Built for xbar (formerly BitBar)
- Inspired by the Claude AI community
- Icons from Apple's SF Symbols
Made with ❤️ for Claude users everywhere