Skip to main content

claude-account

PyPI Python versions CI License: MIT

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:

  • claudeAiOauth in ~/.claude/.credentials.json — the subscription token
  • oauthAccount in ~/.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.

Metadata

Release files for claude-account 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for claude-account 0.1.0
File Size Uploaded
claude_account-0.1.0.tar.gz 7.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for claude-account 0.1.0
File Interpreter ABI Platform
claude_account-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 15.4 kB

Release files / claude_account-0.1.0.tar.gz

Download URL claude_account-0.1.0.tar.gz
Size 7.9 kB
Tags Source
SHA-256 checksum
How to use checksums
38f11445cd4fd3c1660dba819557f49b7edefcf9decc57e9eae0fd96e9d176b0
BLAKE2b-256 checksum
How to use checksums
618f169b4e437918302f6784e991e5b2d62390b129bccabf8befec000fc58f63
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 5, 2026.

Transparency log

Release files / claude_account-0.1.0-py3-none-any.whl

Download URL claude_account-0.1.0-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
134c0d7a0d3d1bea9784261b7bf11a8d079886fdfdec8270142a11206c802f70
BLAKE2b-256 checksum
How to use checksums
9234fd9042f0d556d07a9845fd3dbb366306e9a64c55c42df08aaf793cb29d4c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 5, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page