https://github.com/realiti4/claude-swap
Switch between multiple Claude Code accounts
https://github.com/realiti4/claude-swap
claude claude-code
Last synced: 2 months ago
JSON representation
Switch between multiple Claude Code accounts
- Host: GitHub
- URL: https://github.com/realiti4/claude-swap
- Owner: realiti4
- License: mit
- Created: 2026-01-11T08:47:31.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2026-04-14T10:14:39.000Z (2 months ago)
- Last Synced: 2026-04-14T12:15:18.291Z (2 months ago)
- Topics: claude, claude-code
- Language: Python
- Homepage:
- Size: 258 KB
- Stars: 137
- Watchers: 1
- Forks: 15
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# claude-swap
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.
## Installation
### Using uv (recommended)
```bash
uv tool install claude-swap
```
### Using pipx
```bash
pipx install claude-swap
```
### From source
```bash
git clone https://github.com/realiti4/claude-swap.git
cd claude-swap
uv sync
uv run cswap --help
```
## Usage
### Add your first account
Log into Claude Code with your first account, then:
```bash
cswap --add-account
```
### Add more accounts
Log in with another account, then:
```bash
cswap --add-account
```
### Switch accounts
Rotate to the next account:
```bash
cswap --switch
```
Or switch to a specific account:
```bash
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.
### Refresh expired tokens
If an account's token expires, log back into Claude Code with that account and re-run:
```bash
cswap --add-account
```
This will update the stored credentials without creating a duplicate.
### Other commands
```bash
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
```
## Tips
- **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 --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.
## How it works
- 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
## Data locations
| 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/` |
## Uninstall
Remove all data:
```bash
cswap --purge
```
Then uninstall the tool:
```bash
uv tool uninstall claude-swap
# or
pipx uninstall claude-swap
```
## Requirements
- Python 3.12+
- Claude Code installed and logged in
## License
MIT