By choism4
Switch between saved Claude Code account credentials and OAuth token caches using macOS Keychain.
Switch between multiple Claude.ai accounts in Claude Code without repeating the browser login flow every time.
account-switcher snapshots the currently logged-in Claude Code credential and OAuth token cache into macOS Keychain under a profile name. Later, use <name> restores both pieces back to Claude Code.
This plugin intentionally uses macOS Keychain. Linux and Windows are not supported for credential switching yet.
Add the marketplace:
/plugin marketplace add choism4/claude-account-switcher
Install the plugin:
/plugin install account-switcher
Reload or restart Claude Code if prompted:
/reload-plugins
Register the account currently logged in to Claude Code:
/account-switcher:register personal
Log in to another Claude.ai account using Claude Code's normal login flow, then register it:
/account-switcher:register work
List saved profiles:
/account-switcher:ls
Switch profiles:
/account-switcher:use personal
Check the active Claude Code account:
/account-switcher:current
Remove a saved profile:
/account-switcher:unregister work
/account-switcher:current
/account-switcher:ls
/account-switcher:register <name>
/account-switcher:use <name>
/account-switcher:unregister <name>
There is also a compatibility command:
/account-switcher:account-switcher current
/account-switcher:account-switcher ls
/account-switcher:account-switcher register personal
Profile metadata is stored locally:
~/.claude/account-switcher/accounts.json
Example:
{
"accounts": [
{
"name": "personal",
"credential_service": "Claude Code account-switcher: personal",
"source_service": "Claude Code-credentials",
"registered_at": "2026-05-02T12:00:00.000Z"
}
]
}
The credential itself is stored in macOS Keychain as a generic password:
Claude Code account-switcher: personal
Claude Code 2.x also keeps an OAuth token cache in:
~/Library/Application Support/Claude/config.json
That oauth:tokenCache value is stored in a second Keychain item:
Claude Code account-switcher config: personal
On switch, that saved credential is written back to the Claude Code Keychain service detected during registration, usually:
Claude Code-credentials
The saved OAuth token cache is also restored to config.json. Existing profiles created before 0.2.2 should be registered again while the intended account is active.
If Claude Code does not reload the plugin command immediately, you can run the script directly:
~/.claude/plugins/cache/account-switcher/account-switcher/0.2.6/scripts/account-switcher register personal
~/.claude/plugins/cache/account-switcher/account-switcher/0.2.6/scripts/account-switcher use personal
Do not run older cached versions such as 0.1.0 or 0.2.0. Those versions do not restore Claude Code 2.x's OAuth token cache and can leave Claude Code with mismatched credentials, which may show up as Please run /login or an API 401.
For a local checkout:
plugins/account-switcher/scripts/account-switcher register personal
plugins/account-switcher/scripts/account-switcher use personal
account-switcher includes a UserPromptSubmit hook that handles /account-switcher:* commands locally before model invocation. This lets account switching work even when the current Claude Code account is quota-limited.
If you still see a usage-limit message before the command runs, restart Claude Code so the hook registration is loaded.
If a command hangs at Booping..., restart Claude Code. Some Claude Code versions keep slash command definitions and hooks in memory even after /reload-plugins.
If Keychain access fails, open Keychain Access and search for:
Claude Code-credentials
Claude Code must already be logged in before registering a profile:
claude auth status
If you accidentally ran an older cached script and see API Error: 401, restore the profile again with the latest cached script:
~/.claude/plugins/cache/account-switcher/account-switcher/0.2.6/scripts/account-switcher use personal
claude auth status --json
To verify a profile credential exists:
security find-generic-password -s "Claude Code account-switcher: personal" -w >/dev/null && echo saved
To verify the Claude Code 2.x OAuth token cache exists:
security find-generic-password -s "Claude Code account-switcher config: personal" -w >/dev/null && echo saved
Validate the plugin:
claude plugin validate plugins/account-switcher
Run the shell tests:
bash tests/account-switcher-keychain.test.sh
No model invocation
Executes directly as bash, bypassing the AI model
Runs pre-commands
Own this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge. GitHub access is read-only (username + org membership).
Sign in to claimOwn this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge. GitHub access is read-only (username + org membership).
Sign in to claimBased on adoption, maintenance, documentation, and repository signals. Not a security audit or endorsement.
Contains inline bash commands via ! syntax
Contains inline bash commands via ! syntax
npx claudepluginhub choism4/claude-account-switcher --plugin account-switcherComplete collection of battle-tested Claude Code configs from an Anthropic hackathon winner - agents, skills, hooks, and rules evolved over 10+ months of intensive daily use
Harness-native ECC operator layer - 67 agents, 271 skills, 92 legacy command shims, reusable hooks, rules, selective install profiles, and production-ready workflows for Claude Code, Codex, OpenCode, Cursor, and related agent harnesses