logoalt Hacker News

Show HN: Claude-account – switch Claude Code accounts without logging in again

38 pointsby hamza_rehmantoday at 2:58 PM23 commentsview on HN

I use separate Claude Code accounts for work and personal projects. Having to log out and go through the login flow every time I switched accounts became annoying, so I built a small CLI to solve it.

The commands are intentionally simple:

claude account add myworkaccount claude account add mypersonalaccount claude account use myworkaccount claude account current

After switching, Claude Code works normally:

claude claude "fix this bug in main.py" Repository: https://github.com/hamzarehmandeveloper/claude-account

Give it a try


Comments

hassanmehdi98today at 9:19 PM

Is it even safe to switch accounts frequently? worried about them imposing a ban

pandorotoday at 4:12 PM

I use this: https://gist.github.com/KMJ-007/0979814968722051620461ab2aa0...

Simple and works great but requires one alias per account

show 2 replies
carloslfutoday at 5:10 PM

appreciate you building this! I have two Claude max accounts. The way I do it is that I have two app launchers (claude desktop). I use the desktop app and a different data directory for each launcher like `open -n -a /Applications/Claude.app --args --user-data-dir="<its profile directory>"`. I got my first Claude to make me two different launchers for the two apps, and it's been working perfectly. wdyt?

The only problem I've noticed is with Claude in Chrome. It seems to not work well in the second account. And this makes sense because it was designed just for one app. Do you find yourself having the same problem with this setup? have you tried the second one with the Claude in Chrome ext?

dotancohentoday at 4:42 PM

Does it share the global ~/.claude/CLAUDE.md file? For some use case I'd like that, for others it could be problematic.

show 1 reply
hmokiguesstoday at 6:44 PM

I built the same thing for myself, but I like your implementation so much better.

bdemirkirtoday at 4:35 PM

Or use https://omp.sh and add multiple accounts. omp tracks usage and when limit is reached it uses the next account.

show 1 reply
pwythontoday at 5:36 PM

I use the Claude Code desktop app for work, and the CLI for personal, so I'm always logged into both accounts!

baron3dltoday at 5:26 PM

don't people get banned for doing this kind of thing?

show 3 replies
brentmitchell25today at 4:53 PM

Another way for those who use mise. You can auto-switch accounts by directory:

~/development/account1/mise.toml:

[env]

CLAUDE_CONFIG_DIR = "{{ env.HOME }}/.claude-account1"

acuteauratoday at 5:04 PM

revolutionary. you can do this with 2 lines of shell code.

i do this: https://github.com/acuteaura/universe/blob/main/overlays/cla...

swyxtoday at 6:24 PM

does this also extend to codex?

noobmaxtoday at 7:43 PM

[dead]