SwitchEarly access
← All guides
Claude Code

Claude Code: change account and confirm which one is active

To change the account Claude Code uses, type /logout at the Claude Code prompt, then start claude again and sign in with the other account. Run /status afterwards to confirm it worked, because an API key or token in your environment can quietly take priority over the account you just chose.

A guide from Switch, an independent Claude Desktop profile manager. Switch is in early access ahead of its public release.

Log out, then log in as the other account

Inside a session, type /logout. Anthropic’s authentication docs note that logging out also resets first-launch setup, so the next time you run claude it walks you through login and setup again.

Login opens a browser window. Sign in with the account you want. If the browser doesn’t open, press c to copy the login URL. If the browser shows a code instead of returning you to Terminal, paste it at the prompt. When the terminal shows Login successful, press Enter.

You can do the same from the shell without opening a session (CLI reference):

claude auth logout
claude auth login

claude auth login accepts --email to pre-fill your address, --sso to force single sign-on, and --console to sign in with Anthropic Console for API billing instead of a subscription.

Confirm the account with /status

/status opens the Status tab, which shows the version, model, account and connectivity (commands reference). When both a login and an API key are configured, it marks the credential that isn’t in use.

From the shell, claude auth status prints the same information as JSON, or readable text with --text. Its authMethod field tells you whether a claude.ai login, an OAuth token or an API key is in use.

Environment variables that override your login

When several credentials are present, Claude Code picks one in a fixed order. As of October 2026, Anthropic’s authentication precedence list puts these above your /login account:

  1. Cloud provider credentials, when CLAUDE_CODE_USE_BEDROCK, CLAUDE_CODE_USE_VERTEX or CLAUDE_CODE_USE_FOUNDRY is set.
  2. ANTHROPIC_AUTH_TOKEN.
  3. ANTHROPIC_API_KEY. In interactive mode you approve it once; the “Use custom API key” toggle in /config changes that choice later.
  4. An apiKeyHelper script.
  5. CLAUDE_CODE_OAUTH_TOKEN. If you run /login while it’s set, the current session switches, but every new session reads the variable again until you remove it.

So if the account doesn’t change, look in ~/.zshrc and your settings files for these. Anthropic’s suggested fix for a stray key is unset ANTHROPIC_API_KEY, then /status to confirm. Keep in mind that an API key from the Claude Console is billed as API usage, not through your Claude subscription.

These variables affect the CLI and tools that wrap it. Claude Desktop doesn’t read them; it uses its own sign-in.

When a second configuration folder is better

Logging out and in works for an occasional change. If you move between a work and a personal account every day, it gets tedious: each logout resets setup, and only one account is signed in at a time.

The alternative Anthropic documents is a separate configuration directory per account, using CLAUDE_CONFIG_DIR. Each keeps its own login, settings and session history, so both stay signed in and you pick one by the command you run. What CLAUDE_CONFIG_DIR does explains the details, and running multiple Claude Code accounts on one Mac walks through the setup.

One side effect either way: sessions stay with the setup that created them. See resuming a Claude Code session.

Claude Code in Claude Desktop, and plans

If you use Claude Code from Claude Desktop, Switch gives each account its own profile. With Keep coding preferences separate on, each profile has its own Claude Code configuration folder, so you change accounts from the Dock or a keyboard shortcut rather than by logging out. How Switch handles Claude Code.

Each account keeps its own plan and usage limits. Changing accounts to get around limits can conflict with Anthropic’s terms, so use separate accounts for separate work.