Features
- Session (5-hour) and weekly rate limit tracking
- Model-specific windows (Sonnet, Opus, Haiku)
- Extra usage cost tracking (monthly spend/limit)
- Local token cost analysis from project logs
- Multi-account support via manual tokens
- Status page integration with Anthropic incidents
Authentication Methods
Claude supports three primary authentication methods with automatic fallback:- OAuth API (Recommended)
- CLI PTY (Fallback)
OAuth API
The OAuth API is the preferred method when Claude CLI credentials includeuser:profile scope.Setup:- Install Claude CLI:
npm install -g @anthropic-ai/claude-cli - Authenticate:
claude auth login - Credentials saved to Keychain (
Claude Code-credentials) or~/.claude/.credentials.json
- Endpoint:
GET https://api.anthropic.com/api/oauth/usage - Authentication:
Authorization: Bearer <access_token> - Header:
anthropic-beta: oauth-2025-04-20
- Never prompt - Never attempts interactive prompts
- Only on user action (default) - Prompts only for user-initiated repairs
- Always allow prompts - Allows prompts in background flows
five_hour→ session windowseven_day→ weekly windowseven_day_sonnet/seven_day_opus→ model-specific weekly windowsextra_usage→ monthly spend/limit- Plan inference from
rate_limit_tier(Max/Pro/Team/Enterprise)
Data Source Selection
Default Selection (Debug Menu Disabled)
- OAuth API - If Claude CLI credentials include
user:profilescope - CLI PTY - If OAuth is unavailable or fails
- Web API - If OAuth and CLI are unavailable or fail
Manual Override
Preferences → Providers → Claude → Usage source:- Auto - Uses the default selection above
- OAuth - Forces OAuth API only
- Web - Forces Web API with cookies
- CLI - Forces CLI PTY only
Local Cost Usage
CodexBar scans local project logs to compute token costs: Source roots:$CLAUDE_CONFIG_DIR(comma-separated paths, each uses<root>/projects)- Fallback roots:
~/.config/claude/projects~/.claude/projects
**/*.jsonlunder project roots
- Lines with
type: "assistant"andmessage.usage - Per-model token counts (input, cache read/create, output)
- Deduplicates streaming chunks by
message.id + requestId
~/Library/Caches/CodexBar/cost-usage/claude-v1.json- Window: last 30 days (rolling), 60s minimum refresh interval
- Settings → General → Show cost summary
- Menu shows “Cost (30d): $X.XX” below usage meters
Multi-Account Support
CodexBar supports multiple Claude accounts via manual tokens: Setup:- Edit
~/.codexbar/config.json:
- Preferences → Providers → Claude → Cookie source: Manual
- Preferences → Advanced → Display: choose “Stacked” or “Switcher”
- Stacked - Shows all accounts in the menu
- Switcher - Shows one account at a time with a switcher bar
Status Page Integration
CodexBar monitors Anthropic Status for incidents:- Polls Statuspage.io API every 5 minutes (configurable)
- Displays incident badge on menu bar icon
- Shows incident details in menu
- Click “View Status” to open status page
Troubleshooting
OAuth token missing user:profile scope
OAuth token missing user:profile scope
Claude CLI tokens with only
user:inference scope cannot call the usage API.Solution:- Re-authenticate:
claude auth logout && claude auth login - Ensure the new token includes
user:profilescope - Or use Web API with browser cookies instead
Session key expired
Session key expired
Browser session keys expire periodically.Solution:
- Visit https://claude.ai in your browser
- Log out and log back in
- Return to CodexBar and click “Refresh”
- CodexBar will import fresh cookies automatically
CLI PTY parsing failed
CLI PTY parsing failed
The Claude CLI status output may change formats.Solution:
- Try OAuth API or Web API instead
- Preferences → Providers → Claude → Usage source: OAuth or Web
- Report the issue with CLI output attached
Keychain prompts for credentials
Keychain prompts for credentials
Claude OAuth credentials stored in Keychain may trigger prompts.Solution:
- Open Keychain Access.app
- Search for “Claude Code-credentials”
- Open the item → Access Control
- Add CodexBar.app to “Always allow access by these applications”
- Or adjust Keychain prompt policy in Settings → Providers → Claude
No cost data showing
No cost data showing
Cost summary requires local Claude project logs.Solution:
- Verify Claude projects exist:
ls ~/.config/claude/projectsorls ~/.claude/projects - Ensure Claude CLI has been used recently (logs from last 30 days)
- Enable cost summary: Settings → General → Show cost summary
CLI Usage
Key Files
- OAuth:
Sources/CodexBarCore/Providers/Claude/ClaudeOAuth/* - Web API:
Sources/CodexBarCore/Providers/Claude/ClaudeWeb/ClaudeWebAPIFetcher.swift - CLI PTY:
Sources/CodexBarCore/Providers/Claude/ClaudeStatusProbe.swift,Sources/CodexBarCore/Providers/Claude/ClaudeCLISession.swift - Cost usage:
Sources/CodexBarCore/CostUsageFetcher.swift,Sources/CodexBarCore/Vendored/CostUsage/*
Related Documentation
- Multi-Account Setup - Configure multiple accounts
- CLI Reference - CLI usage and options
- Provider Authoring - How providers work internally
