Skip to main content

System tray monitor for Claude Code token usage

Project description

Claude Code Usage Overlay

A Linux/GNOME system tray application that monitors your Claude Code token usage and alerts you before hitting limits.

Python Platform License

Features

  • System tray icon with color-coded gauge (green/yellow/red based on usage)
  • Panel label showing session and weekly usage percentages
  • Popup notifications at configurable thresholds (default: 50%, 75%, 90%)
  • Configurable settings via JSON file or Settings menu
  • Auto-start on login via XDG autostart

Screenshots

The tray icon shows your current usage with:

  • Arc fill = session usage (5-hour window)
  • Color = worst-case urgency (max of session/weekly)
  • Panel label = "45%|67%" format

Requirements

  • Linux with GNOME Shell (or compatible desktop with AppIndicator support)
  • Python 3.11+
  • Claude Code CLI installed and authenticated
  • AppIndicator extension for GNOME Shell

System Dependencies

# Ubuntu/Debian
sudo apt install python3-gi python3-gi-cairo gir1.2-ayatanaappindicator3-0.1 gir1.2-notify-0.7

# Fedora
sudo dnf install python3-gobject python3-cairo libayatana-appindicator-gtk3 libnotify

# Arch
sudo pacman -S python-gobject python-cairo libayatana-appindicator libnotify

GNOME Shell Extension

Install the AppIndicator Support extension for GNOME Shell to see system tray icons.

Installation

Quick Install (recommended)

git clone https://github.com/Maex-z9/CC_Usage.git
cd CC_Usage
./install.sh

This installs system dependencies and the app. Then run with: claude-usage

Manual Install

  1. Install system dependencies:

    # Ubuntu/Debian
    sudo apt install python3-gi python3-gi-cairo gir1.2-ayatanaappindicator3-0.1 gir1.2-notify-0.7
    
    # Fedora
    sudo dnf install python3-gobject python3-cairo libayatana-appindicator-gtk3 libnotify
    
    # Arch
    sudo pacman -S python-gobject python-cairo libayatana-appindicator libnotify
    
  2. Install the app:

    pip install git+https://github.com/Maex-z9/CC_Usage.git
    
  3. Authenticate with Claude Code (if not already done):

    claude
    # Follow the authentication flow
    

Usage

Run the application:

claude-usage

Or if running from source:

python3 -m src.main

Menu Options

Click the tray icon to access:

  • Current usage percentages and reset time
  • Refresh - Force update usage data
  • Settings submenu:
    • Pause Notifications - Temporarily disable alerts
    • Autostart on Login - Enable/disable auto-start
    • Edit Config File - Open config in text editor
  • Quit - Exit the application

Configuration

Config file location: ~/.config/claude-usage-overlay/config.json

{
  "session_thresholds": [50, 75, 90],
  "weekly_thresholds": [50, 75, 90],
  "polling_interval": 300,
  "pause_notifications": false,
  "autostart_enabled": false
}
Setting Description Default
session_thresholds Alert thresholds for 5-hour session usage [50, 75, 90]
weekly_thresholds Alert thresholds for 7-day weekly usage [50, 75, 90]
polling_interval Seconds between API checks (30-3600) 300 (5 min)
pause_notifications Disable popup alerts false
autostart_enabled Start on login false

How It Works

  1. Reads your OAuth token from ~/.claude/.credentials.json (created by Claude Code CLI)
  2. Polls the Anthropic usage API every 5 minutes (configurable)
  3. Displays usage in the system tray with color-coded urgency
  4. Shows desktop notifications when thresholds are crossed

Privacy & Security

  • No API keys stored in the repo - Uses Claude Code's existing credentials
  • Credentials stay local - Reads from ~/.claude/.credentials.json
  • Config stays local - Stored in ~/.config/claude-usage-overlay/
  • No data sent anywhere - Only communicates with Anthropic's API

Known Issues

See KNOWN_ISSUES.md for details on:

  • GNOME Shell tooltip limitations (using panel label instead)
  • AppIndicator menu accelerator limitations

Contributing

Contributions welcome! Please open an issue or PR.

License

MIT License - See LICENSE for details.

Acknowledgments

Built with Claude Code using the GSD workflow.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

claude_code_usage-1.0.0.tar.gz (14.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

claude_code_usage-1.0.0-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

Details for the file claude_code_usage-1.0.0.tar.gz.

File metadata

  • Download URL: claude_code_usage-1.0.0.tar.gz
  • Upload date:
  • Size: 14.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for claude_code_usage-1.0.0.tar.gz
Algorithm Hash digest
SHA256 9822e92848d064df1c60552336157fe51b2302fecfe8f10a17b7f6db5386429c
MD5 744f0cd7b999d4d285ae8b0041546870
BLAKE2b-256 b18ad1fe4340a0358261ab2e7139fb8d71cea96ccea335aa6c1ab047c9ad576d

See more details on using hashes here.

File details

Details for the file claude_code_usage-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for claude_code_usage-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 43c1aa3138bb66d509bd78d22dc29c1865204589f8c408dab38497f5fd7556e4
MD5 779a19c5112aae8eb6ee6ac890658675
BLAKE2b-256 5ad5cfd206db153e8393d0cbfbd1815361c0e6fbb326438703f03bcb015a97a9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page