claudometer
claudometer copied to clipboard
π Claudometer - Don't let "Usage limit reached" catch you off guard. Real-time Claude usage monitoring for macOS & Linux with near-limit alerts.
Claudometer
A tray-first desktop application for macOS and Linux that shows your Claude and Codex usage limits in near real-time.
Features
- Real-time usage tracking - Monitor your 5-hour session and weekly limits (Claude + Codex)
- Provider + auth options:
- Claude: Claude Code (OAuth) or Claude Web (
sessionKeycookie) - Codex: Codex OAuth (local login) or Codex CLI
- Claude: Claude Code (OAuth) or Claude Web (
- System tray integration - Always visible in your menu bar, stays out of your way
- Near-limit alerts - Get notified when approaching usage limits (β₯90%)
- Secure credential storage - Claude session keys stored in OS Keychain (macOS) or Secret Service (Linux)
- Auto-updates - Stay up to date with signed automatic updates
- Multi-organization support - Switch between Claude organizations seamlessly (Claude Web only)
Installation
macOS
Download the latest .dmg from GitHub Releases, open it, and drag Claudometer to your Applications folder.
Linux
Download from GitHub Releases:
| Format | Best for |
|---|---|
.AppImage |
Universal (recommended) - just download and run |
.deb |
Ubuntu, Debian, Pop!_OS |
.rpm |
Fedora, RHEL, openSUSE |
Tip: For AppImage, make it executable with
chmod +x Claudometer*.AppImageand run it.
Build from Source
If you prefer to build from source, see the Development section below.
Quick Start
- Launch Claudometer - The app starts minimized in your system tray
- Open Settings - Click the tray icon β "Open Settings..."
- Choose what to track:
- Claude (optional):
- Claude Code (recommended): run
claude loginonce and Claudometer will use those credentials - Claude Web: paste your
sessionKeycookie from claude.ai
- Claude Code (recommended): run
- Codex (optional):
- Codex OAuth (recommended): log in with
codexand Claudometer will read your local credentials - Codex CLI: uses the local
codexbinary
- Codex OAuth (recommended): log in with
- Claude (optional):
- Save - Your usage stats will appear in the tray menu
Project Structure
claudometer/
βββ src-tauri/ # Tauri (Rust) backend + bundling config
β βββ tauri.conf.json # App + bundle + updater config
β βββ capabilities/ # Permission scopes
β βββ src/ # Rust modules (tray, polling, commands, settings)
βββ src/
β βββ renderer/settings/ # Vite settings UI (Tauri invoke + events)
β βββ common/ # Shared types for the settings UI
β βββ generated/ # Generated IPC types (from Rust)
βββ assets/ # Tray icons
βββ package.json
βββ tsconfig.json
βββ CLAUDE.md # AI assistant instructions
How It Works
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β User Actions β
β β’ Launch app β
β β’ Open settings β
β β’ Select usage source β
ββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Tauri backend (src-tauri/src) β
β β’ Initializes tray icon β
β β’ Starts polling loop (configurable interval) β
β β’ Coordinates data flow β
ββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Polling Loop β
β 1. Read settings (enabled providers + sources) β
β 2. Fetch provider snapshots (Claude + Codex) β
β 3. Normalize/parse responses β
β 4. Update tray menu + emit snapshot event β
ββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Usage Provider β
β β’ Claude Web: claude.ai/api (Cookie sessionKey=...) β
β β’ Claude OAuth: api.anthropic.com/api/oauth/usage β
β β’ Codex OAuth: chatgpt.com/* (Bearer token) β
β β’ Codex CLI: local codex binary β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Data Flow
- App starts β Loads settings (including usage source)
- Every N seconds β Polls usage data for the selected source
- On response β Parses JSON and updates tray menu text
- On error β Updates tray to show error state; polling only pauses when all enabled providers are blocked (missing key / unauthorized)
Debug (simulate notifications)
Enable debug tray actions:
CLAUDOMETER_DEBUG=1 bun run dev
Then use the tray menu items under βDebug:β to simulate near-limit and reset notifications.
Development
Prerequisites
- Bun runtime
- macOS or Linux (Windows not currently supported)
macOS:
xcode-select --install
Linux (Ubuntu/Debian):
sudo apt update && sudo apt install -y \
libwebkit2gtk-4.1-dev libappindicator3-dev pkg-config build-essential
Linux (Fedora):
sudo dnf install webkit2gtk4.1-devel libappindicator-gtk3-devel pkg-config gcc-c++
Linux (Arch):
sudo pacman -S webkit2gtk-4.1 libappindicator-gtk3 pkg-config base-devel
Build from Source
# Install Bun (if not installed)
curl -fsSL https://bun.sh/install | bash
# Clone and build
git clone https://github.com/leonardocouy/claudometer.git
cd claudometer
bun install
bun run build
# Output in ./src-tauri/target/release/bundle/
Available Scripts
| Command | Description |
|---|---|
bun run dev |
Run Tauri app in development mode |
bun run dev:ui |
Run settings UI only (Vite) |
bun run build |
Build Tauri bundles (uses tauri.conf.json) |
bun run build:ui |
Build settings UI only |
bun run sync-versions |
Keep versions in sync across config files |
bun run typecheck |
TypeScript type checking |
bun run check |
Run Biome linter and formatter checks |
bun run lint |
Auto-fix linting issues |
bun run format |
Auto-format code |
bun run generate:ipc-types |
Generate src/common/generated/ipc-types.ts from Rust |
bun run check:ipc-types |
Fail CI if IPC types drift |
Tech Stack
| Layer | Technology |
|---|---|
| App Framework | Tauri v2 |
| Build Tool | Tauri CLI + Vite |
| Language | TypeScript 5.9 |
| Runtime | Bun |
| Settings Storage | tauri-plugin-store (non-sensitive data) |
| Secret Storage | OS Keychain / Secret Service (keyring crate) |
| Linting/Formatting | Biome |
| Testing | Rust unit tests (cargo test --manifest-path src-tauri/Cargo.toml) |
Manual Test Matrix
Run these checks on:
- macOS (Apple Silicon + Intel)
- Linux (GNOME + KDE)
Checklist:
- Tray starts with no windows; menu shows snapshot lines.
- βOpen Settingsβ¦β creates/focuses the settings window.
- Web mode: saving a valid session key refreshes snapshot and updates tray.
- CLI mode: after youβve logged into Claude Code, refresh shows snapshot and updates tray.
- βRemember session keyβ (web only) persists across restart (Keychain / Secret Service).
- Disabling βRememberβ keeps the key memory-only (does not persist across restart).
- Notifications: near-limit alerts (>= 90%) and reset notifications (when enabled).
- Autostart toggle reflects system state after restart/login.
- βCheck for Updatesβ¦β shows a result (up-to-date / update available / error).
- Codex OAuth: after logging in with
codex, refresh shows Codex usage in tray. - Codex CLI: with
codexinstalled, refresh shows Codex usage in tray.
Security & Privacy
Authentication Handling
Claude Web session key (sessionKey):
- Stored only in OS credential storage when βRememberβ is enabled (Keychain / Secret Service)
- Memory-only when βRememberβ is disabled (no persistence)
- Never logged: Session key is never included in logs, error messages, or telemetry
- Validation before storage: Session key is validated against Claude API before being saved
CLI Mode:
- Managed by Claude Code: Uses your Claude Code OAuth session
- Auto-refresh: Tokens are refreshed automatically by the CLI
- Claudometer reads only: App only reads credentials, never modifies them
- No persistence: Claudometer doesn't store or cache OAuth tokens
- Platform-specific credential location:
- macOS: Reads from system Keychain (Service:
Claude Code-credentials) - Linux: Reads from
~/.claude/.credentials.json
- macOS: Reads from system Keychain (Service:
What Gets Sent
Web Mode:
- HTTPS requests to
claude.ai/api/*endpoints:GET /api/organizations- Fetch available organizationsGET /api/organizations/:id/usage- Fetch usage stats
- Session key sent as Cookie header (same as browser)
CLI Mode:
- HTTPS requests to
api.anthropic.com/api/oauth/*endpoints:GET /api/oauth/usage- Fetch usage stats
- OAuth token sent as Bearer header
Codex:
- HTTPS requests to
chatgpt.comusage endpoints (OAuth mode) - Authorization sent as Bearer header (and optional
chatgpt-account-idheader)
Claudometer does not persist Codex tokens; it reads local credentials when needed.
Local Storage
The app stores these settings locally (non-sensitive) via tauri-plugin-store:
- Refresh interval (seconds)
- Selected organization ID
- "Remember session key" preference
- Provider toggles + sources (Claude/Codex)
- Autostart preference
- Updater preferences
Troubleshooting
Tray shows "unauthorized"
Web Mode: Your session key is invalid or expired:
- Open Settings
- Get a fresh session key from claude.ai (see Quick Start)
- Paste and save
CLI Mode: Your OAuth token expired:
- Re-authenticate with Claude Code:
claude # Follow OAuth flow again - App will automatically use new credentials
Tray shows "rate limited"
Claude API is rate-limiting your requests:
- The app automatically backs off for 5 minutes
- Consider increasing your refresh interval in Settings
Session key doesn't persist across restarts (Linux)
If βRemember session keyβ is disabled in Settings, your session key will not persist across restarts.
No organizations found
Your Claude account doesn't have any organizations:
- Free Claude accounts still have a "personal" organization
- If you see this error, try logging out and back in to claude.ai
- Get a fresh session key
Polling stopped
Check the tray menu:
- Unauthorized: Session key/token expired (see above)
- Rate limited: Auto-recovers in 5 minutes
- Error: Check the error message in the tray menu
If you have both providers enabled, polling only pauses when all enabled providers are blocked (missing key / unauthorized).
Codex not working
If Codex shows "unauthorized":
- Codex OAuth: log in again via
codex, then click βRefresh nowβ. - Codex CLI: ensure
codexis installed and available on yourPATH.
CLI mode not working
If you selected "Claude Code" but see "Claude CLI credentials not found":
macOS: Claudometer reads credentials from the system Keychain. Ensure you're logged in:
claude login
The credentials are stored automatically in Keychain by Claude Code.
Linux:
Claudometer reads from ~/.claude/.credentials.json. Ensure the file exists:
ls -la ~/.claude/.credentials.json
If missing, authenticate with Claude Code:
claude login
Tip: If CLI mode doesn't work, you can use Web mode as an alternative - just paste your
sessionKeycookie from claude.ai.
Roadmap
- [ ] Windows support
- [x] Desktop notifications when approaching usage limits
- [ ] Historical usage graphs
- [ ] Menu bar percentage display
- [x] Auto-update mechanism
Contributing
- Fork the repository
- Create a feature branch
- Make your changes following the existing code style
- Run
bun run checkto ensure code quality - Submit a pull request
License
MIT
Related Projects
- Claude API - Official API (different from web usage tracking)
- Tauri - Lightweight desktop apps with Rust backend + system WebView