Claude Code in VS Code: switch or split accounts

To switch accounts in the Claude Code VS Code extension, type /logout (or pick Sign out in the command menu's Settings section) and sign in as the other account. The extension shares its saved login with the CLI, so for a different account per project, give a VS Code profile its own Claude config folder.

Contents

To switch accounts in the Claude Code VS Code extension, type /logout in the Claude panel (extension 2.1.277 or later), then click Sign in and finish in the browser as the other account. The extension's one saved login is the one your terminal claude uses too. For a different account per project, give a VS Code profile its own CLAUDE_CONFIG_DIR.

The steps follow Anthropic's VS Code and authentication pages as of 24 October 2026, the package.json inside extension version 2.1.310 on Open VSX, and VS Code's own docs on profiles and settings.

Does the extension share its login with the CLI?#

Yes. The panel runs a copy of Claude Code bundled inside the extension, and on one computer that copy shares three things with the CLI:

  • The login: the macOS Keychain on a Mac, ~/.claude/.credentials.json on Linux and Windows (Claude Code docs: Authentication).
  • Settings in ~/.claude/settings.json.
  • The conversation history.

Signing in or out in the panel signs the terminal in or out too. The extension vs CLI comparison lays out the rest row by row.

The one thing that splits them is CLAUDE_CONFIG_DIR. It moves the config folder, and Anthropic's authentication page says each folder "has its own settings, session history, and claude.ai login or API key". On a Mac the Keychain entry is keyed to the folder as well. Two config folders means two logins that never touch each other. The same page names one exception: a Claude Console sign-in made without an API key is stored outside the folder, so two of those aren't kept apart.

How to switch accounts in the Claude Code extension#

  1. Open the Claude panel and type /logout. Or click / to open the command menu and choose Sign out in its Settings section. Both need version 2.1.277 or later of the extension; its version number is the Claude Code version it bundles, shown in the Extensions view.
  2. The sign-in screen comes back. If it doesn't, run Developer: Reload Window from the Command Palette.
  3. Click Sign in and finish in the browser, signed in to claude.ai as the account you want.
  4. Type /status (version 2.1.280 or later) and check the account it shows.

The Command Palette also lists Claude Code: Logout. On Amazon Bedrock, Google Cloud's Agent Platform or Microsoft Foundry there is no sign out in the menu at all, because those sessions use your cloud credentials rather than an Anthropic login.

/logout removes the saved login and resets first-launch setup. Your conversations stay in the config folder. For a Team seat on the same email as your personal plan, you pick the organization in the browser during the new sign-in (switching between Team and personal orgs covers a login that lands on the wrong one).

VS Code still shows the wrong account#

When the panel keeps using an account or a key you didn't pick, something ranks above your login. Anthropic's precedence list puts ANTHROPIC_AUTH_TOKEN, ANTHROPIC_API_KEY, an apiKeyHelper script and CLAUDE_CODE_OAUTH_TOKEN above the subscription you signed in with, and the docs say the first three "apply to the CLI and the surfaces that wrap it, including the VS Code extension". Check, in this order:

  1. /status in the panel. It names the account and the login method in use.
  2. VS Code's environment. The extension starts Claude with everything VS Code was started with, plus the claudeCode.environmentVariables setting on top.
  3. The env block and apiKeyHelper in ~/.claude/settings.json, which the extension reads like the CLI does.
  4. A terminal where you ran /login as someone else. It replaced the shared login.

The reverse happens too: a key exported in your shell that the panel doesn't see. Anthropic's tip is to launch VS Code from a terminal with code . "so it inherits your environment variables". The step-by-step removal of a stray key is in Claude Code using your API key instead of your plan.

A different Claude account per project#

The obvious move fails here. The extension's settings table says claudeCode.environmentVariables accepts a CLAUDE_CONFIG_DIR entry "only when its value is an absolute path; the extension doesn't expand ~ and ignores a relative value". Putting that in a project's .vscode/settings.json looks right, but the extension's manifest declares the setting with "scope": "machine", and VS Code's docs say machine settings "can be set only in user settings or only in remote settings". A workspace file can't set it. (Claude Code's own project settings can't either: the env-vars page says project and local settings "can't set some variables, such as CLAUDE_CONFIG_DIR".)

VS Code profiles get around that, because "when you switch to a profile, the user settings are scoped to only that profile" (VS Code docs: Settings). One profile per account:

  1. Open the Profiles editor from the Manage gear at the bottom of the Activity Bar, select New Profile and name it after the account, say Claude work. Keep Settings in the profile's own contents rather than taking them from the Default Profile, or the next step lands in your default profile too. Check that the Claude Code extension is in the new profile: extensions are per profile, and Apply Extension to all Profiles in the Extensions view shares one install.
  2. In that profile, run Preferences: Open User Settings (JSON) and add the folder, as a full path:
json
"claudeCode.environmentVariables": [
  { "name": "CLAUDE_CONFIG_DIR", "value": "/Users/you/.claude-work" }
]

On Windows write the path with doubled backslashes, as in C:\\Users\\you\\.claude-work.

  1. Open the work repository while that profile is active. VS Code's profiles page says a profile you select "is associated with the current folder or workspace", so the folder opens in it from then on.
  2. Open the Claude panel. The new folder has no login yet, so the sign-in screen appears. Sign in as the work account and confirm with /status.

Projects opened in your default profile keep the login in ~/.claude. For a one-off, a terminal works without a profile: CLAUDE_CONFIG_DIR="$HOME/.claude-work" code ~/work/api, because the extension passes VS Code's own environment to Claude and the shell has already expanded $HOME. Start it with VS Code closed, so the window is sure to get that environment, and quit VS Code when you're done, since other windows opened in that run may pick it up too.

What moves with the config folder#

Everything Claude Code keeps there:

  • History. The panel's sessions list and claude --resume in a terminal show only the conversations of the folder they run with. To pick up a chat from the work profile in a terminal, run the CLI with the same CLAUDE_CONFIG_DIR.
  • Your settings.json, hooks, plugins and user-scope MCP servers. A new folder starts without them; two Claude Code profiles on one machine shows which files to link in and which (the login) never to link.

Use this for accounts you own and are entitled to use, such as your own Pro plan and your employer's Team seat. Anthropic's Consumer Terms say you may not share your account login or credentials with anyone else; providers' terms may not allow sharing a subscription sign-in.

How Shuriken handles Claude accounts next to VS Code#

Shuriken is a harness that runs Claude Code on your own computers, and it does the account work in its own chats rather than in the extension. Each Claude sign-in you add is a source with its own config folder, set through CLAUDE_CONFIG_DIR, so two accounts are never one login. Signing in and out happens in Settings › Sources; in a chat on a Claude sign-in, Claude Code's own /login and /logout are turned off. If the extension or the CLI is already signed in on that computer, Sources offers it: "Add you@… to Shuriken?"

Switching is automatic. We call it hot swapping: Shuriken moves your chats to another of your accounts or sources when one nears its limit, at 99% by default (source switching has the rules). In the desktop app, Open in › VS Code opens a chat's worktree in VS Code to read or edit what the agent did. Shuriken doesn't pass a source to that window, so the extension there keeps whichever login it has, and the chat goes on running in Shuriken on its own source. Free covers two sources, enough for a work account and a personal one. To run both without signing out of either, download Shuriken.

Sources

  1. Claude Code docs: Use Claude Code in VS Code (accessed 24 October 2026)
  2. Claude Code docs: Authentication (accessed 24 October 2026)
  3. Claude Code docs: Environment variables (accessed 24 October 2026)
  4. Claude Code extension 2.1.310 on Open VSX (package.json) (accessed 24 October 2026)
  5. VS Code docs: Contribution points (configuration scope) (accessed 24 October 2026)
  6. VS Code docs: Profiles (accessed 24 October 2026)
  7. VS Code docs: Settings (accessed 24 October 2026)
  8. Anthropic Consumer Terms of Service (accessed 24 October 2026)

Frequently asked questions

How do I sign out of the Claude Code extension in VS Code?

Type /logout in the Claude panel, or open the command menu with / and pick Sign out in its Settings section. Both need extension version 2.1.277 or later. The Command Palette also has Claude Code: Logout.

Does the Claude Code extension share its login with the CLI?

Yes, unless one of them runs with its own CLAUDE_CONFIG_DIR. Both keep the login in the same place: the macOS Keychain on a Mac, ~/.claude/.credentials.json on Linux and Windows. Signing out in one signs out the other on that computer.

Can I put CLAUDE_CONFIG_DIR in a project's .vscode/settings.json?

It won't take effect. The extension declares claudeCode.environmentVariables with VS Code's machine scope, which VS Code allows only in user or remote settings. Put it in a VS Code profile's user settings and open the project in that profile.

Do I lose my chats when I switch accounts in the extension?

No. /logout removes the saved login and resets first-launch setup, and the conversations stay in the config folder. Pointing CLAUDE_CONFIG_DIR at another folder shows that folder's sessions instead, because each config folder keeps its own.

Why does the extension still use my API key after I signed in?

An ANTHROPIC_API_KEY, ANTHROPIC_AUTH_TOKEN or apiKeyHelper ranks above a /login sign-in, and the extension reads them like the CLI does. Run /status to see which credential is in use, then remove the key from VS Code's environment and your settings.

Free tools