GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - frittlechasm/aiusage: Simple CLI command to check usage limits of your AI Subscription usage.

BranchesTags
Open more actions menu

Latest commit

 

History

112 Commits
112 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
tests
tests
 
 
.gitignore
.gitignore
 
 
AGENTS.md
AGENTS.md
 
 
CLAUDE.md
CLAUDE.md
 
 
CONTEXT.md
CONTEXT.md
 
 
CONTRIBUTORS.md
CONTRIBUTORS.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
aiusage
aiusage
 
 
favicon.ico
favicon.ico
 
 
favicon.svg
favicon.svg
 
 
img.png
img.png
 
 
install.ps1
install.ps1
 
 
install.sh
install.sh
 
 

Repository files navigation

aiusage

License GitHub

aiusage CLI output

AI subscription usage in your terminal.

Install

macOS, Linux, WSL:

curl -q -fsSL https://raw.githubusercontent.com/frittlechasm/aiusage/main/install.sh | sh

Windows PowerShell:

irm https://raw.githubusercontent.com/frittlechasm/aiusage/main/install.ps1 | iex
  • Requires bash, curl, jq.
  • Cursor's optional automatic browser-cookie lookup also requires sqlite3.
  • Chromium-based browsers additionally require python3; Linux also requires openssl. macOS uses its built-in CommonCrypto API for decryption, keeping the browser key out of process arguments.
  • Set CURSOR_COOKIE to skip browser lookup and these optional dependencies.

By default this installs to ~/.local/bin on macOS/Linux/WSL and %LOCALAPPDATA%\Programs\aiusage\bin on Windows. To choose a directory:

curl -q -fsSL https://raw.githubusercontent.com/frittlechasm/aiusage/main/install.sh | sh -s -- --dir "$HOME/bin"

Usage

./aiusage                         # auto-detect providers
./aiusage claude                  # Claude only
./aiusage cursor claude           # Cursor + Claude
./aiusage codex antigravity       # any subset, in the order you want
./aiusage opencode-go             # OpenCode Go only
./aiusage --version               # print the installed version
./aiusage update                  # update to the latest GitHub release

aiusage update checks the latest GitHub release, validates the downloaded script, and atomically replaces the installed script. The install directory must be writable by the current user.

How it works

  • Single self-contained bash script — no build step, no daemon, no framework.
  • Reads quota reports or local quota files, or calls provider usage endpoints with existing credentials.
  • On macOS, Claude credentials are read from Keychain first, falling back to ~/.claude/.credentials.json when no token can be read. Linux uses the credentials file.
  • Local sources include ~/.codex/auth.json, ~/.gemini/oauth_creds.json, ~/.local/share/opencode/auth.json, ~/.grok/auth.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.

Provider notes

Provider What it shows Auth source
Claude 5h, Weekly, and optional Fable usage bars, banked reset count and expiries when offered, extra credit usage claude login credentials
Codex Available usage windows (for example 5h or Weekly), banked reset expiries, and extra credits ~/.codex/auth.json
Cursor Monthly credit or request usage Browser cookies or CURSOR_COOKIE
Antigravity Usage and reset times for each model group and quota window agy login
Gemini (deprecated) Legacy Code Assist quota usage gemini login credentials
JetBrains AI credit usage from local IDE quota state AIAssistantQuotaManager2.xml
Copilot AI Credits usage, with legacy Premium, Chat, and Completions quotas when applicable COPILOT_GITHUB_TOKEN or copilot login
OpenCode Go 5h, Weekly, and Monthly usage opencode login credentials, OPENCODE_GO_API_KEY, or OPENCODE_API_KEY
Grok Weekly credit usage grok login session in ~/.grok/auth.json (or $GROK_HOME)
  • Claude limit resets can be redeemed in Settings → Usage on Claude web or Desktop; the CLI shows the remaining count and available expiry dates.
  • Cursor session lookup is automatic from Firefox, Chrome, Arc, Brave, Edge, or Helium.
  • Antigravity uses the optional agy CLI, version 1.1.11 or later. Sign in with agy and leave slash commands enabled. If agy is installed and signed out, the quota check can take up to 15 seconds. Antigravity CLI changelog
  • Google moved individual, AI Pro, and AI Ultra users to Antigravity on June 18, 2026. For existing Code Assist licenses, use aiusage gemini or aiusage all gemini to include the deprecated provider. Google's migration announcement
  • Copilot uses AI Credits for current plans and retains premium-request tracking for legacy annual plans.
  • Copilot plans with unlimited or org-managed quotas may show only the plan name instead of bars.
  • The Grok CLI session lasts about 6 hours and refreshes only while grok runs. After an idle period, run grok once to refresh it. XAI_API_KEY cannot read subscription usage.
  • Provider endpoints and response shapes can change over time.

Adding providers

  1. Verify the quota source and add fetch_<provider>() with logged-out, expired-session, and network-error handling as applicable.
  2. Register the provider in provider_label(), provider_fetch_fn(), provider_available(), and provider_unavailable_message(). Add its identifier to AUTO_PROVIDERS for automatic discovery.
  3. Add provider cases in tests/integration/test_providers.bash and update the provider notes above. Use tests/helpers/mock_setup.bash for HTTP mocks.

Testing

Tests live in tests/. Run ./tests/run_tests after every change.

  • tests/unit/ — helpers and pure functions (calculations, rendering, formatting, caching, CLI args).
  • tests/integration/ — fetch_* provider functions.

Warning

Security — 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 through security commands on stdin. Normal Keychain approval rules still apply. Oversized or multiline values skip this optional cache. On Linux, they are cached in ~/.cache/aiusage/ with 0600 permissions.
  • If you set CURSOR_COOKIE, COPILOT_GITHUB_TOKEN, OPENCODE_GO_API_KEY, or OPENCODE_API_KEY manually, avoid leaving them in shell history or dotfiles.
  • Requests pass headers and bodies through curl configuration on stdin. Credentials stay out of process arguments and config files.
  • Provider requests, installer downloads, and self-updates ignore default curl configuration files such as .curlrc.
  • Install-directory paths are written to shell profiles as literal values. Control characters are rejected.
  • 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.

Inspired by codexbar by @steipete.

About

Simple CLI command to check usage limits of your AI Subscription usage.

Topics

bash-scriptcli-toolscross-platformdevtoolsquota-monitoringshell-scriptterminal-basedusage-monitoring

Resources

Readme
MIT license
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.