Track your Claude AI usage and costs right from your macOS menu bar
TokenBar is a lightweight macOS menu bar application that helps you monitor token usage and costs for Claude Code and Codex CLI. It reads telemetry data locally from your machine and displays real-time statistics without sending any data to external servers.
- Real-time Usage Tracking - Monitor token consumption across all your Claude sessions
- Cost Estimation - Automatic cost calculation using up-to-date LiteLLM pricing data
- Time-based Breakdown - View usage statistics for today, this week, and this month
- Model-level Details - See which Claude models you're using most (Sonnet, Opus, Haiku)
- Privacy-first - All data processing happens locally on your Mac
- Auto-refresh - Updates every minute to keep your stats current
- Launch at Login - Optional system integration for persistent monitoring
- macOS 14.0 (Sonoma) or later
- Apple Silicon or Intel Mac
- Claude Code or Codex CLI installed
- Download the latest release from the Releases page
- Open the downloaded
.dmgfile - Drag TokenBar to your Applications folder
- Launch TokenBar from Applications
git clone https://github.com/kkiermasz/TokenBar.git
cd TokenBar
xcodebuild -scheme TokenBar -configuration Release -destination 'platform=macOS'For development builds with prettier output:
xcodebuild -scheme TokenBar -configuration Debug -destination 'platform=macOS' | xcbeautifyTokenBar runs silently in your menu bar, indicated by a chart icon. Click the icon to view:
- Total tokens consumed across all sessions
- Estimated costs in USD based on current pricing
- Session counts for each time period
- Input/output token breakdown for detailed analysis
- Per-model statistics showing usage by Claude model version
TokenBar automatically discovers and reads telemetry from:
~/.claude/projects/(Claude Code)~/.config/claude/projects/(Claude Code alternative location)
You can override the data directory using the CLAUDE_CONFIG_DIR environment variable (supports comma-separated paths for multiple sources).
Access settings through the menu:
- Launch at Login - Start TokenBar automatically when you log in
- Week Start Day - Defaults to Sunday to match Claude's ccusage tool
TokenBar uses a protocol-oriented architecture with clear separation of concerns:
- Discovery - Scans your Claude data directories for JSONL telemetry files
- Parsing - Streams and processes each file, deduplicating entries by message ID
- Aggregation - Groups usage by calendar periods (today/week/month)
- Pricing - Fetches model pricing from LiteLLM's public pricing database
- Display - Updates the menu bar view with calculated statistics
All processing happens locally. The only network request is fetching the LiteLLM pricing data (cached per session).
- No data collection - TokenBar never sends your usage data anywhere
- Local processing only - All calculations happen on your Mac
- Read-only access - Only reads telemetry files, never modifies them
- No telemetry - TokenBar itself doesn't track or log your usage
The only external network request is fetching model pricing from LiteLLM's public GitHub repository.
Q: Does TokenBar work with the Claude web interface? A: No, TokenBar only tracks Claude Code (CLI) and Codex CLI usage that generates local telemetry files.
Q: Are the cost estimates accurate? A: Costs are estimates based on LiteLLM's pricing data, which includes Claude's 200k token tiered pricing. Actual costs may vary based on your Anthropic billing plan.
Q: Why are my costs different from Anthropic's dashboard? A: TokenBar calculates costs based on token usage in local telemetry. Some sessions may include cached tokens or have different pricing depending on your plan.
Q: Can I export my usage data?
A: Currently, TokenBar is view-only. You can access raw telemetry files directly from ~/.claude/projects/ if you need to export data.
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
See CLAUDE.md for detailed development guidelines.
- Pricing data provided by LiteLLM
- Built with SwiftUI for macOS 14+
- Inspired by Claude Code's
ccusagecommand and ccusage by ryoppippi
TokenBar is available under the MIT License. See the LICENSE file for more info.
Note: TokenBar is an independent project and is not officially affiliated with Anthropic or Claude AI.