Skip to main content

A real-time terminal monitoring tool for Claude Code token usage with advanced analytics and Rich UI

Project description

Pacman Token Manager

Tool for monitoring more detail info on token usage in your terminal.

┌──────────────────────────────────────────────────────────────┐
│  Pacman Token Manager                                        │
├──────────────────────────────────────────────────────────────┤
│  Halfway there · Resets in 4h 25m (started 10:00 AM)         │
├──────────────────────────────────────────────────────────────┤
│                                                              │
│  TKN █████░░░░░░░░░░░░░░░  27%  193,920 / 728,474            │
│  534k left · Resets in 4h 25m                                │
│                                                              │
├─ Usage over time ────────────────────────────────────────────┤
│                                                              │
│  Period             Usage              TKN                   │
│  Current session    ███░░░░░░░░░  27%   193k                 │
│  Resets in 4h 25m                                            │
│                                                              │
│  Current week                      4.6m                      │
│  (7-day rolling total)                                       │
│                                                              │
├─ Breakdown ──────────────────────────────────────────────────┤
│                                                              │
│  By Model           Usage        TKN                         │
│  Opus               ████████████ 183k                        │
│  Sonnet             ░░░░░░░░░░░░ 10k                         │
│                                                              │
├─ Guidance ───────────────────────────────────────────────────┤
│                                                              │
│  Opus is handling 75% of your work. Sonnet is often          │
│  sufficient and more economical.                             │
│                                                              │
│  → Switch to Sonnet?  [Y]es  [N]o thanks                     │
│                                                              │
│  Ctrl+C to exit                                              │
└──────────────────────────────────────────────────────────────┘

Installation

# From PyPI (after publishing)
pip install pacman-token-manager

# Or install from GitHub
pip install git+https://github.com/tsuimou/pacman-token-manager.git

# Or local development
pip install -e .

Usage

# Pick your favorite command
chomp
pac
pacman
pactkn
pacman-token-manager

Features

  • Accurate token tracking - Counts only billable tokens (excludes free cache reads)
  • All projects view - Tracks usage across ALL your Claude Code projects
  • Matches Claude /usage - Shows the same percentage as Claude's built-in /usage
  • Human-first design - No technical jargon, just clear status
  • Smart alerts - Warns you at 50%, 75%, and 90% usage
  • Model breakdown - See which models are eating your tokens
  • Project breakdown - See which projects are using your quota
  • Usage over time - Track 5hr window and weekly usage
  • Contextual guidance - Smart recommendations based on your usage patterns
  • Interactive actions - Press Y/N to execute suggested actions
  • Zero token cost - Pacman reads local files, doesn't call the API

Display Information

Section Data Shown
Token Status Progress bar + % + tokens used/limit + reset time
Usage Over Time Current session (% + reset time) and Current week (7-day total)
Breakdown By Model and By Project with token counts
Guidance Context-aware recommendation + optional Y/N action

Smart Guidance

Pacman provides contextual guidance based on your usage:

Condition Guidance Action
≥90% usage "You're almost at your limit..." → Run /compact? [Y/N]
High burn + ≥70% "Using tokens quickly..." → Run /compact? [Y/N]
Heavy Opus (>60%) "Opus is handling X%..." → Switch to Sonnet? [Y/N]
≥75% usage "Running low on tokens..." → Run /compact? [Y/N]
High burn rate "High token velocity..." (informational)
50-74% usage "Halfway through..." (informational)
<50% usage "You're in good shape." (none needed)

Interactive Actions

When a Y/N prompt appears, you can:

  • Press Y to execute the suggested command
  • Press N to dismiss (won't show again this session)
  • Press Ctrl+C to exit

Token Calculation

Pacman correctly calculates billable tokens that count toward your rate limit:

Token Type Counts Toward Limit?
Input tokens Yes
Output tokens Yes
Cache creation Yes
Cache reads No (FREE)

This matches how Claude's /usage calculates your usage.

Alerts

Threshold Color Alert
50% Yellow Halfway there
75% Orange Running low
90% Red ALMOST OUT!

Requirements

  • Python 3.9+
  • Claude Code CLI (creates the usage data files in ~/.claude/projects/)

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

pacman_token_manager-3.1.0.tar.gz (85.3 kB view details)

Uploaded Source

Built Distribution

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

pacman_token_manager-3.1.0-py3-none-any.whl (99.8 kB view details)

Uploaded Python 3

File details

Details for the file pacman_token_manager-3.1.0.tar.gz.

File metadata

  • Download URL: pacman_token_manager-3.1.0.tar.gz
  • Upload date:
  • Size: 85.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for pacman_token_manager-3.1.0.tar.gz
Algorithm Hash digest
SHA256 1ea997b901bb5f40e74b2c561d5ed897b86878180eb92921fbe7e31937c79ccf
MD5 573d6d091abf885ab7695c12b889cb31
BLAKE2b-256 9ca1bb6bbf6352d9ad81830424bd51ebbde0c09f0d1f87263c38af0aa0ab9ab1

See more details on using hashes here.

File details

Details for the file pacman_token_manager-3.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pacman_token_manager-3.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 77cb665d78cd028d1fa22de44eeaa6f8ac3ac6b67169e9074c83102859c33b8b
MD5 6be30583defa8d12d540ad6bb8179efa
BLAKE2b-256 0b68bfa9b5c1d9e7df452c70e9b385d737cc2f6f26c18b309f604bf67ca607fb

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