Skip to main content

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)
  • 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

Metadata

Release files for ai-usage-cli 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ai-usage-cli 0.1.0
File Size Uploaded Provenance Actions
ai_usage_cli-0.1.0.tar.gz 15.7 kB Without provenance Details for ai_usage_cli-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ai-usage-cli 0.1.0
File Interpreter ABI Platform Actions
ai_usage_cli-0.1.0-py3-none-any.whl Python 3 none any Details for ai_usage_cli-0.1.0-py3-none-any.whl

Total release size: 32.5 kB

Release files / ai_usage_cli-0.1.0.tar.gz

Download URL ai_usage_cli-0.1.0.tar.gz
Size 15.7 kB
Tags Source
SHA-256 checksum
How to use checksums
14bdb7232d210a157a992c936269cda277d426f8d9026f9b0ffebd5f48289c1c
BLAKE2b-256 checksum
How to use checksums
0985e705e3dd3c5f4fc46a009efc55dd444180bd19a52f0f515f0bfb74580515
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.22

Release files / ai_usage_cli-0.1.0-py3-none-any.whl

Download URL ai_usage_cli-0.1.0-py3-none-any.whl
Size 16.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a06767e348afd54093c72ee2b75dcd5ab5833f9eac2587cef104f28c114b9654
BLAKE2b-256 checksum
How to use checksums
79c75b6a53e9fd75f8ca1440a2eb32c7f5b93c021792ec65f7591af33274efea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.22

Security for ai-usage-cli 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page