Manually switch between multiple Claude Code accounts by swapping local credentials.
Project description
claude-account
Manually switch between multiple Claude Code accounts (e.g. a personal and a work subscription) from the terminal — without signing out and back in.
It swaps only the subscription token and account identity, leaving your MCP server auth and all project state untouched:
claudeAiOauthin~/.claude/.credentials.json— the subscription tokenoauthAccountin~/.claude.json— the account identity
Everything else — mcpOAuth, project history, settings — is preserved. Each
switch backs up your host files first.
Disclaimer. This is an unofficial, community tool. It is not affiliated with, endorsed by, or sponsored by Anthropic. "Claude" and "Anthropic" are trademarks of Anthropic, PBC. It only shuffles credential files that already live on your own machine; it talks to no Anthropic service itself. Use it to switch between accounts you personally own, manually. Don't use it to automate around usage limits.
Install
# run without installing
uvx claude-account status
# or install as a persistent tool
uv tool install claude-account
# or
pipx install claude-account
Requires the claude CLI on your PATH
(only for capture) and Python 3.9+.
Quick start
Two accounts, called primary and backup:
claude-account snapshot primary # store the account you're already on
claude-account capture backup # opens an isolated login for the 2nd account
claude-account swap # flip between them
Handy shell aliases:
alias cas='claude-account swap'
alias cass='claude-account status'
Commands
| Command | What it does |
|---|---|
snapshot <slot> |
Store the account you are already logged into (no re-login). |
capture <slot> |
Open an isolated login booth and store another account. |
status |
Show the active account and stored slots. |
swap |
Toggle between the two stored slots. |
use <slot> |
Activate a specific slot. |
Slots live in ~/.claude-accounts/; host backups in
~/.claude-accounts/backups/. Paths can be overridden with
CLAUDE_CRED_FILE, CLAUDE_CONFIG_FILE, and CLAUDE_ACCOUNTS_DIR.
How it works
capture logs in inside a throwaway CLAUDE_CONFIG_DIR, so your host login is
never touched, then copies out just that account's claudeAiOauth +
oauthAccount. swap/use do the reverse surgically: they write the target
slot's claudeAiOauth into .credentials.json and its oauthAccount into
.claude.json, preserving every other key. Before switching away, the current
account's live tokens are saved back into its slot (Claude Code rotates refresh
tokens, so stale copies would eventually stop working).
Do a switch between claude sessions — a running session holds its token in
memory. Slot files contain refresh tokens; treat them as secrets (they are
written 0600 and ~/.claude-accounts/ is 0700).
Development
uv run --group dev pytest -q
uv build
Releasing
Tag a version and push; CI builds and publishes to PyPI via Trusted Publishing (OIDC, no tokens):
git tag v0.1.0
git push origin v0.1.0
License
MIT — see LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file claude_account-0.1.0.tar.gz.
File metadata
- Download URL: claude_account-0.1.0.tar.gz
- Upload date:
- Size: 7.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
38f11445cd4fd3c1660dba819557f49b7edefcf9decc57e9eae0fd96e9d176b0
|
|
| MD5 |
47d4bb35c964aaa80512be3aef12bc0e
|
|
| BLAKE2b-256 |
618f169b4e437918302f6784e991e5b2d62390b129bccabf8befec000fc58f63
|
Provenance
The following attestation bundles were made for claude_account-0.1.0.tar.gz:
Publisher:
publish-pypi.yml on Barsoomx/claude-account
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
claude_account-0.1.0.tar.gz -
Subject digest:
38f11445cd4fd3c1660dba819557f49b7edefcf9decc57e9eae0fd96e9d176b0 - Sigstore transparency entry: 2081125593
- Sigstore integration time:
-
Permalink:
Barsoomx/claude-account@634ba8cc83841dc28646d58ef1e824cb52cb770c -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Barsoomx
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@634ba8cc83841dc28646d58ef1e824cb52cb770c -
Trigger Event:
push
-
Statement type:
File details
Details for the file claude_account-0.1.0-py3-none-any.whl.
File metadata
- Download URL: claude_account-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
134c0d7a0d3d1bea9784261b7bf11a8d079886fdfdec8270142a11206c802f70
|
|
| MD5 |
d848ea5e1601f0c58325a8d88bb48380
|
|
| BLAKE2b-256 |
9234fd9042f0d556d07a9845fd3dbb366306e9a64c55c42df08aaf793cb29d4c
|
Provenance
The following attestation bundles were made for claude_account-0.1.0-py3-none-any.whl:
Publisher:
publish-pypi.yml on Barsoomx/claude-account
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
claude_account-0.1.0-py3-none-any.whl -
Subject digest:
134c0d7a0d3d1bea9784261b7bf11a8d079886fdfdec8270142a11206c802f70 - Sigstore transparency entry: 2081125975
- Sigstore integration time:
-
Permalink:
Barsoomx/claude-account@634ba8cc83841dc28646d58ef1e824cb52cb770c -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Barsoomx
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@634ba8cc83841dc28646d58ef1e824cb52cb770c -
Trigger Event:
push
-
Statement type: