Skip to main content

CLI tool to check AI coding tool usage quotas (Claude, Codex, Gemini, Copilot, z.ai)

Project description

ai-usage-cli

PyPI version Python License: MIT

Check your AI coding tool usage quotas from the terminal. Supports Claude Code, Codex, Gemini, GitHub Copilot, and z.ai.

$ ai-usage

  Claude  (oauth)  [Max]  user@example.com
    Session (5h)         72.0% left  [█████░░░░░░░░░░░░░░░]  resets in 4h12m
    Weekly (7d)          85.0% left  [███░░░░░░░░░░░░░░░░░]  resets in 132h

  Codex  (oauth)  [Plus]
    Daily                95.2% left  [█░░░░░░░░░░░░░░░░░░░]

  Gemini  (oauth)  [Free]
    Per-minute          100.0% left  [░░░░░░░░░░░░░░░░░░░░]
    Daily                88.4% left  [██░░░░░░░░░░░░░░░░░░]  resets in 16h

Installation

Recommended — install with pipx for an isolated global command:

pipx install ai-usage-cli

Or with pip:

pip install ai-usage-cli

Usage

ai-usage                      # all enabled providers
ai-usage -p claude             # single provider
ai-usage -p claude codex       # multiple providers
ai-usage -a                    # include disabled providers
ai-usage --json                # JSON output (for scripting)
ai-usage --plain               # plain text (no color, no unicode)
ai-usage | grep Claude         # auto-switches to plain when piped

Supported Providers

Provider Credential Source
Claude Code macOS Keychain (Claude Code-credentials) or ~/.claude/.credentials.json
Codex ~/.codex/auth.json (auto-refreshes OAuth token)
Gemini ~/.gemini/oauth_creds.json (auto-refreshes OAuth token)
GitHub Copilot apiKey in ~/.codexbar/config.json
z.ai apiKey in ~/.codexbar/config.json or Z_AI_API_KEY env var

Configuration

Provider settings are stored in ~/.codexbar/config.json. Each provider can be enabled/disabled and configured with API keys where needed.

Example:

{
  "providers": {
    "claude": { "enabled": true },
    "codex": { "enabled": true },
    "gemini": { "enabled": true },
    "copilot": { "enabled": false, "apiKey": "ghu_..." },
    "zai": { "enabled": false, "apiKey": "..." }
  }
}

Platform Notes

  • macOS: Claude credentials are read from the system Keychain. All other providers use file-based credentials and work cross-platform.
  • Linux: Claude credentials fall back to ~/.claude/.credentials.json. All other providers work the same as macOS.

Requirements

  • Python 3.10+
  • Active credentials for the providers you want to query

中文说明

终端查询 AI 编程工具配额用量。支持 Claude Code、Codex、Gemini、GitHub Copilot、z.ai。

安装

pipx install ai-usage-cli

使用

ai-usage                      # 查看所有已启用的 Provider
ai-usage -p claude             # 只看 Claude
ai-usage -p claude codex       # 看 Claude 和 Codex
ai-usage -a                    # 包含未启用的 Provider
ai-usage --json                # JSON 输出(适合脚本处理)
ai-usage --plain               # 纯文本输出(无颜色、无 Unicode)

Related Projects

  • CodexBar — macOS menu bar app for AI coding tool usage tracking. ai-usage-cli shares the same ~/.codexbar/config.json configuration and was built as a cross-platform CLI companion.

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

ai_usage_cli-0.1.0.tar.gz (15.7 kB view details)

Uploaded Source

Built Distribution

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

ai_usage_cli-0.1.0-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

Details for the file ai_usage_cli-0.1.0.tar.gz.

File metadata

  • Download URL: ai_usage_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 15.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.22

File hashes

Hashes for ai_usage_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 14bdb7232d210a157a992c936269cda277d426f8d9026f9b0ffebd5f48289c1c
MD5 5083c856bf2b4c83b3806675886b10da
BLAKE2b-256 0985e705e3dd3c5f4fc46a009efc55dd444180bd19a52f0f515f0bfb74580515

See more details on using hashes here.

File details

Details for the file ai_usage_cli-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ai_usage_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a06767e348afd54093c72ee2b75dcd5ab5833f9eac2587cef104f28c114b9654
MD5 e7e81a52b9923d677a5176cb501a49c8
BLAKE2b-256 79c75b6a53e9fd75f8ca1440a2eb32c7f5b93c021792ec65f7591af33274efea

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