How to use several Claude accounts with Claude Code

Keep a personal plan and a work seat signed in to Claude Code at once with CLAUDE_CONFIG_DIR, switch cleanly, and avoid the API key trap. Commands included.

· 4 min read

To use two Claude accounts with Claude Code, give each one its own configuration directory and start claude with CLAUDE_CONFIG_DIR pointing at it. Each directory keeps its own login, settings and session history, so your personal plan and your work seat never mix. This is the documented way to stay signed in to several accounts at once; the alternative is logging out and in every time.

#When do you actually need more than one account?

Real cases:

  • Personal plan and a work seat. Your employer's Team or Enterprise seat for work repositories, your own Pro or Max for side projects.
  • Several organizations. One Claude account can belong to more than one organization, each with its own plan.
  • Client work billed separately. A different account per client, for accounting or data-handling reasons.

One case that is not a good reason: creating extra free or paid accounts to get around usage limits. Anthropic's terms govern that, so read them before you try, and prefer the routes in Claude Code usage limits (usage credits, a higher plan).

#How do I stay signed in to two accounts with CLAUDE_CONFIG_DIR?

Per the official authentication docs, set the CLAUDE_CONFIG_DIR environment variable when you start claude, to a directory dedicated to that account. Each directory has its own settings, session history, and claude.ai login or API key. The simplest setup is a shell alias in ~/.zshrc or ~/.bashrc:

# default account: plain `claude` keeps using ~/.claude
alias claude-work='CLAUDE_CONFIG_DIR=~/.claude-work claude'

Open a new terminal and run claude-work. The first time, Claude Code walks you through login and setup for that directory; sign in with the work account. From then on, claude is your personal account and claude-work is the other one. Add a third alias for a third account.

On macOS, Claude Code stores the login in the Keychain and keys the entry to the configuration directory, so two directories do not overwrite each other. On Linux the login is in .credentials.json inside each directory. You do not need to manage either by hand.

What the separation means in practice:

  • Sessions are separate. claude --resume in the work directory only lists sessions started there, because history lives under that config directory's projects folder.
  • Settings are separate. Your settings.json, global CLAUDE.md, skills, commands and MCP servers in ~/.claude do not apply to ~/.claude-work. Copy or symlink what you want to share, for example the global CLAUDE.md and the skills folder.
  • Limits are separate. Each account has its own 5-hour window and weekly limit.

A limit from the docs: separate directories do not keep two Claude Console sign-ins that are used without an API key apart, because Claude Code stores that kind of sign-in outside the configuration directory. This applies to Console, not to claude.ai subscriptions.

#How do I check which account is active?

Run /status inside a session. It shows the login method, the organization and the email of the active credential. From a shell:

claude auth status

claude auth login and claude auth logout are the shell equivalents of /login and /logout. Logging out resets first-launch setup for that directory, so the next claude walks you through login again.

To switch without separate directories, which is fine if you switch rarely, run /logout and then /login and choose the other account. One Claude account that belongs to several organizations picks the organization during the browser step of login.

#Why does Claude Code keep using the wrong credential?

Almost always because of an environment variable. Claude Code picks credentials in a fixed order: cloud-provider settings first, then ANTHROPIC_AUTH_TOKEN, ANTHROPIC_API_KEY, an apiKeyHelper script, CLAUDE_CODE_OAUTH_TOKEN, and only then the subscription login from /login. So if ANTHROPIC_API_KEY is set in your shell, Claude Code will use it after you approve it, and bill the API instead of any of your plans.

Fix it:

env | grep -E 'ANTHROPIC|CLAUDE_CODE_(USE|OAUTH)'
unset ANTHROPIC_API_KEY

then check /status again. If both a login and an API key are configured, /status marks the one that is not in use. The same trap applies to scripts and CI: claude setup-token makes a long-lived token for non-interactive use, and it can only make model requests (no Remote Control, no claude.ai connectors).

#Which account does each project use?

Claude Code does not pick an account from the repository. It picks it from how you launched it. To make it automatic, use a launcher: an alias per account, or a tool like direnv that exports CLAUDE_CONFIG_DIR when you enter a folder:

# .envrc in ~/work/ (direnv)
export CLAUDE_CONFIG_DIR=~/.claude-work

Then claude anywhere under ~/work uses the work login. Keep this explicit. Mixing a personal account into a client repository, or the reverse, is the mistake worth designing around.

#Troubleshooting

  • "Login expired" or constant login prompts in one directory. Run /login there. Claude Code warns three days before a login expires; unattended sessions stop when it does.
  • Settings missing in the second account. Expected: it is a clean directory. Copy settings.json and symlink shared folders.
  • Remote Control or connectors missing. Both need a claude.ai login, not a token or API key.
  • Two accounts, one repository. Fine, but sessions are listed per config directory. Resume with the same alias you started with.

#In Relais

Relais has this built in. In Settings › Accounts you add your own plan, a team seat or another organization, sign each in once, and order them. Behind the scenes each is a Claude Code profile with its own CLAUDE_CONFIG_DIR, sharing your settings, skills, commands and session folder; only the login differs. New sessions start on the first account with room. When one hits its usage limit, the session carries on in the next, mid-task, and each still counts toward its own plan's limits. Because sessions stay real Claude Code sessions, claude --resume still works on them. Details on features and in the FAQ.

Claude Code,
better organized.

$14.99 a month, everything included. Mac and Linux, on your Claude Pro or Max plan. Cancel any time.