Skip to content
SK
← Back to home

Project dossier

tracker

Developer Tool / CLI

  • Python 3.11+argparse CLI, rich TUI
  • SQLiteUsage samples, token history, backoff state
  • OAuth 2.0 / OIDCPer-provider refresh with token rotation
  • httpxProvider REST integrations
  • GitHub ActionsCI + PyPI trusted publishing (OIDC)

01 // What it is

An open-source Python CLI that shows the remaining quota on every AI subscription you own in one terminal command. Instead of logging into Claude, Grok, Codex, Gemini, and OpenAI separately to answer "who still has quota?", tracker imports the credentials the official CLIs already wrote, polls each provider's usage endpoint, and renders one dashboard.

02 // Why it exists

Paying for five AI subscriptions means five separate dashboards and no single answer to the only question that matters mid-task: which account still has budget? The data already exists on disk in each CLI's credential store — it just was not being read in one place.

03 // Surfaces

Surface
Role

Dashboard

tracker list

Per-account progress bars across all five providers

One-liner

tracker status

Compact summary plus the account with most headroom

Live mode

tracker list --watch

In-place redraw on an interval

History

tracker tokens

Token and cost history out of SQLite

Discord bot

tracker webhook

Posts one message and edits it on a cycle

04 // Engineering notes

Hardest problem: single-use refresh tokens

Grok's OIDC and Codex's ChatGPT grants rotate on every refresh. A naive refresh silently invalidated the provider CLI's own token and pushed the user into a refresh_token_reused re-login loop. The fix writes the rotated grant back to both tracker's store and the provider's file, making tracker a transparent read-only observer rather than a credential thief.

A silent data bug found by profiling

A slow refresh (18s) turned out not to be network-bound at all. insert_token_usage used INSERT OR IGNORE against a table with no UNIQUE constraint, so every sync re-inserted the full transcript history — 4.5M rows for 1,464 real events. Because the summary query SUMs those rows, reported lifetime cost was inflated 1,776x with nothing visibly wrong in the UI. A UNIQUE index, a one-time migration, a pre-filter before json.loads, and concurrent collection took refresh from 18.2s to 3.0s and the database from 808 MB to 9.1 MB.

Never drops a row

On HTTP 429 it honors the backoff window and renders the last-known sample tagged backing-off, so one rate-limited account cannot hide the rest of the fleet. Every rendered row carries its provenance: api, derived, cached, or backing-off.

05 // Stack

  • Python 3.11+argparse CLI, rich TUI
  • SQLiteUsage samples, token history, backoff state
  • OAuth 2.0 / OIDCPer-provider refresh with token rotation
  • httpxProvider REST integrations
  • GitHub ActionsCI + PyPI trusted publishing (OIDC)

06 // Honest status

Honest status

Public, open source, and published on PyPI as ai-quota-tracker (v0.2.2) — install with uv tool install, pipx, or pip. Releases are automated with GitHub Actions trusted publishing (OIDC, no stored token): pushing a version tag builds, verifies tag matches version, smoke-tests the wheel in a clean venv, then publishes. Regression tests run in CI on Python 3.11-3.13.

07 // Links