A CLI for managing multiple Claude Code accounts with OAuth authentication and usage tracking.
- Add accounts via OAuth (automatic browser or manual code entry)
- View rate-limit utilization per account (5h / 7d / Opus / Sonnet windows) with reset times
- Automatic OAuth token refresh — tokens are refreshed transparently before they expire
- Switch, rename, and remove accounts
- Export environment variables for the active account
- Secure encrypted storage of OAuth tokens (AES-256-GCM, key in the OS keychain)
npm install -g .claude list- list configured accounts with utilization and token statusclaude status- detailed per-account view (expiry, last usage snapshot)claude import- import the account you're already logged into in Claude Codeclaude add- add a new account via OAuthclaude switch- switch the active accountclaude rename- rename an accountclaude refresh [--all]- manually refresh OAuth tokensclaude remove- remove an account (asks for confirmation)claude export-env- print shell export snippet for the active accountclaude usage- refresh utilization data for all accountsclaude --help- show help
claude addYou'll be prompted for:
- Account label (e.g., "Work Account", "Personal")
- Account type (Pro, Max 5x, Max 20x, Other)
- OAuth flow (automatic browser or manual code)
Automatic flow opens your browser and handles the callback automatically. Manual flow shows a URL to open and prompts for the authorization code.
Usage stats need a full-scope token. A directly-pasted
CLAUDE_CODE_OAUTH_TOKENis inference-only (it lacks theuser:profilescope), soclaude usagereturns a 403 for it. Use OAuth login orclaude importto get a token that can read usage.
If you're already logged into Claude Code on this machine:
claude importThis reads Claude Code's own login credentials locally (a JSON file on Linux/WSL, or the macOS Keychain — which prompts you to allow access) and adds them as a managed account. That token is full-scope, so usage stats work and it auto-refreshes. Nothing is sent anywhere; the read happens on your machine.
claude switchSelect which account should be active. The active account's token will be exported via claude export-env.
claude export-env
export CLAUDE_CODE_OAUTH_TOKEN="your_token_here..."Use with eval to set in your shell:
eval $(claude export-env)claude usage # fetch the latest utilization for all accounts
claude list # show all accounts with utilization + token status
claude status # detailed per-account viewThe usage view reflects the Claude OAuth usage API, which reports rate-limit utilization (a percentage per window) and reset times — not token counts. Columns are color-coded: green < 50%, yellow < 80%, red ≥ 80%.
- Config is written atomically (temp file + rename) to avoid corruption, and is
stored with
0600permissions. Running multipleclaudecommands at the exact same time can still cause one to overwrite the other's change (last write wins) — atomic writes prevent corruption, not logical races. - Directly-pasted tokens have no refresh token and cannot be auto-refreshed; they stop working when they expire and the account must be re-added.
npm install
npm run build # Build TypeScript
npm run start # Run from dist/
npm run dev # Run with ts-node
npm test # Run tests
npm run lint # Lint code
npm run format # Format code