Skip to main content

CLI tool to display Claude usage quota from claude.ai

Project description

ccquota

A CLI tool that displays your Claude usage quota — session limits, weekly limits, and optionally organization spending with per-user breakdown. Supports multiple accounts.

日本語版 README はこちら

How It Works

ccquota calls Claude's internal APIs directly. No browser is launched during normal use.

  1. Login (one-time per account): Opens Chrome for you to sign in to claude.ai. The session is saved locally under ~/.config/ccquota/sessions/<name>/.
  2. Show (default): Extracts cookies from saved sessions (headless, no window), then fetches usage data via curl_cffi which impersonates a real browser's TLS fingerprint to pass Cloudflare.

Example Output

Default — shows personal usage for all saved sessions:

  Your Usage (Alice)
  ──────────────────────────────────────────────
  Session           ░░░░░░░░░░░░░░░░░░░░░░░░░ 0%
  Weekly Limit      ██████████████████░░░░░░░ 72%
                    ↻ resets 4/29 (Wed) 17:00
  Claude Design     █████████████░░░░░░░░░░░░ 54%
                    ↻ resets 4/29 (Wed) 17:00

  Your Usage (Bob)
  ──────────────────────────────────────────────
  Session           ░░░░░░░░░░░░░░░░░░░░░░░░░ 0%
  Weekly Limit      ████████░░░░░░░░░░░░░░░░░ 32%
                    ↻ resets 4/30 (Thu) 14:00

With --org — adds organization spending and per-user breakdown for each session:

  Your Usage (Alice)
  ──────────────────────────────────────────────
  Session           ░░░░░░░░░░░░░░░░░░░░░░░░░ 0%
  Weekly Limit      ██████████████████░░░░░░░ 72%
                    ↻ resets 4/29 (Wed) 17:00
  Claude Design     █████████████░░░░░░░░░░░░ 54%
                    ↻ resets 4/29 (Wed) 17:00

  Organization (MyTeam)
  ──────────────────────────────────────────────
  Monthly Spend     ███████████████░░░░░░░░░░ 60%  ($120.09 / $200.00)
  Balance           $79.90

  Spend by User
  ──────────────────────────────────────────────
  Alice                     $95.47
  Bob                       $24.67

  Your Usage (Bob)
  ──────────────────────────────────────────────
  Session           ░░░░░░░░░░░░░░░░░░░░░░░░░ 0%
  Weekly Limit      ████████░░░░░░░░░░░░░░░░░ 32%
                    ↻ resets 4/30 (Thu) 14:00

Requirements

  • Python 3.13+
  • uv (recommended) or pip
  • Google Chrome installed on your system

Installation

git clone https://github.com/sanoakr/ccquota.git
cd ccquota
uv sync

Usage

First-time setup

uv run ccquota login

A Chrome window opens. Sign in to claude.ai, and the tool auto-detects completion (up to 5 min timeout). The session is saved under ~/.config/ccquota/sessions/<name>/.

Adding another account

Simply run ccquota login again and sign in with a different account:

ccquota login      # first account
ccquota login      # second account — opens a fresh browser

View usage

ccquota                  # all accounts (default)
ccquota --user Alice     # specific account only
ccquota --org            # all sessions + organization spending & per-user breakdown
ccquota --watch          # refresh every 60s
ccquota -w -n 30         # refresh every 30s
ccquota -o -w            # organization + watch mode
ccquota --debug          # print raw JSON from APIs

Install system-wide with uv tool install -e ., then ccquota is available everywhere. Otherwise prefix with uv run.

Logout

ccquota logout           # remove session (auto-selects if only one)
ccquota logout Alice     # remove a specific session
ccquota logout --all     # remove all sessions

Options

Flag Short Description
--user NAME -u NAME Show only the specified session
--org -o Show all sessions with organization spending and per-user breakdown
--watch -w Refresh periodically (default: every 60s)
--interval SEC -n SEC Watch interval in seconds (default: 60)
--debug Print raw JSON data from APIs

API Endpoints Used

Endpoint Data When
/api/bootstrap Organization ID, user info Always
/api/organizations/{id}/usage Session (5h), weekly, Design, Opus utilization Always
/api/organizations/{id}/overage_spend_limit Monthly spend vs. limit --org
/api/organizations/{id}/overage_spend_limits Per-user spend breakdown --org
/api/organizations/{id}/prepaid/credits Prepaid credit balance --org

Data Storage

Session data is stored under ~/.config/ccquota/sessions/, with one subdirectory per account. Each is a Chromium user-data directory containing claude.ai session cookies. No credentials are stored elsewhere.

Legacy single-session data (~/.config/ccquota/browser/) is automatically migrated on first run.

License

MIT

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

ccquota-0.5.3.tar.gz (24.0 kB view details)

Uploaded Source

Built Distribution

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

ccquota-0.5.3-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file ccquota-0.5.3.tar.gz.

File metadata

  • Download URL: ccquota-0.5.3.tar.gz
  • Upload date:
  • Size: 24.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ccquota-0.5.3.tar.gz
Algorithm Hash digest
SHA256 c1f3fda37cfc45e2e68b7d8f543999f05f55e3c186c6bfb6cd57618bbed2b0f4
MD5 9c303889ed396406424d7dcfb090eea5
BLAKE2b-256 f0a7783935a3d75fbca38a70eee23e19f573e08d77e89e0a4160fe74c6c2f42a

See more details on using hashes here.

Provenance

The following attestation bundles were made for ccquota-0.5.3.tar.gz:

Publisher: publish.yml on sanoakr/ccquota

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ccquota-0.5.3-py3-none-any.whl.

File metadata

  • Download URL: ccquota-0.5.3-py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ccquota-0.5.3-py3-none-any.whl
Algorithm Hash digest
SHA256 5f5ae2d90cb6c60c96ff17227d24caf02d65204119adab7a0bed905f3303e54d
MD5 3eaa4057234d6d98c29429b438edc4ac
BLAKE2b-256 2e438f2e418673b3dc150d188d809a4e7ff4715e2a828ad9b083c994e8ec5a70

See more details on using hashes here.

Provenance

The following attestation bundles were made for ccquota-0.5.3-py3-none-any.whl:

Publisher: publish.yml on sanoakr/ccquota

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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