by realiti4
Switch between multiple Claude Code accounts
# Add to your Claude Code skills
git clone https://github.com/realiti4/claude-swapLast scanned: 5/23/2026
{
"issues": [],
"status": "PASSED",
"scannedAt": "2026-05-23T06:34:22.330Z",
"semgrepRan": false,
"npmAuditRan": true,
"pipAuditRan": true
}No comments yet. Be the first to share your thoughts!
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-swap
pipx install claude-swap
git clone https://github.com/realiti4/claude-swap.git
cd claude-swap
uv sync
uv run cswap --help
uv tool upgrade claude-swap
# or
pipx upgrade claude-swap
Log into Claude Code with your first account, then:
cswap --add-account
Log in with another account, then:
cswap --add-account
Rotate to the next account:
cswap --switch
Or switch to a specific account:
cswap --switch-to 2
cswap --switch-to user@example.com
Note: Restart Claude Code (or close and reopen the VS Code extension tab) after switching for the new account to take effect.
If an account's token expires, log back into Claude Code with that account and re-run:
cswap --add-account
This 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 --tui # Launch the interactive arrow-key menu
cswap --purge # Remove all claude-swap data
cswap --switch in 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.| Platform | Credentials | Config backups |
|----------|-------------|----------------|
| Windows | Windows Credential Manager | ~/.claude-swap-backup/ |
| macOS | macOS Keychain | ~/.claude-swap-backup/ |
| Linux / WSL | File-based (inside the backup directory, under credentials/) | ${XDG_DATA_HOME:-~/.local/share}/claude-swap/ |
On Linux/WSL, set XDG_DATA_HOME to override the default location. Data from older installs under ~/.claude-swap-backup/ is migrated automatically on first run.
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 backup.cswap --full # Include full local ~/.claude.json (same-PC backup)
cswap --import backup.cswap # Skips accounts that already exist
cswap --import backup.cswap --force # Overwrite existing
The export file is plaintext JSON. If you need encryption, pipe through your tool of choice (e.g. cswap --export - | gpg -c > backup.gpg).
If you only have a long-lived setup-token (e.g., produced by claude setup-token)
and you don't want to log in via the browser flow first — useful on headless
servers or when receiving a token from another machine — register it directly:
cswap --add-token sk-ant-oat01-...
cswap --add-token sk-ant-oat01-... --slot 3
cswap --add-token - --slot 3 # read token from stdin
cswap --add-token --email user@example.com # optional label override
--email is optional; omitted values use setup-token-{slot}@token.local.
No Anthropic API calls are made.
Remove all data:
cswap --purge
Then uninstall the tool:
uv tool uninstall claude-swap
# or
pipx uninstall claude-swap
MIT