Skip to main content Switch to mobile version aiuse 5.6.2 Aggregate AI subscription/API usage and flag use-it-or-lose-it allotments
pip install aiuse==5.6.2 Copy PIP instructions
Your AI subscriptions reset unused capacity you already paid for. Claude, Codex, Copilot, Cursor, Grok, Gemini, OpenCode, and more each carve your usage into 5-hour / weekly / monthly windows — and whatever you don't burn by the reset is just gone. aiuse polls every plan you have from one terminal command and tells you, in plain language, what to use right now before it resets, and what's about to run out early so you can pace yourself.
CLI command: aiuse (stub ai → same entrypoint)
Which vendor CLI is which
Every report line's vendor name is grep-able (case-insensitive, substring OK) for the actual agent CLI whose quota it tracks:
aiuse --json exposes this same mapping per account row as cli_binary (null when there is no local CLI) — see docs/json-contract.md. Note the trap this table exists for: the quota CLIs (qwencloud, bl, caut, caam, tokscale, openusage, cswap, codexbar) measure usage; they are not how you burn it.
This is real aiuse output from synthetic demo accounts, not a screenshot. It's the exact table printed by plain aiuse, read bottom → top: the pools most worth using right now sort to the bottom.
A rolling window that has not been used yet sends no real reset time — its clock starts on first use — so its cell shows the window's full length and a ↻ marker instead of a countdown, e.g. 0u/100l/5h↻ (or 0u/100l/7d↻ / 0u/100l/30d↻ for providers whose weekly/monthly windows are rolling, such as Antigravity, Codex, and ClinePass). Calendar- or billing-anchored windows of a day or longer get no span when unused without a reset timestamp. The legend line ↻ = starts on first use appears only when at least one such cell is on the board. The marker is screen-only; --json carries rolling: true on explicitly rolling windows.
An in-use window whose source stops sending its reset time (CodexBar sends none for Antigravity's 5-hour windows; OpenUsage does) keeps its countdown: aiuse carries forward the last reset an earlier reading measured for that window, from any source, while that reset is still ahead and the window's usage has not fallen since (a fall means it reset). A carried time is an estimate, so it renders with ~ like any estimated reset (~3h), and --json marks it with resets_at_carried_from (docs/json-contract.md). A window that has not been used yet is never carried: its reported reset only slides with every query.
Pace and the PACE column
Window pace % (+N% / -N%) compares consumption against an even spend across the window (round((pace_ratio - 1) * 100) with pace_ratio = used_fraction / elapsed_fraction; elapsed floored at 5%). + means burning faster than an even spend (will run out early); - means burning slower (capacity will remain at reset). Early in a window (under 10% elapsed), readings are noisy and marked with ~ (e.g. +1351%~). Exhausted windows and windows with no reset time leave pace blank.
PACE column reports the row's overall pace = the highest window pace in the row (the window furthest ahead of spend that will run out first), marked with ~ if that highest window is early. It shows an em-dash (—) when no window has a pace reading or when any window in the row is exhausted (since the row is locked out until that reset).
Column alignment: all free text notes (<-, prepaid wallet, prepaid notes) appear after all fixed columns so columns align on every row. Narrow terminals first cut characters off the right of the OTHER column (marked …✂, down to the header's width), then shed PACE, then individual cell pace suffixes.
The colored ## score is the action queue from 0 (empty) to 99 (use as soon as possible). Its action-state boundaries are contiguous: slow ends at 49, mid runs from 50–74, and an active use recommendation starts at 75. ?? means usage could not be fetched; -- means rolling prepaid/PAYG inventory has no use-or-lose urgency.
Inside each live band (slow 25-49, mid 50-74, use 75-99) the score is how much money is at risk in the pool's window, log-scaled onto the band's range (6 points per decade, $0.01 at the band's floor to $100 at its ceiling). A window is priced from the plan's monthly_price in [plans.
Capacity is what is still unspent now: the refill's value times the percent still left — the figure --json reports as value_at_risk_usd. slow rows rank by capacity, so 5% left of a $200 plan's weekly window ($3.45) outranks 1% left of a $20 one ($0.07), and a weekly window outranks the same percent of a 5-hour one.
Projected waste is what the window's pace says will still be unspent when it resets: the pace's projected_waste_fraction times a full refill (for a priced account, --json's pace.projected_waste_usd). mid and use rows rank by it, so an imminent reset with real waste outranks a big window with days left: a $20 Claude plan's 5-hour window with 20 minutes to go and two thirds of it unspent ($0.20) outranks a weekly window that is exactly on pace ($0), though that weekly window holds $3.45. A window with no pace to project (no reset time) keeps its capacity, the most it could lose. A window the analyzer raised no alert for is paced by the board the same way.
The band's older signal only breaks ties: recovery speed in slow, the analyzer score in mid and use. A window whose length is neither reported nor named in its label has no refill to price and sits at its band's floor. Plan tier is not detected, so each provider defaults to its lowest tier: set [plans.claude] monthly_price = 200 for Max, or [plans.claude."me@x.com"] monthly_price = 200 for one account (the account value wins). For ordering, a provider with no price is valued at the cheapest configured plan; it still shows no dollar figure.
aiuse suggest, the JSON suggestion and the use: head of aiuse status name the burn the board ranks last — the bottom use row, else the bottom mid row a burn alert backs — not the loudest analyzer score.
Green (use) is capacity to burn now before it resets; red is capacity already lost (empty, including a zero/negative prepaid balance) or a source that failed to fetch (error); everything else is informational (n/a positive prepaid balances that never expire, slow windows you should pace yourself on, mid windows on track — nothing to do).
The POOL column names the billing pool (vendor/allotment) rather than a single client TUI (deepseek, zai, clinepass, opencode-go, opencode-zen, claude-api, openai, openai-api, antigravity), while --json reports each pool's vendor, pool_id, and transports (the client harnesses that can spend it).
Try it in 60 seconds
pipx install aiuse aiuse doctor # see which data-source tools are already on your PATH aiuse # usage table for everything aiuse can see right now No config file is required to start — aiuse doctor tells you exactly which of the optional data-source tools (below) it found, and aiuse works with however many you already have installed. See Install below for Homebrew, git-tip, and editable-dev options.
AI agents: start at AGENTS.md for a map of this repo, active priorities, and contributor guidance.
This project shells out to tools already on your PATH (and optionally hits CodexBar's loopback HTTP server and OpenUsage’s loopback API); it does not scrape billing dashboards itself. For more on collector setup, reliability, and source selection, see the documentation index.
macOS source policy (current)
Use cswap as the Claude source and CodexBar for every other provider. Keep CodexBar's Claude source disabled, even as a fallback. tokscale and paseo are the cross-check sources that stay supported. caut, caam, OpenUsage.ai, and OpenUsage.sh are deprecated because they overlap that set; the code still runs when the tool is installed, and support comes back if someone asks. All collectors are enabled by default, whether installed now or prepared for later; disable any source in config.toml when it is not appropriate for your machine. On macOS, keep CodexBar's Claude integration disabled while its Keychain-prompting bug is open.
pipx install aiuse # or from git tip: # pipx install 'git+https://github.com/djbclark/aiuse.git' aiuse doctor (ai is installed as a stub that runs the same CLI.)
Homebrew (personal tap):
brew tap djbclark/aiuse brew trust djbclark/aiuse brew install aiuse Nix (flake, Linux and macOS):
nix run github:djbclark/aiuse -- --version # try it without installing nix profile install github:djbclark/aiuse # install aiuse and ai nix run github:djbclark/aiuse/v5.4.1 # pin a release tag The flake also exposes packages.
Debian 12+ / Ubuntu 24.04+ (.deb): each GitHub release carries an architecture-independent aiuse_
gh release download --repo djbclark/aiuse --pattern 'aiuse_*_all.deb' sudo apt install ./aiuse_*_all.deb Build one yourself with just deb (packaging/build_deb.py; reproducible for a given wheel and SOURCE_DATE_EPOCH). Other Linux: use pipx install aiuse or uv tool install aiuse.
Developers (editable):
cd /path/to/aiuse python3 -m venv .venv source .venv/bin/activate pip install -e ".[dev]" Optional config (standard location: ~/.config/aiuse/, or $XDG_CONFIG_HOME/aiuse/):
# Create the canonical config.toml (never overwrites) aiuse --generate-config # Or copy the example by hand: mkdir -p "${XDG_CONFIG_HOME:-$HOME/.config}/aiuse" cp config/config.example.toml "${XDG_CONFIG_HOME:-$HOME/.config}/aiuse/config.toml" File Purpose ~/.config/aiuse/config.toml All user settings: collectors, plans, analysis, timeouts, and macOS options aiuse --generate-config creates missing parent directories and writes the TOML starter without overwriting it. Provider credentials stay with cswap, CodexBar, caut, OpenUsage, and tokscale — this file does not hold tokens or emails.
Optional OpenCode Zen balance
OpenCode Zen prepaid balance is a distinct service from OpenCode Go quota. CodexBar can report it, and aiuse can independently cross-check the live OpenCode billing response when a signed-in browser session is available. This is opt-in and normal collection never opens a browser or reads its cookie database.
# One-time optional browser reader for a pipx install. pipx inject aiuse browser-cookie3 # Validate the OpenCode session, then save only the validated cookie through # SecretSpec. The default manifest is ~/.config/aiuse/secretspec.toml. aiuse credential refresh opencode-zen --from chrome --profile Default The command reads only opencode.ai cookies, validates an authenticated workspace and a live Zen balance before saving, and never prints the cookie. Use --dry-run to validate without saving. aiuse credential refresh --help lists its confirmation, profile, timeout, and manifest options. See the OpenCode Zen balance guide for the source model and SecretSpec details.
aiuse normally unifies source-local account names automatically when each identifying source reports exactly one account for a provider. For a genuinely multi-account provider, map a local name explicitly instead of letting aiuse guess:
[account_aliases.codex.openusage_sh] "codex-cli" = "me@example.com" [account_aliases.clinepass.codexbar] "CODEXBAR_CLINEPASS_WORK_API_KEY" = "work" "CODEXBAR_CLINEPASS_PERSONAL_API_KEY" = "personal" aiuse --full prints this exact table when a multi-account source cannot be matched safely. Explicit mappings take precedence over automatic normalization, and the ACCT column caps displayed labels at 9 characters (longer names are truncated with …), so [account_aliases] is also the place to shorten long token-account names.
When one source reports several accounts for a provider (Claude excepted, which cswap owns), aiuse picks the best source per account, so an account only one tool sees still gets its row, and cross-checks pair rows only by matching label. Several ClinePass accounts, for example, need CodexBar's --all-accounts and labelled native keys:
# One row per CodexBar token account. [collectors.codexbar] all_accounts = ["clinepass"] # http_url = "http://127.0.0.1:10546" # http_token = "" # Label = the CodexBar token-account name. Key: env first, then # secretspec, then sudo-secretspec. [[collectors.clinepass.accounts]] label = "work" env = "CLINEPASS_API_KEY_WORK" secret = "CLINE_API_KEY" [[collectors.clinepass.accounts]] label = "personal" secret = "CLINE_API_KEY_PERSONAL" See ClinePass quota.
Some vendors rate-limit quota probes. aiuse reads agy's (Antigravity's) quota at most once every 15 minutes across every aiuse process (CLI, LaunchAgent, watch, serve), reusing the last reading in between. Tune or disable it per provider, in seconds. See Antigravity pools: query rate limit:
# Once: create defaults under ~/.config/aiuse/ (never overwrites) aiuse --generate-config aiuse doctor # PATH tools + config presence + timeouts # Once per machine: install the data-source tools you intend to use # (normally cswap, CodexBar, and tokscale; caut, caam, and both OpenUsage tools are deprecated) ./packaging/install-deps.sh # or: just -f ~/ops/site-djbclark/justfile install-aiuse-deps # macOS: follow the trust guide from the documentation index when needed aiuse trust setup # caut: stable codesign + guide aiuse trust sign-caut # re-run after every cargo install aiuse trust fix-codexbar-cache --dry-run # CodexBar#679: trust CLI on cache items # Optional: refresh the separately reported OpenCode Zen prepaid balance. aiuse credential refresh opencode-zen --from chrome --profile Default # Morning / before a long coding block aiuse # usage table on stdout (use-soon at bottom); meta on stderr aiuse --full # long report: per-provider, tips, History, detailed plan aiuse --brief # same as default (compat alias) aiuse --no-tui # classic plain-text report (also used when piping) aiuse -q # table only (no stderr meta / Collecting…) aiuse suggest # single best burn pool (or “nothing urgent”) aiuse status # one line for shell prompts / status bars aiuse prompt # synonym of status # Shell completion (bash or zsh) eval "$(aiuse --print-completion bash)" # or: source completions/ai.bash # Tighter thresholds for “only what resets soon” aiuse --min-remaining 50 --max-days 7 Usage
# Pretty human-readable report (default) aiuse aiuse --format pretty aiuse --no-color # plain text, no ANSI aiuse -q / --quiet # suppress progress on stderr # or without install: PYTHONPATH=src python -m ai # Machine-readable JSON on stdout (progress on stderr unless -q) aiuse --json aiuse --format json aiuse --json --alerts-only aiuse suggest --json aiuse --save ~/tmp/ai-snapshot.json # also write JSON file # Decision helpers aiuse suggest # single best burn pool aiuse status # one line for prompts / status bars aiuse prompt # synonym of status aiuse serve # loopback HTTP API for agents aiuse watch # full-screen board (q/esc quit · u now · a all; screen-only sweep; default 10m) aiuse watch -i 2m # faster refresh aiuse watch --once # one frame on stdout (scripts / tmux) aiuse watch --all-providers # OPERATOR-ONLY: live board of every provider, screen only (see below) aiuse attribute # what spent the quota: points burned beside tokens per client aiuse attribute --since 7d --provider clinepass --intervals aiuse sample # scheduled entry point: samples faster while quota is moving # Faster / partial aiuse --providers copilot,grok,codex # query these separately aiuse --no-tokscale aiuse --min-remaining 50 --max-days 10 # Subprocess timeout for external tools (default 45s; also in config.toml) aiuse --timeout 45 aiuse -t45 # Environment check (tools on PATH, config files, timeouts) — no usage collection aiuse doctor aiuse --doctor Programmatic use and AI orchestration
aiuse turns the many local authenticated quota sources into one normalized, machine-readable snapshot. An agent can call it once instead of opening billing pages, finding credentials, or independently interpreting each provider’s reset bars — saving tokens and avoiding inconsistent conclusions.
# Full live snapshot, ranked alerts, and the best next action. aiuse -q --json # Only actionable alerts for a short agent/tool call. aiuse -q --json --alerts-only # The single best pool to use next, or null when there is nothing urgent. aiuse suggest --json JSON is written to stdout; -q keeps progress off stderr. Exit 0 means a successful run with no burn/conserve alert, 1 is a hard collection failure, and 2 is a successful run with an actionable alert. The stable fields and exit-code contract are in docs/json-contract.md.
For a long-lived local agent, aiuse serve provides the same decisions through a loopback HTTP API; see the documentation index.
aiuse watch --all-providers (and the watch a key) is operator-only. AI agents and automation must not run it without explicit permission from the human operator. It polls every provider, deliberately overriding [disabled_services], [hidden_pools], analysis.excluded_pools, hidden ceiling/total rows, and collector disable flags — providers are disabled for reasons (vendor rate limits, cost, opt-outs) that this sweep ignores. Its output is display-only: nothing is written to snapshots, the token ledger, or sampler state, though the shared cross-process query throttle still applies so the sweep cannot hammer a vendor.
Projects that want the ranking logic without depending on this CLI can reuse the language-neutral shared quota semantics: JSON Schemas, enums, pace rules, and golden fixtures are designed to be copied or validated from any language. aiuse uses those fixtures itself, but they do not require importing its Python package.
aiuse doctor checks config file presence, config validation (unknown keys, bad timeouts, dead plan aliases), all seven data-source tools on PATH (and OpenUsage.ai loopback HTTP when the CLI is missing), and a light version probe (cswap --version, codexbar -V, caut --version, caam --version, tokscale --version). It does not call usage APIs or verify login sessions.
What “use it or lose it” means
Most subscription coding plans (Claude Pro/Max, ChatGPT Plus/Codex, Cursor, Copilot, SuperGrok, Google AI Pro, …) grant windows of usage (5-hour, weekly, monthly). When the window resets, unused capacity disappears — you still paid for the month.
Pulls remaining % and reset times from cswap (Claude multi-account), CodexBar (broad live quotas), and tokscale (independent measurement; preferred for Copilot). caut, caam, OpenUsage.ai, and OpenUsage.sh still cross-check when installed; support for those four is deprecated because they overlap the sources above (docs/collectors-caut-openusage.md).
Scores windows with pace-based logic (default): compare how far through the cycle you are vs how much you've used, then project waste or early lockout. Within the actionable bands, prioritize projected unused value divided by days until reset, so behind-pace allowances expiring soon rise above similar allowances with more time left. The horizon has a one-day floor; unknown or expired deadlines use 30 days.
Classifies each window as Burn (will leave capacity unused), Conserve (on track to exhaust before reset — slow down), or On pace (no alert).
For shared-allotment providers (Claude, Gemini by default), scores the longest governing window only so a fresh 5-hour bar does not outrank the weekly budget it draws from. Cursor total is the monthly ceiling; auto and 3rd-party are breakdown rows (visible, not headline-scored). On-demand is prepaid dollars after the last column, not a percent row. grok-bot is its own family. Claude Fable is its own scored row (scope fable, weekly cell, Fable-cap pace): on Max and premium seats it can use at most half of the shared weekly pool, and that is not extra quota. The score is Fable's own and is not added into a cross-vendor total. A cap with little left is slow at the bottom of that band; a spent shared window makes the Fable row empty too. Fable at 100% does not exhaust other Claude models. Sonnet and Opus are not separate rows.
Qualifies Conserve alerts with overage awareness: if the account has a real or config-confirmed overage/extra-usage wallet (Claude's usage credits, Cursor's on-demand balance, or a manually confirmed OpenCode Go overage state), the message says so — the real risk there is unplanned $ spend, not lockout, which is a different situation from a genuinely hard ceiling.
Default pretty output is a clock matrix on stdout — one row per account/pool, one column per reset clock (5H/WEEK/MONTH) plus a PACE column for the row's highest pace, each cell displaying used% u / left% l / reset_span pace% (75u/25l/4h -10%, 89u/11l/2d14h +180%; depleted → prepaid n/a → conserve → mid → use-soon at bottom; read bottom→top). A row gated for AI agents shows (AI: Do not use without asking operator) across its empty 5H/WEEK cells; JSON requires_operator_approval / ai_notice (no row is gated since 2026-10-19: omp's grant, the Claude Max plan's monthly API credits, is a normal tier; its JSON carries credits_label: "Claude API credits" and the row keeps the name omp for tools that look it up). Meta goes to stderr. Use aiuse --full for per-provider detail.
On --full, keeps the trailing plan within ~23 lines × console width when possible; if the detailed plan is taller, both detailed and at a glance are printed (glance last). Forecast fragments (~lockout Sat 3:00pm, 3 days before reset, projected waste %) appear on table/status lines when pace can project them; every lockout / run-out forecast also says how far ahead of the window's reset it lands, scaled to hours, days or weeks (JSON: pace.exhaustion_lead_seconds).
Cross-checks all live sources pairwise; Claude multi-account stays canonical in cswap.
Optional surfaces: aiuse suggest (single burn winner), aiuse status / prompt (one-liner), and aiuse serve (loopback ranking API for agents). Snapshot history can blend into pace when enabled.
This command intentionally does not report historical local-token usage or API-equivalent cost estimates (use ccusage-class tools for local burn, not plan %).
OpenAI API credits (openai-api, legacy pi): independent grant accounting
OpenAI API organization spend uses POOL openai-api (SCOPE org-payg), never Codex subscription quota (POOL openai, SCOPE codex). The Codex CLI prepaid credit balance is its own row, POOL openai with SCOPE api-credits. Verified console grants can be recorded with aiuse set-credits openai-api (or pi); an optional organization Admin API cost refresh derives a conservative estimate, not a live cash balance. Missing funding data remains unknown. See Pi OpenAI API credits for prerequisites and limits.
Claude API credits (claude-api, legacy omp): override and expiry nudge
CodexBar reads the Max plan's promotional API credits from claude.ai and can report "100% unused" while the Anthropic console shows the grant half spent. The Anthropic Admin API has no credit-balance endpoint (its GET /v1/organizations/cost_report returns cost-to-date only), so record the console figures yourself:
aiuse set-credits omp --remaining 95.57 --total 200 --expires 2026-11-06 --note "claude.ai billing next credit" The figures go to ~/.cache/aiuse/credit-overrides.json with a timestamp and are applied at read time (--json, --available, serve), so a cached snapshot is corrected too. Which reading wins:
The override wins while it is at least as new as the CodexBar reading.
A newer CodexBar reading that shows more credits than the override is contradicted (a grant never grows), so the override still wins; the replaced reading is kept as superseded_reading.
A newer CodexBar reading that shows the same or less wins (credits were spent since).
A CodexBar reading older than 24 h that no override supersedes is expired: reading_expired: true, balance and percentages dropped, state unknown, and the pool leaves --available.
An override is ignored once its --expires time has passed (a lapsed grant; a date alone means 00:00 UTC) and once it is older than 7 days, so refresh it with aiuse set-credits; rules 2-4 then apply to CodexBar alone. An observed_at in the future is invalid.
A malformed override file (non-finite or non-numeric figures, remaining above total, bad timestamps, a pool other than omp or pi) is ignored with one line on stderr and never stops aiuse --available. set-credits refuses the same input with exit 2.
An override never brings back an omp pool you hid ([hidden_pools]) or disabled ([disabled_services]): the config is checked, so it holds when the cache has no omp row. An operator override only decorates an omp row the collectors produced; it never makes one.
Rule 2 applies only when the override's total equals CodexBar's grant size; otherwise the fresher CodexBar reading wins. Whenever a fresher CodexBar reading wins, the account carries superseded_override ({source, observed_at, remaining_usd}).
Figures must be within 1e9 dollars and the file under 64 KiB; anything else is ignored.
When CodexBar gives no updatedAt, observed_at falls back to the snapshot's collection time. The plain aiuse report does not apply the override; --json, --available and serve do.
source (codexbar or operator-override) and observed_at are in the omp account and pool JSON, and age_seconds/stale derive from observed_at. expires_at is on the account and the pool.
When an expiring grant lapses within 21 days and more than 50% is left (the bar slides down in the last 10 days: 25% at 5 days out, 5% at 1 day), the pool carries burn_before_reset (expires_at, days_left, remaining_percent, remaining_usd, suggestion) and aiuse --available prints burn before reset: ... under its line. remaining_percent still means the share left (used_percent is the share consumed).
Admin API balance (aiuse refresh-credits omp)
The Anthropic Admin API has no balance endpoint, but its cost report (GET https://api.anthropic.com/v1/organizations/cost_report, docs: https://platform.claude.com/docs/en/api/beta/organization/cost_report/retrieve) gives the spend since a date, so the balance is derived: grant total minus spend since the grant date, clamped to 0..total. It is a lower bound on the promo balance: the cost report counts all org spend since granted_at, including spend the grant did not cover (the first real run read $89.56 against the console's $95.57). Give the grant parameters once, on the override:
Hourly refresh with launchd (not loaded for you; refreshes both claude-api and openai-api). The wrapper is copied out of the checkout so a branch switch cannot change what launchd runs:
mkdir -p ~/.local/bin ~/Library/LaunchAgents ~/Library/Logs/aiuse install -m 755 packaging/launchd/aiuse-credits-refresh ~/.local/bin/aiuse-credits-refresh gsed -e "s|@REFRESH_BIN_PATH@|$HOME/.local/bin/aiuse-credits-refresh|" -e "s|@AIUSE_BIN_PATH@|$(command -v aiuse)|" \ -e "s|USER_LOCAL_BIN|$HOME/.local/bin|" -e "s|LOG_DIR|$HOME/Library/Logs/aiuse|" \ packaging/launchd/com.djbclark.aiuse-credits-refresh.plist \ > ~/Library/LaunchAgents/com.djbclark.aiuse-credits-refresh.plist launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.djbclark.aiuse-credits-refresh.plist Unload with launchctl bootout gui/$(id -u)/com.djbclark.aiuse-credits-refresh.
================================================================================ AI USAGE — USE IT OR LOSE IT Collected by aiuse X.Y.Z at … · 3 accounts · 2 alerts ================================================================================ ## Per-provider usage -------------------------------------------------------------------------------- Codex · account=you@example.com · plan=plus · selected live source: CodexBar quota: Codex weekly quota [============] 100% left 0% used resets in 6.4d (Tue Jul 28 9:59pm) flex:▒ semi · pace -100% ## Cross-checks (informational) -------------------------------------------------------------------------------- Tools poll at different times; multi-account Claude is cswap-only. … ## Tips -------------------------------------------------------------------------------- • … ## Action plan — use these before they reset -------------------------------------------------------------------------------- 6 windows with unused capacity across 5 providers. THIS WEEK (start now — capacity will reset or needs lead time) ───────────────────────────────────────────────────────────── . Codex · you@example.com · Codex weekly quota: 88% left · use within 6.4 days · pace -40% — projected 52% unused@reset Semi-throttled — steady usage will exhaust it. . OpenCode Go · default · OpenCode Go weekly quota: 98% left · use within 4.5 days · pace -95% — projected 91% unused@reset Burstable — one heavy session will cover it. Project layout
src/aiuse/ cli.py # entrypoint collectors/ # cswap, codexbar, caut, caam, openusage, tokscale analysis/use_or_lose.py report.py config/config.example.toml tests/ Tests
just test just check # tests plus deterministic lint, type, spelling, and format checks just lint # full check plus Bandit, Semgrep, and Gitleaks just format The quality suite mirrors the applicable tools from stayturgid: pytest, Ruff, mypy, yamllint, markdownlint, Prettier (including TOML support), typos, Bandit, Semgrep, Gitleaks, pre-commit, and just. Ansible, shell, JavaScript/CSS, dotenv, Caddy, and browser-page checks are omitted because this repository contains none of those corresponding inputs.
Pace knobs (in config.toml under [analysis.pace]):
waste_alert_fraction (default 0.30) — project this much unused → Burn
min_elapsed_fraction (default 0.15) — too early in the window → On pace unless history says otherwise
conserve_min_lead_hours (default 4) — exhaust this far before reset → Conserve
Shared allotment: analysis.provider_overrides.
Lapsed subscriptions: analysis.lapsed_accounts maps "provider/account" to a reason (e.g. "claude/me@mit.edu" = "not renewed"). A not-renewed plan keeps serving stale collector cache that looks like usable quota; the entry makes that account show as empty instead of on-pace.
Excluded pools: analysis.excluded_pools maps "provider" or "provider/pool_family" to a reason (e.g. "grok" = "reserved for another agent"). The quota stays in every report, but aiuse --available leaves the pool out of its shortlist and lists it under excluded (JSON) or on stderr (text), so orchestrators never route to it.
Per-run selection: --include LIST and --exclude LIST adjust the provider set for one run without editing config.toml. Each LIST is comma-separated and may repeat; an entry is a provider id, alias or display name (claude, agy, oc-go), or a glob (oc-*, claude*) matched case-insensitively against the canonical id and display name (never aliases, so open* does not catch codex through its openai alias). --include adds: a match that [disabled_services] disables is re-enabled for this run, and every other provider stays as the config has it. --exclude removes providers that would otherwise be collected, on top of the config's disables; a provider matching both flags is excluded. Collectors of an excluded provider do not run, and --available re-collects when --include brings back a config-disabled provider, because the cache never held it. A run adjusted this way is filed as a partial sample and never becomes latest.json; watch shows it screen-only, and its a sweep ignores the flags. serve and sample reject them. A pattern that matches no known provider prints a warning. --show-included [LIST] and --show-excluded print the resulting sets as comma-separated canonical ids and exit without collecting (both together are labelled included: / excluded:); a LIST on --show-included previews it as the --include (replacing any given), still honouring --exclude and the config. Overriding [disabled_services] with --include is operator-only for AI agents, like watch --all-providers.
Disabled services: top-level [disabled_services] maps "provider" to a reason (e.g. "grok" = "vendor shelved until its reset"). Stronger than an exclusion — for TUIs that must temporarily not be used even though they have headroom: provider-only collectors skip the service entirely (no subprocess/authenticated fetch), its rows are dropped from every report, snapshot and history entry, --available never lists it (even from a cache written before the entry), and the reason travels on the snapshot as disabled_services so readers know why the provider is absent. aiuse doctor warns when a provider-only collector override for a disabled provider silently has no effect.
Hidden pools: top-level [hidden_pools] maps "provider" or "provider/pool_family" to a reason (e.g. "cursor/auto" = "not routing Auto this week"). Display-only: matching windows are dropped at collection and omitted from human outputs and --available. Weaker than [disabled_services]; stronger than analysis.excluded_pools (routing-only).
Headroom floors (schema 1.8, advisory): top-level [floors] sets how much headroom a consumer should leave unspent per pool, and aiuse --available --json reports it on every available[] and unavailable[] entry as floor_percent, floor_basis and headroom_above_floor_percent (headroom_percent - floor_percent, negative below the floor, null when headroom is unknown). The floor scales with what the plan costs: floor_percent = clamp(reserve_usd / plan_monthly_price * 100, min_percent, max_percent), rounded to one decimal, where plan_monthly_price is the account's [plans.
Ceiling rows: analysis.show_total_rows (default false) hides total/ceiling rows in the board, --full, --for-chat, and --available when breakdown sub-rows exist. JSON always includes them with role: "ceiling"; sub-rows carry effective_left_percent when the ceiling binds.
Live quota accuracy depends on each tool's auth (browser cookies, OAuth, keychain). Errors are reported per account rather than aborting the whole run.
All enabled collectors (cswap, CodexBar, caut, caam, OpenUsage.ai, OpenUsage.sh, tokscale, qwencloud, bailian, sipb) run concurrently; each CodexBar provider is its own subprocess. Default tool timeout is 45s; CodexBar OpenCode Go is 60s ([collectors.codexbar] provider_timeouts); cswap, caam, and openusage_sh are 90s; the opt-in sipb probe defaults to 120s (the MIT server is slow) (-t / config.toml [timeouts]).
Per-window detail still shows $ value, flexibility class, and a pace ratio when computable.
Duplicate live measurements are retained for cross-checking but only one copy drives recommendations.
Dollar values use plan monthly_price (a per-account [plans.
Further documentation
docs/attribution.md — what spent the quota: token ledgers, adaptive sampling (aiuse sample), aiuse attribute.
packaging/install-deps.sh — install the optional data-source tools.
docs/json-contract.md — stable JSON fields and exit codes.
docs/provider-identity.md — canonical provider id vs config key, and window identity across collectors.
docs/shared-quota-semantics/ — reusable language-neutral schemas, rules, and fixtures.
CHANGELOG.md — what changed in each release.
Documentation index — categorized guides, collector notes, automation, and maintainer material.
Released: Nov 30, 2026
Both files in this release have provenance metadata.
View provenance details
MIT View SPDX License List
ai quota claude codex copilot cli
Development Status 5 - Production/Stable
Intended Audience Developers
Operating System MacOS
Programming Language Python :: 3
Release files for aiuse 5.6.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
Built distribution (wheel)
Total release size: 1.3 MB
Release files / aiuse-5.6.2.tar.gz
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.
Release files / aiuse-5.6.2-py3-none-any.whl
Security for aiuse 5.6.2
Both files in this release have been uploaded with provenance metadata.
With provenance aiuse-5.6.2.tar.gz Nov 30, 2026
With provenance aiuse-5.6.2-py3-none-any.whl Nov 30, 2026
Attestation for aiuse-5.6.2.tar.gz
Attestation for aiuse-5.6.2-py3-none-any.whl
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
Nov 30, 2026 2 release files Full provenance
Nov 28, 2026 2 release files Full provenance
Nov 25, 2026 2 release files Full provenance
Nov 22, 2026 2 release files Full provenance
Nov 21, 2026 2 release files Full provenance
Nov 16, 2026 2 release files Full provenance
Nov 15, 2026 2 release files Full provenance
Nov 13, 2026 2 release files Full provenance
Nov 12, 2026 2 release files Full provenance
Nov 10, 2026 2 release files Full provenance
Nov 7, 2026 2 release files Full provenance
Nov 6, 2026 2 release files Full provenance
Nov 4, 2026 2 release files Full provenance
Nov 3, 2026 2 release files Full provenance
Nov 1, 2026 2 release files Full provenance
Oct 29, 2026 2 release files Full provenance
Oct 23, 2026 2 release files Full provenance
Oct 22, 2026 2 release files Full provenance
Oct 21, 2026 2 release files Full provenance
Oct 20, 2026 2 release files Full provenance
Oct 18, 2026 2 release files Full provenance
Oct 15, 2026 2 release files Full provenance
Oct 14, 2026 2 release files Full provenance
Oct 13, 2026 2 release files Full provenance
Oct 12, 2026 2 release files Full provenance
Oct 11, 2026 2 release files Full provenance
Oct 10, 2026 2 release files Full provenance
Oct 9, 2026 2 release files Full provenance
Oct 5, 2026 2 release files Full provenance
Oct 4, 2026 2 release files Full provenance
Oct 3, 2026 2 release files Full provenance
Oct 1, 2026 2 release files Full provenance
Sep 27, 2026 2 release files Full provenance
Sep 26, 2026 2 release files Full provenance
Sep 21, 2026 2 release files Full provenance
Aug 24, 2026 2 release files Full provenance
Aug 22, 2026 2 release files Full provenance
Aug 21, 2026 2 release files Full provenance
Aug 19, 2026 2 release files Full provenance
Aug 17, 2026 2 release files Full provenance
Aug 15, 2026 2 release files Full provenance
Aug 14, 2026 2 release files Full provenance
Aug 12, 2026 2 release files Full provenance
Aug 11, 2026 2 release files Full provenance
Aug 4, 2026 2 release files Full provenance
Aug 3, 2026 2 release files Full provenance
Aug 2, 2026 2 release files Full provenance
Jul 31, 2026 2 release files Full provenance
Jul 30, 2026 2 release files Full provenance
Jul 28, 2026 2 release files Full provenance
Jul 27, 2026 2 release files Full provenance
Jul 26, 2026 2 release files Full provenance
Jul 25, 2026 2 release files Full provenance
Jul 25, 2026 2 release files Loss of provenance
Jul 24, 2026 2 release files Full provenance
Jul 24, 2026 2 release files No provenance
"PyPI", "Python Package Index", and the blocks logos are registered trademarks of the Python Software Foundation.
© 2026 Python Software Foundation
Deployed from fc0d8e6











