Save several Claude Code subscription accounts and switch between them instantly with one command — no losing your subscription, no re-login.
Settings, MCP, skills, and history are all shared. Works on Windows, Linux, and macOS.
Requires Git first (Linux/macOS also need jq and curl). No Git? See how to install it here
Save each Claude account's login token as its own separate profile, so your personal and company accounts never interfere with each other.
cl switch opens a menu — pick one, hit Enter, and it kills the running Claude first, then switches accounts.
Switching swaps your subscription identity too, so Claude Code stays on your Pro / Max subscription and never quietly drops to API billing.
MCP tokens, settings, conversation history, skills, and plugins are all shared — only the account token switches, nothing else is affected.
| Item | Location | Switched / Shared |
|---|---|---|
Account token claudeAiOauth | ~/.claude/.credentials.json | switched per account |
Subscription identity oauthAccount | ~/.claude.json | switched per account |
MCP token mcpOAuth | ~/.claude/.credentials.json | shared |
| Settings, conversation history, skills, plugins | ~/.claude/ | shared |
.credentials.json, and the subscription identity in ~/.claude.json.
Swap only one of them and Claude Code treats it as a mismatch and falls back to API billing. cl rewrites both blocks together, so after switching you still draw on your subscription quota. Expired tokens are also refreshed automatically on switch.
Press Win + X, choose "Terminal" or "Windows PowerShell", copy and paste the command below in full (Ctrl+V), and press Enter.
PS> irm https://raw.githubusercontent.com/yazelin/claude-auth-switcher/main/install-oneliner.ps1 | iex
The install automatically wires up both your Windows PowerShell 5.1 and PowerShell 7 profiles and prints the next steps. When it's done, open a fresh PowerShell window.
If your machine is already logged into Claude Code, run this line to save the existing login as a profile called "personal":
PS> cl import personal
"personal" is just a name — feel free to use any nickname that makes sense to you.
Run cl login with a name to open the browser OAuth login flow; once you finish logging in it's saved as a profile automatically:
PS> cl login company
# once login finishes, the company profile is saved
PS> cl list
CURRENT PROFILE EMAIL PLAN USAGE
* personal ya***@gmail.com max 5h 42% used @14:00 | wk 18% used @06/02
company ya***@company.com pro 5h 7% used @09:00 | wk 55% used @06/05
The * marks the account currently in use; emails are masked; the percentages are amount used (5-hour / weekly).
Switch with the interactive menu — it kills the running Claude first, then switches accounts:
PS> cl switch
cl use company — after switching just launch claude, no wrapper needed.
You'll need git, jq, and curl first.
$ bash <(curl -fsSL https://raw.githubusercontent.com/yazelin/claude-auth-switcher/main/install-oneliner.sh)
$ source ~/.bashrc
# zsh users: use source ~/.zshrc instead
$ cl import personal # save the current account
$ cl login company # add a second account via browser OAuth
$ cl use company # switch to the company account (kills running claude first)
$ claude # launch Claude Code as usual
cl usage with no arguments refreshes the usage of every account live and lines them up in a table (equivalent to --all) — so you can see at a glance which account still has quota. Reset times are shown in your local time (Taiwan UTC+8).
Type a number to pick an account, then Enter. Before switching it automatically kills any running Claude, so it can't write the old account's token back.
| Command | What it does |
|---|---|
cl login <name> | Open browser OAuth to add an account and save it as a new profile |
cl import <name> | Save the current login state in ~/.claude as a profile |
cl use <name> | Switch the active account (kills running claude first) |
cl switch | Switch accounts via an interactive menu, also killing claude first |
cl kill | Immediately kill all running claude processes |
cl list | List all accounts in a table: active marker, email (masked), plan, cached usage |
cl usage [name|--all] | Live usage table for all accounts side by side (no argument = all); a single account shows the detailed breakdown |
cl current | Show the name of the profile currently in use |
cl remove <name> | Delete a profile |
cl ps | List detected claude processes (excludes this session) |
cl doctor | Diagnostics: paths, claude process state, profile overview |
cl export <file> | Back up all profiles (Windows .zip / Linux .tgz) |
cl restore <file> | Restore profiles from a backup archive |
cl help | Show the built-in command help |
Windows: in PowerShell, type:
After it installs, close PowerShell and reopen it, and you'll have git.
Linux (Ubuntu/Debian):
macOS: type git in the terminal and macOS will prompt you to install the Command Line Tools; jq can be installed with brew install jq.
Windows sometimes blocks PowerShell scripts. Run this line first to lift the restriction, then paste the install command again:
The install adds the setup to your PowerShell profile, so you need to reopen PowerShell for it to take effect. The installer already wires up both your Windows PowerShell 5.1 and PowerShell 7 profiles.
If it still doesn't work, check that your profile contains this line:
It should contain a line like . "C:\Users\YourName\claude-auth-switcher\shell\powershell.ps1". If it's missing, add it manually, save, and reopen PowerShell.
The most common cause is that Claude was still running during the switch — a running session writes its old token back on its next API call, overwriting the switch.
cl use and cl switch both kill any running claude before switching by default, so normal usage won't hit this. If you added --no-kill yourself, remember to close Claude first.
No. Your Claude account identity is spread across two files: the token in ~/.claude/.credentials.json, and the subscription identity (oauthAccount) in ~/.claude.json.
cl rewrites both blocks together when switching, so Claude Code stays on your Pro / Max subscription. If a profile was saved with an older version of the tool and is missing the subscription identity, just run cl import <name> again to restore it.
It shows the amount used. For example, 5h 42% used means this 5-hour window is already 42% consumed. For a single account, cl usage <name> also lists the weekly, weekly-opus, and weekly-sonnet breakdowns along with reset times.
(This is the opposite of the sibling project codex-auth-switcher — Codex shows the remaining amount.)
No. All tokens are stored only in the ~/.claude_auth_profiles/ folder on your own machine, and the tool runs entirely locally. On Unix the profile directory is set to 700 and the files to 600.
Don't commit ~/.claude_auth_profiles/ or the backups produced by cl export to Git; the backup files contain long-lived tokens, so delete them after transferring.