Tiny CLI to check AI subscription usage from a single self-contained Bash script.
No build step. No daemon. No framework. No web scraping. Just bash, curl, jq.
Currently supports:
- Claude
- Codex
- Cursor
- Gemini CLI
- JetBrains AI
- GitHub Copilot
- Single script:
./aiusage - Core dependencies stay minimal:
bash,curl,jq - Works on anything that runs bash
- Reads the auth/session state you already have locally
- Fetches usage directly from provider-backed endpoints when available
- Claude
5handWeeklyusage bars - Codex
5handWeeklyusage bars - Cursor monthly credit or request usage
- Gemini CLI quota usage for Google OAuth / Code Assist accounts
- JetBrains AI credit usage from local IDE quota state
- GitHub Copilot
PremiumandChatquota bars - Local reset time for each window when the provider exposes it
- Required:
bash,curl,jq - Claude: local
claudelogin - Codex: local
codexlogin - Cursor:
sqlite3and a supported browser logged intocursor.com, or setCURSOR_COOKIE - Cursor on Chromium-based browsers:
python3andopensslfor cookie decryption - Gemini: local
geminilogin - JetBrains: a local JetBrains IDE with AI Assistant enabled
- Copilot: run
copilot loginor setCOPILOT_GITHUB_TOKEN
chmod +x ./aiusage./aiusage
# Claude only
./aiusage claude
# Cursor + Claude
./aiusage cursor claude
# Any subset, in the order you want
./aiusage codex gemini jetbrains copilot- It reads local auth or quota state already present on your machine, then calls the provider usage endpoints.
- Example local sources include
~/.codex/auth.json,~/.gemini/oauth_creds.json, Claude credentials, browser cookies for Cursor, and JetBrains quota files. - If auth is missing, expired, or the upstream endpoint changed, that provider is shown as unavailable or returns an error line.
- Gemini uses the OAuth login created by
gemini; if the session is expired, rungeminiagain. - JetBrains usage is read from the newest local
AIAssistantQuotaManager2.xmlunder your JetBrains config directory. - Cursor session lookup is automatic from Firefox, Chrome, Arc, Brave, Edge, or Helium; you can also set
CURSOR_COOKIEmanually. - Copilot token lookup prefers
COPILOT_GITHUB_TOKEN, then the localaiusagecache, thencopilot logincredentials, then plaintext~/.copilot/config.jsonfallback. - Copilot plans with unlimited or org-managed quotas may show only the plan name instead of bars.
- Provider endpoints and response shapes can change over time.
Treat this as a local utility with access to existing auth state.
- This script reads local auth files, local quota files, and in Cursor's case browser cookie stores. Run it only on machines you trust.
- On macOS, extracted Cursor and Copilot credentials are cached in the login Keychain. On Linux, they are cached in
~/.cache/aiusage/with0600permissions because the script avoids extra secret-storage dependencies. - If you set
CURSOR_COOKIEorCOPILOT_GITHUB_TOKENmanually, avoid leaving them in shell history or dotfiles. - Do not commit token files, copied cookies, or cache files.
- Because this is a plain Bash script, you can audit exactly what it reads and what URLs it calls before running it.

