Multi-account rotation wrapper for Claude CLI with automatic rate-limit fallback and concurrent session support.
- 4-Account Rotation - Automatically rotates between up to 4 Claude.ai OAuth accounts
- Rate-Limit Fallback - Detects rate limits and switches to next available account
- Concurrent Sessions - Run multiple Claude sessions simultaneously with different accounts
- Status Tracking - JSON state file tracks account usage and rotation
- Desktop Notifications - Optional libnotify integration for rate-limit alerts
- Profile Management - Easy setup and rotation of OAuth tokens
Claude CLI is amazing but has rate limits. If you have multiple Claude.ai accounts (personal, work, etc.), this wrapper lets you:
- Seamlessly rotate between accounts when you hit rate limits
- Run multiple concurrent Claude sessions without conflicts
- Never interrupt your flow when rate-limited
# Install
git clone https://github.com/Kblack0610/claude-wrapper.git
cd claude-wrapper
./install.sh
# Set up your accounts (interactive)
claude-rotate-setup
# Use claude normally - rotation happens automatically!
claude "what is the meaning of life?"
# Check account status
claude --statusgit clone https://github.com/Kblack0610/claude-wrapper.git
cd claude-wrapper
./install.shThis will:
- Symlink
bin/claude-wrapperto~/.local/bin/claude - Back up your existing
claudebinary toclaude-real - Make the wrapper scripts executable
# Move your existing claude binary
mv ~/.local/bin/claude ~/.local/bin/claude-real
# Symlink the wrapper
ln -s /path/to/claude-wrapper/bin/claude-wrapper ~/.local/bin/claude
ln -s /path/to/claude-wrapper/bin/claude-notify ~/.local/bin/claude-notify
ln -s /path/to/claude-wrapper/bin/claude-rotate-setup ~/.local/bin/claude-rotate-setupFor each Claude account:
- Log into https://claude.ai in your browser
- Open DevTools (F12) → Application → Local Storage
- Find
sessionKeyvalue - Copy the OAuth token (starts with
sk-ant-...)
Run the interactive setup:
claude-rotate-setupOr manually create profile files:
mkdir -p ~/.claude/profiles
echo "YOUR_TOKEN_HERE" > ~/.claude/profiles/1.token
echo "YOUR_TOKEN_HERE" > ~/.claude/profiles/2.token
# ... up to 4.tokenThe wrapper will auto-create ~/.claude/rotation/state.json on first run.
Just use claude as you normally would:
claude "help me debug this code"
claude --profile sonnet "write a story"The wrapper:
- Automatically picks the best available account
- Rotates on rate limits
- Logs all operations
claude -p 1 "use account 1"
claude -p 2 "use account 2"
# ... up to -p 4claude --statusShows:
- Active account
- Last used timestamps
- Rate limit status
- Available accounts
Each terminal/session gets its own account automatically via CLAUDE_CODE_OAUTH_TOKEN environment variable injection.
~/.claude/
├── profiles/
│ ├── 1.token # Account 1 OAuth token
│ ├── 2.token # Account 2 OAuth token
│ ├── 3.token # Account 3 OAuth token
│ └── 4.token # Account 4 OAuth token
├── rotation/
│ ├── state.json # Current rotation state
│ └── log.jsonl # Rotation event log
└── mcp.json # MCP server config (optional)
-
Account Selection
- Wrapper checks
state.jsonfor last used account - Rotates to next account in sequence
- Updates state file with timestamp
- Wrapper checks
-
Rate Limit Detection
- Monitors Claude CLI output for rate-limit errors
- Auto-switches to next account on detection
- Sends desktop notification (if
notify-sendavailable)
-
Token Injection
- Sets
CLAUDE_CODE_OAUTH_TOKENenvironment variable - Passes through to
claude-realbinary - Each session gets isolated token
- Sets
Desktop notification helper for rate-limit alerts.
claude-notify "Rate limit hit! Switching to account 2"Interactive setup wizard for configuring accounts.
claude-rotate-setup [--force]The wrapper looks for the actual Claude binary at ~/.local/bin/claude-real. If you haven't backed it up:
# Download Claude CLI fresh
curl -fsSL https://claude.ai/install.sh | sh
# Move it to claude-real
mv ~/.local/bin/claude ~/.local/bin/claude-realClaude OAuth tokens expire periodically. Re-run claude-rotate-setup to update them.
Delete and reinitialize:
rm ~/.claude/rotation/state.json
claude --status # Will recreateThe wrapper uses these environment variables (optional):
CLAUDE_WRAPPER_MAX_ACCOUNTS- Max accounts (default: 4)CLAUDE_WRAPPER_NOTIFY- Enable notifications (default: auto-detect)CLAUDE_CODE_OAUTH_TOKEN- Direct token override
All rotation events are logged to ~/.claude/rotation/log.jsonl:
{"timestamp":"2026-01-30T01:00:00Z","event":"rotate","from":1,"to":2,"reason":"rate_limit"}
{"timestamp":"2026-01-30T01:05:00Z","event":"rotate","from":2,"to":3,"reason":"scheduled"}# Restore original claude binary
mv ~/.local/bin/claude-real ~/.local/bin/claude
# Remove wrapper symlinks
rm ~/.local/bin/claude-notify
rm ~/.local/bin/claude-rotate-setup
# Optionally remove state
rm -rf ~/.claude/rotationFound a bug? Want a feature? Open an issue or PR!
MIT - Use freely, modify as needed.
Built for power users who love Claude CLI and hate rate limits.