Skip to content

thecoderbuddy/claude-flipper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Claude Flipper

Flip between multiple Claude Code accounts without logging out and back in — every time.

MIT License Cross platform Built with Go Claude Code compatible

InstallQuick StartCommandsHow It Works

Buy Me a Coffee


The problem it solves

Claude Code only supports one account at a time. If you have a personal subscription and a work subscription, switching means /logout → browser → log back in → every single time.

That's five steps and a browser redirect to do something that should be instant.

Claude Flipper saves your accounts once and flips between them with a single command.


Before and after

Without Claude Flipper:

/logout → wait for browser → log in with other account → back to terminal

Five steps every time you switch. Easy to end up in the wrong account without noticing.

With Claude Flipper:

flipper swap && claude

One command. Instant. Always know which account is active.


Installation

macOS

brew install thecoderbuddy/tap/claude-flipper
flipper setup
source ~/.zshrc

flipper setup adds a shell wrapper that injects your active account's token every time you run claude. This is required for account switching to work.

To upgrade:

brew upgrade thecoderbuddy/tap/claude-flipper

Note: Upgrading does not affect your saved accounts. Your slots, credentials, and config backups in ~/.claude-flipper/ are preserved across upgrades.

Linux

curl -fsSL https://raw.githubusercontent.com/thecoderbuddy/claude-flipper/main/install.sh | bash
flipper setup
source ~/.bashrc

Supports x86_64 and arm64. Installs to /usr/local/bin/.

Note: On Linux, Claude Code stores credentials in ~/.claude/.credentials.json — no Keychain involved. flipper setup still adds the shell wrapper as a best practice for consistent behaviour across platforms.

Windows

Coming soon.


Quick Start

Step 1 — Save your first account

Open Claude Code and make sure you're logged in with your first account:

claude

Once you're in, exit Claude Code (/exit). Then run:

flipper add

This captures the session and saves it as slot 1.

Step 2 — Save your second account

You need to log out of the first account and log in with your second. Here's the exact sequence:

1. Open Claude Code:

claude

2. Inside Claude Code, log out:

/logout

This clears the current session. Claude Code will confirm you've been logged out.

3. Exit and reopen Claude Code:

/exit
claude

4. Inside Claude Code, trigger a fresh login:

/login

This opens your browser. Important: make sure you sign in with your second account in the browser — not the first one. If your browser auto-fills the wrong account, sign out of it in the browser first, then sign in with the correct account.

5. Once logged in, exit Claude Code:

/exit

6. Save the second account:

flipper add

This saves the second session as slot 2.

Why /login after /logout? After /logout, if you just reopen claude without running /login, Claude Code silently picks the last used account from its cache — you end up back on account 1 without realising it. Running /login forces a fresh browser authentication so you can explicitly choose which account to log in with.

Step 3 — Confirm both accounts are saved

flipper list
SLOT    ACT  EMAIL                     ORG
----    ---  -----                     ---
1            personal@gmail.com        Personal
2       *    work@company.com          Acme Corp

Step 4 — Flip between them

flipper swap && claude        # rotate to next account and open Claude
flipper swap 1 && claude      # jump to slot 1 by number
flipper swap work@company.com # jump by email

Note: Always exit Claude Code (/exit) before swapping. The desktop app overwrites credentials while running.


Commands

Command What it does
flipper add Save the currently logged-in Claude Code account as a new slot
flipper swap Rotate to the next account in the sequence
flipper swap <slot|email> Jump to a specific account by slot number or email
flipper list Show all saved accounts — active slot marked in the ACT column
flipper status Show which account is currently active
flipper setup Add the claude shell wrapper to your shell config (run once after install)
flipper token Print the active account's access token (refreshes if expiring)
flipper doctor Diagnose token expiry, keychain state, and config for all slots
flipper remove <slot|email> Remove an account by slot number or email
flipper reset Remove all saved accounts and wipe all Claude Flipper data

How it works

Saving an account (flipper add):

  • Reads your current Claude Code session from ~/.claude.json
  • Reads your credentials from the macOS Keychain (macOS) or credentials file (Linux)
  • Backs them up to ~/.claude-flipper/ under a numbered slot

Swapping accounts (flipper swap):

  • Backs up the current account credentials and config
  • Loads the target account's credentials and config from the backup
  • Refreshes the access token if it is about to expire
  • Updates ~/.claude.json with the target account's session

Why the shell wrapper (flipper setup):

macOS Security.framework (used internally by Claude Code) cannot read Keychain entries written by third-party processes. Rather than fight the Keychain, flipper injects the token via the ANTHROPIC_AUTH_TOKEN environment variable — which the Anthropic SDK reads directly, bypassing the Keychain lookup entirely.

The wrapper added by flipper setup does this automatically every time you run claude:

claude() { ANTHROPIC_AUTH_TOKEN="$(flipper token)" command claude "$@"; }

If anything fails mid-swap, it rolls back automatically — you're never left in a broken state.


Troubleshooting

"Not logged in" after swap

  • Make sure you ran flipper setup and reloaded your shell (source ~/.zshrc)
  • Check flipper doctor to see token expiry and config state for all slots

Claude.app blocks the swap

  • flipper blocks swaps while Claude.app (desktop) is running — it overwrites credentials
  • Quit Claude.app (⌘Q) first, then run flipper swap

Token expired

  • flipper swap automatically refreshes tokens before writing them
  • If the refresh token is revoked (e.g. you ran /logout), re-add the account: flipper add

Data location

~/.claude-flipper/                   macOS and Windows
~/.local/share/claude-flipper/       Linux (XDG)

├── sequence.json           Master account list and active slot
├── credentials/            Credential backups per slot
└── configs/                Config backups per slot

Privacy

Claude Flipper does not collect, transmit, or share any data.

Everything stays on your machine:

  • Credentials are stored locally with 0600 permissions
  • The only network request flipper makes is refreshing expired OAuth tokens directly with Anthropic's token endpoint
  • No telemetry, no analytics
  • Open source — you can verify exactly what the code does

Support

If Claude Flipper saves you time, consider buying me a coffee:

Buy Me A Coffee

Acknowledgements

Built for Claude Code by Anthropic.


Contributing

Bug reports, improvements, and platform-specific fixes are welcome.

  • Open an issue to report a bug or request a feature
  • Fork, fix, and open a PR — keep it focused on one thing

License

MIT — use it, fork it, adapt it.

About

Flip between multiple Claude Code accounts without logging out and back in.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors