Multi-account switcher for Claude Code. Easily switch between multiple Claude accounts without logging out. Works with both the Claude Code CLI and the VS Code extension.
uv tool install claude-swappipx install claude-swapgit clone https://github.com/realiti4/claude-swap.git
cd claude-swap
uv sync
uv run cswap --helpLog into Claude Code with your first account, then:
cswap --add-accountLog in with another account, then:
cswap --add-accountRotate to the next account:
cswap --switchOr switch to a specific account:
cswap --switch-to 2
cswap --switch-to user@example.comNote: Restart Claude Code (or close and reopen the VS Code extension tab) after switching for the new account to take effect.
Move account data between machines or back it up:
cswap --export backup.cswap # All accounts to a file
cswap --export backup.cswap --account 2 # One account
cswap --export - # To stdout (pipeable)
cswap --import backup.cswap # Skips accounts that already exist
cswap --import backup.cswap --force # Overwrite existingThe export file is plaintext JSON. If you need encryption, pipe through your tool of choice (e.g. cswap --export - | gpg -c > backup.gpg).
If an account's token expires, log back into Claude Code with that account and re-run:
cswap --add-accountThis will update the stored credentials without creating a duplicate.
cswap --list # Show all accounts with 5h/7d usage and reset times
cswap --status # Show current account
cswap --add-account --slot 3 # Add account to a specific slot (prompts before overwrite)
cswap --remove-account 2 # Remove an account
cswap --purge # Remove all claude-swap data- Continuing sessions after switching: You can resume the same Claude Code session after switching accounts. Close Claude Code or the VS Code extension tab, run
cswap --switchin any terminal, then reopen and select your previous session. Note that the first message on the new account may use extra usage as the conversation cache rebuilds for that account.
- Backs up OAuth tokens and config when you add an account
- Swaps credentials when you switch accounts
- Account credentials stored securely using platform-appropriate methods
| Platform | Credentials | Config backups |
|---|---|---|
| Windows | Windows Credential Manager | ~/.claude-swap-backup/ |
| macOS | macOS Keychain | ~/.claude-swap-backup/ |
| Linux | File-based (~/.claude-swap-backup/credentials/) |
~/.claude-swap-backup/ |
Remove all data:
cswap --purgeThen uninstall the tool:
uv tool uninstall claude-swap
# or
pipx uninstall claude-swap- Python 3.12+
- Claude Code installed and logged in
MIT