← All Posts

Can I Use Multiple Accounts with Claude Code? (How to Switch & Manage Sessions)

Yes, you can use multiple accounts with Claude Code. Each session is tied to a single authenticated account at a time. To switch, run claude logout followed by claude login with different credentials. Each account has its own independent usage window and rate limits, so switching accounts is a common workaround when you hit a usage limit mid-task.

  • Claude Code stores one active session credential at a time via your system keychain.
  • Usage limits are per-account: a Pro plan allows roughly 10x more usage than a free plan per 5-hour window (Anthropic support).
  • Max plan users get the highest limits and are least likely to need account switching.

How does Claude Code handle account authentication?

Claude Code authenticates through the standard Anthropic login flow. When you run claude login, it opens a browser window where you authorize the CLI with your Anthropic account. The resulting session token is stored securely in your operating system's keychain (macOS Keychain on Mac), not in a plain config file.

This means only one account is active at a time. There is no built-in profile system or account switcher in the CLI itself. Switching is a manual logout/login sequence.

How to switch between accounts in Claude Code

The process is straightforward but requires re-authenticating each time. Here is the exact sequence:

  1. Run claude logout in your terminal. This clears the current session token from your keychain.
  2. Run claude login to start a new authentication flow.
  3. A browser window opens. Sign in with the second account's credentials.
  4. Return to the terminal. Claude Code is now operating under the new account.

To switch back, repeat the same steps. There is no shortcut flag like --account as of early 2025, so this manual flow is the only supported path.

Using the API key method as an alternative

If you have an Anthropic API key (separate from a Pro or Max subscription), you can authenticate with claude --api-key YOUR_KEY or set the ANTHROPIC_API_KEY environment variable. This is useful for teams where different projects use different API keys, since environment variables can be scoped per shell session or .env file. According to Anthropic's support documentation, Claude Code works with both subscription-based login and direct API keys.

Why developers switch accounts: usage limits explained

Claude Code enforces usage limits in rolling 5-hour windows. When you exhaust your limit, the CLI returns a rate-limit error and you are locked out until the window resets. For developers in the middle of finishing a PR or deploying a fix, a sudden 5-hour lockout is a significant interruption.

This is the main reason developers keep a second account around. Rather than waiting hours for the reset, they log out and log back in under a different account to continue working. It is a workaround, not an officially recommended workflow, but it is common in practice.

Plan tiers differ meaningfully in how quickly you hit these limits:

PlanRelative Usage LimitBest For
FreeBaselineOccasional exploration
Pro ($20/mo)~5x freeRegular development work
Max ($100/mo or $200/mo)Up to 20x freeHeavy daily use, long agentic tasks

Exact multipliers vary by model and task type. Anthropic publishes guidance on usage limit best practices and notes that long agentic tasks with multiple tool calls consume significantly more usage than a single message exchange.

Knowing your limit before it hits: a better approach

Account switching after a lockout is reactive. The better strategy is knowing how close you are to the limit before it becomes a problem. If you can see your usage at 75% or 85%, you can wrap up a critical task, push your branch, or schedule heavier work for after the reset window.

This is exactly what Usagebar does. It sits in your macOS menu bar and shows your Claude Code usage in real time, no manual checking of dashboards required. You can also check your current usage any time with the /usage command in Claude Code or via your claude.ai usage settings page.

  • Smart alerts at 50%, 75%, and 90%: you get notified before hitting the wall, not after.
  • Reset time visibility: Usagebar shows exactly when your current usage window resets, so you know whether it is worth waiting 20 minutes or switching tasks entirely. This is related to when Claude Code usage resets.
  • Secure credential storage: credentials are stored in macOS Keychain, not plain text.
  • Pay what you want: free for students, flexible pricing for everyone else.

Instead of managing two accounts and a manual logout/login cycle, staying informed about where your limit stands means you rarely need to context-switch at all. And if you do need to switch accounts, you will at least know in advance rather than being surprised mid-task.

Get Usagebar for instant download with flexible pricing, including a free option for students.

Can Claude Code be used with multiple API keys for different projects?

Yes, and this is the cleaner multi-account pattern for teams and professional workflows. Instead of logging in and out interactively, each project directory can have its own .env file with a different ANTHROPIC_API_KEY. Claude Code picks up the environment variable automatically.

This is especially useful for agencies or contractors who manage separate Anthropic API billing for multiple clients. Each project stays isolated and billed independently without any manual credential juggling.

Key takeaways

  1. Claude Code supports one active account at a time. Switching requires claude logout then claude login.
  2. Each account has its own independent 5-hour usage window, which is why switching is used as a rate-limit workaround.
  3. For project-level separation, environment-variable-based API keys are cleaner than interactive switching.
  4. Knowing your usage in advance (via Usagebar, /usage, or your settings page) prevents the need for last-minute account switching during critical work.
  5. Max plan users face limits much less frequently and are the least likely to need multi-account workarounds.

Sources

Track Your Claude Code Usage

Never hit your usage limits unexpectedly. Usagebar lives in your menu bar and shows your 5-hour and weekly limits at a glance.

Get Usagebar