Seamlessly rotate between multiple Claude accounts to bypass rate limits
A powerful CLI tool designed for claude-code users who need to manage multiple Claude accounts efficiently. Say goodbye to rate limit frustrations! π
- π Smart Account Rotation - Switch between accounts with a single command
- πΈ Snapshot Management - Save your current Claude session instantly
- π― Intelligent Switching - Automatic next-account detection with fallback
- πΎ Safe Storage - Atomic file operations prevent data corruption
- π¦ Backup & Restore - Export/import profiles with compression and integrity checking
- π Account Testing - Verify and refresh tokens automatically
- π¨ Beautiful CLI - Colorful, intuitive interface with clear feedback
- β‘ Lightning Fast - Quick account switches without losing context
- π¦ Optimized Distribution - Single executable with minimal runtime dependencies
npm install -g ccrotate- Login to your first Claude account using
claude-code - Save your account:
ccrotate snap - Login to another account and repeat step 2
- Start rotating:
ccrotate nextorccrotate switch user@example.com
Save your currently active Claude account credentials.
ccrotate snap # Save with confirmation prompt
ccrotate snap --force # Force save without confirmationDisplay all saved accounts with status indicators.
ccrotate list
# Output:
# Saved Accounts:
# β
1. user1@example.com (last used: 1/15/2024)
# 2. user2@example.com (last used: 1/14/2024)Switch to a specific account by email address.
ccrotate switch user2@example.com
# β Switched to account: user2@example.comRotate to the next account in your saved list.
ccrotate next
# Switching: user1@example.com -> user2@example.com
# β Switched to account: user2@example.comRemove a saved account from your rotation.
ccrotate remove user@example.com
# ? Are you sure you want to remove account user@example.com? No / YesExport all saved profiles as a compressed, shell-safe string with CRC verification.
ccrotate export
# β Profiles exported (Shell-Safe compression + CRC verification):
# 3 accounts: 2146 β 1209 chars (-44%)
# CRC32: f7dd8ae3 (data integrity guaranteed)
#
# "mp-gz-b64:f7dd8ae3:H4sIAAAAAAAAA5XRT..."Import profiles from a compressed string with automatic CRC verification.
ccrotate import "mp-gz-b64:f7dd8ae3:H4sIAAAAAAAAA5XRT..."
# β CRC verification passed: f7dd8ae3
# Found 3 accounts to import:
# user1@example.com, user2@example.com, user3@example.com
# ? Do you want to proceed with the import? Yes
# β Successfully imported 3 accounts.Test all saved accounts and refresh expired tokens automatically.
ccrotate refresh
# π Testing accounts and refreshing tokens...
# 1 user1@example.com β
Active Hi there! How can I assist you today?
# 2 user2@example.com β Failed Invalid or expired token
# 3 user3@example.com β
Active π Hi! I'm Claude, an AI assistant...ccrotate manages your Claude accounts by:
- Reading current credentials from
~/.claude/.credentials.jsonand~/.claude.json - Storing account profiles in
~/.ccrotate/profiles.json - Switching accounts using atomic file operations for safety
- Identifying accounts by email from
oauthAccount.emailAddress - Compressing data using MessagePack + Gzip + Base64 for efficient backup/restore
{
"user1@example.com": {
"credentials": { /* Full credentials.json content */ },
"userId": "user-id-here",
"oauthAccount": {
"emailAddress": "user1@example.com",
/* Other OAuth info */
},
"lastUsed": "2024-01-15T10:30:00.000Z"
}
}- Node.js 18.0.0 or higher
- claude-code CLI tool installed and configured
- Cross-platform support (Windows, Linux, macOS)
- Account Safety: This tool works with session-based tokens. Please be mindful of Claude's terms of service.
- Data Security: Credentials are stored in plain text, consistent with
claude-code's approach. - Backup Recommended: Consider backing up your
~/.ccrotate/directory.
# Clone and install
git clone https://github.com/somersby10ml/ccrotate.git
cd ccrotate
pnpm install
# Development build with sourcemap
pnpm run build:dev
# Production build (minified)
pnpm run build
# Test locally with source
node bin/ccrotate.js --help
# Test built CLI
./dist/cli.js --help
# Package testing (dry-run)
pnpm run publish:dist:dry
# Publish to npm
pnpm run publish:distccrotate uses esbuild for optimized distribution:
- Source:
bin/ccrotate.js+lib/directory - Output: Single
dist/cli.jsexecutable with external runtime dependencies - Optimized dependencies: Only core libraries (React Ink, Commander, Chalk) are installed
- Package size: ~15KB unpacked, ~5KB compressed (excluding dependencies)
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the MIT License - see the LICENSE file for details.
If ccrotate helps you manage your Claude accounts better, consider:
- β Starring this repository
- π Reporting issues on GitHub
- π‘ Suggesting new features