Skip to main content

Multi-account switcher for Claude Code

Project description

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)

uv tool install claude-swap

Using pipx

pipx install claude-swap

From source

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:

cswap --add-account

Add more accounts

Log in with another account, then:

cswap --add-account

Switch accounts

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.

Refresh expired tokens

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.

Other commands

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/

Backup and migration

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).

Uninstall

Remove all data:

cswap --purge

Then uninstall the tool:

uv tool uninstall claude-swap
# or
pipx uninstall claude-swap

Requirements

  • Python 3.12+
  • Claude Code installed and logged in

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

claude_swap-0.9.0b1.tar.gz (70.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

claude_swap-0.9.0b1-py3-none-any.whl (34.9 kB view details)

Uploaded Python 3

File details

Details for the file claude_swap-0.9.0b1.tar.gz.

File metadata

  • Download URL: claude_swap-0.9.0b1.tar.gz
  • Upload date:
  • Size: 70.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for claude_swap-0.9.0b1.tar.gz
Algorithm Hash digest
SHA256 c3dc5e1a0d26574cceca3da0e4e0774ba68c59e73223e3a77b681adeeaf4c540
MD5 c8ad52c4393a2c7fc5ba9e36747b9acf
BLAKE2b-256 1a552662b51aedd6bc9c83d647d617280f6c737dc70fbcb4bbdd1232e8350a6a

See more details on using hashes here.

Provenance

The following attestation bundles were made for claude_swap-0.9.0b1.tar.gz:

Publisher: publish.yml on realiti4/claude-swap

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file claude_swap-0.9.0b1-py3-none-any.whl.

File metadata

  • Download URL: claude_swap-0.9.0b1-py3-none-any.whl
  • Upload date:
  • Size: 34.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for claude_swap-0.9.0b1-py3-none-any.whl
Algorithm Hash digest
SHA256 366b50874c0c989e6ce183d2e7a434179aa7af95cda3736a27713b2f73025be2
MD5 2b1bfa6c48530183082a999c250b743e
BLAKE2b-256 dfbc20862cae2e1d91195de958bc4449b2caabc605c3b9fe947064293d501e04

See more details on using hashes here.

Provenance

The following attestation bundles were made for claude_swap-0.9.0b1-py3-none-any.whl:

Publisher: publish.yml on realiti4/claude-swap

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page