Commands
Every tokenmaxxing command and what it does
| Command | What it does |
|---|---|
tokenmaxxing init | Verify and pin the real claude binary, log the first account in through an isolated claude session (run /login there; the login you already have stays for sessions started outside the supervisor), then install the supervisor shim, the settings entries, the shell rc PATH line, the check timer, and the usage hub service. On a pool that already has accounts it re-installs and skips the login |
tokenmaxxing init --codex | Same for Codex: log in the first account, isolated, install the codex supervisor and Stop hook |
tokenmaxxing init --pi | Verify and pin the real pi binary and install the pi supervisor shim, which runs pi sessions on pooled Claude and ChatGPT accounts that have a pi login. It logs no account in; it prints how many accounts of each pool have a pi login. See pi support |
tokenmaxxing init --grok | Pool the first grok login, status-only: no supervisor, no hooks, no switching. See Status-only pools |
tokenmaxxing add [--codex | --grok] | Register an additional account in that pool (isolated login, harvested once into its own store) |
tokenmaxxing auth [--codex | --grok] [sel | --all] | Reauthenticate a pooled account in place. Bare lists the pool and asks which; a selector targets one account and tells you which email to sign in with; --all walks every account that is flagged or has no usable credential in its store (missing, unreadable, or dead), one by one |
tokenmaxxing auth --pi [--codex] [sel | --all] | Log a pooled Claude account (or a Codex account with --codex) into pi through an isolated pi, and store that login as the account's pi credential after checking that it belongs to the account. Bare lists the pool and asks which; --all walks every account without a pi login |
tokenmaxxing status [--cached] | Every pool: accounts with 5h / weekly / per-model usage bars, live session counts, exhausted-until-reset, and a note when every gated per-model cap is at the weekly bar; the claude header prints the configured thresholds and the effective bars beside them, and an account with a thresholds.accounts entry shows its own pair in its card, so the exhausted badge is explicable, and a note when the entry marks it as usable past them on credits; a bar's percent label shows usage past 100 as it is; --cached renders the stored figures without sampling |
tokenmaxxing config | The config path and the effective values; edit the file in an editor |
tokenmaxxing check | Fold fresh statusline tees into the index, run the Claude decision with no seat (so nothing moves), sample up to three accounts whose last sample attempt is oldest, delete leftover atomic-write temp files, and, on a Bun global install, self-update from npm at most once a day; the periodic timer runs this every tick |
tokenmaxxing doctor | Verify the install: the bin directory ahead of the real claude on PATH, claudeBin launching the real binary, the five settings entries, the check timer, the usage hub service, every Codex store and every Claude store whose access token is still fresh holding a credential that belongs to its account (a Claude store with an expiring token is reported as unverifiable, not as a failure, because tokenmaxxing holds no refresh grant), every Codex seat's hook trust, and shell aliases or functions that shadow claude; with the pi shim installed, also piBin, the bin directory ahead of the real pi, the accounts without a pi login, and the identity of every pi login (a Claude pi login only while its access token is fresh) |
tokenmaxxing rename [--codex | --grok] <sel> <label> | Relabel a pooled account |
tokenmaxxing rm [--codex | --grok] <sel> | Remove an account and its credential store (and its pi store) from a pool; refused for the account the command itself runs under and for an account with a running supervised session or a living seat borrower |
tokenmaxxing key add <label> [credit-usd] [workspace-id] | Store an Anthropic API key, read from stdin, as a fallback for the Claude pool. Claude sessions run on a key only while every pooled Claude account is at its limit. credit-usd is the key's balance as the Console shows it; a key without one ranks after every key with one. workspace-id is for an account-level key that spans several workspaces: every request then carries anthropic-workspace-id. A workspace-scoped key needs none. An Admin API key (sk-ant-admin...) is refused, because it cannot run inference. The command refuses a terminal on stdin, which would echo the key; pipe it in without echo or shell history: read -rs KEY && printf '%s' "$KEY" | tokenmaxxing key add <label> <credit-usd>; unset KEY. See How switching decides |
tokenmaxxing key credit <label> <usd> | Set the key's balance, restart its spend count at 0, count the cost already reported by its live sessions as part of that balance, and clear a refusal |
tokenmaxxing key rm <label> | Delete the key and its stored secret; refused while a supervised session runs on it |
tokenmaxxing seat <pid> | Lend one pooled Claude account to an unattended consumer, such as a test runner that starts its own Claude Code: prints the account's store directory, to set as CLAUDE_SECURESTORAGE_CONFIG_DIR, and lends the account to <pid> until it exits. Host sessions and other seat borrowers keep using the account. The same pid gets the same account back. The consumer uses the printed directory itself as the user that owns it on the host (a read-write directory bind mount into a container that maps to that user works), never a copy of its credential file. Exit 1 means no usable account. See Credential storage |
tokenmaxxing seat <pid> --store <id> | Lend the Claude store whose 8-character id is <id> (the store directory's name) instead of the ranked pick, for a consumer that applies its own rules. It checks only that the store is in the pool, holds a usable credential, and is not flagged for reauthentication; bars, the credits flag, and which stores to avoid are the caller's job. It writes the same record and prints the store directory as seat <pid> does. Exit 0 means granted, exit 1 means the store is unusable, and exit 2 means an unknown store, a <pid> that already holds another store, or bad usage. See Naming a store |
tokenmaxxing seat --codex <pid> | Borrow one pooled Codex account for an unattended consumer that spawns its own codex binary, such as the Codex SDK (codex exec, codex review, and codex app-server through the shim borrow on their own): prints the store path to pass as CODEX_HOME and lends the account to <pid> until it exits. Codex sessions and other borrowers share the account, and a refresh race between them can sign it out until auth --codex runs again. Exit 1 means no usable account; fall back to the ambient login. See Codex |
tokenmaxxing serve | Serve the CLIProxyAPI-compatible usage API on http://localhost:<hub.port> (default 8317) so a dashboard such as T3 Code's Add a CLIProxyAPI hub shows the quota of every pooled Claude and Codex account. The management key is the contents of hub-key in the state directory, minted on the first run. The Claude init installs it as a background service beside the check timer; tokenmaxxing serve runs it in the foreground, and SIGINT or SIGTERM stops it. See Usage hub |
tokenmaxxing uninstall [--yes] | Print every target, then remove the claude, codex, and pi shims, the tokenmaxxing and xx entry points, the settings entries, the Codex Stop hook, the check timer, the usage hub service, and the shell rc PATH line (accounts and stores are kept). When HOME is the login home (the passwd entry of the current user), the command prints the targets and exits 2 unless --yes is passed. Under an isolated HOME it proceeds without the flag and removes only the unit files under that HOME; the login user's systemctl --user or launchctl instance is addressed only when HOME is the login home. A user with no passwd entry gets exit 1 |
tokenmaxxing help | Print the command summary |
tokenmaxxing --version (-v) | Print the version of the running package and exit 0, with no state read and no network |
--json | Print one JSON document on stdout instead of text. Works with status, config, and check; position-independent (xx --json, xx status --json). See JSON output |
Every command works inside a supervised session too: a CLAUDE_SECURESTORAGE_CONFIG_DIR inherited from the session is how the hooks know their seat, and the CLI accepts it.
JSON output
Add --json to status, config, or check and it prints one JSON document on stdout instead of text. The progress notice sampling claude usage... goes to stderr, so xx status --json | jq stays clean. status writes it only when stderr is a terminal, shows it while the sample runs, and erases it when the sample returns; a redirected stderr gets nothing. Every document carries ok, which is true exactly when the exit code is 0; a failure keeps its non-zero exit code and adds error with the same message the text form prints.
xx status --json | jq '.claude.accounts[] | {label, sessions, exhausted, fiveHour: .usage.fiveHour.usedPercentage}'
xx check --json | jq '{swapped, account, reason}'What each command reports:
status/ barexx:now(the reference time in epoch ms), thenclaude,codex, andgrok, one object per pool with the same shape:thresholds, the effectivebarsandprojectionMargin,gatedNote(a string when every account's gated per-model cap is at the weekly bar but at least one account still has weekly aggregate headroom for other models, elsenull), and one entry per account withid,label,email,tier,active,sessions,needsReauth,exhausted,thresholds(the account'sthresholds.accountsentry, ornull),usage,usageAt,limitsAt, andsample({ok, source}for a fresh read from the statusline tee or a probe,{ok: true, source: "cached"}for a Claude account whose last sample attempt is inside its sample interval,{ok: false, reason}when the live sample failed andusageis the cached value fromusageAt).sessionscounts the supervised sessions and theseatborrowers on the account (on a Claude account, including a session that is moving to it or waiting for its reset), andactiveistruewhen that count is positive.usageis{fiveHour, week, limits}: the session window and the weekly window, classified by duration and eachnullwhen the plan has none, pluslimits, one entry per named window (a Claude per-model cap or a Codex additional limit) with itsname. Every window carriesusedPercentage,bufferedPercentage,resetsAt, andwindowSeconds, normalized the way the bars are drawn: a passed reset reads as 0 with the weekly reset rolled forward.usedPercentageis the provider's figure;bufferedPercentageis the buffered usage quota described below, and it is the figure the text form draws. The status-only grok pool is always present, with an emptyaccountsarray when nothing is pooled. grok accounts carry the weekly credit window when a sample has landed (sessionsis 0), and groksamplereports the credits billing read.status --cached(alsoxx --cached) reads only the state files: everysampleis{ok: true, source: "cached"},usageis the stored value as ofusageAt(null when the account was never sampled), andlimitsAtdates the named windows separately. When at least one API key is stored, the document also carriesapiKeys, one entry per key withlabel,id,workspaceId(ornull),creditUsd(the entered balance, ornull),spentUsd,creditLeftUsd(creditUsdminusspentUsd, ornullwhen no balance was entered),refused,refusedAt(epoch ms, ornull), andsessions(the supervised sessions running on the key). With no key stored, the key is absent. The text form lists the keys after the Claude pool.config:pathandeffective(the config as loaded: file values over defaults, withTOKENMAXXING_CLAUDE_BIN,TOKENMAXXING_CODEX_BIN,TOKENMAXXING_GROK_BIN, andTOKENMAXXING_PI_BINapplied on top). A file that fails to load exits 1 with the zod message naming the field.check:swapped,account,reason, andwaitUntil. A tick runs from no session, soswappedisfalseandreasonisunder-threshold-or-stale; the sampling it does is reported in the log.
Buffered usage quota: the usage bars of status, its bufferedPercentage fields, and the usage note add and auth print are measured against each account's switch threshold, not against the provider's full limit. The threshold is the account's own entry in thresholds.accounts, else the global threshold, minus policy.projectionMargin for the session window, and it is lifted near a reset the way switching lifts it (policy.accountReleaseMs). 100 means the account reached its switch threshold, where tokenmaxxing stops placing sessions on it unless its thresholds.accounts entry sets credits, and usage past that point stays at 100. The figure therefore reads higher than the usage Claude Code or Codex reports: an account with a threshold of 75 at 75 percent provider usage reads 100. The text form of status states this under the Claude and Codex pool headers. usedPercentage keeps the provider's figure. The status-only grok pool has no switch threshold, so its bufferedPercentage equals its usedPercentage.
Every other command refuses --json with exit code 2. Account identifiers (labels, emails, ids) appear in the documents; credential material never does.
--codex selects the Codex pool for init, add, auth, rm, rename, and seat; --grok selects the status-only grok pool for the same first five commands. The flags are mutually exclusive, and every other command refuses them with exit code 2 (status always renders every pool). --pi applies to init (with no pool flag) and to auth (alone for the Claude pool, with --codex for the Codex pool); every other command refuses it with exit code 2. Messages name accounts by label, which defaults to the sign-in email.