Skip to content
BlackHole1Public

About

Multi-account switcher for Claude Code and Claude Desktop: claude-swap (cswap) plus a maintained patch series.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

33 stars

Watchers

1 watching

Forks

Repository files navigation

aswap

English | 简体中文 | 繁體中文 | 日本語 | 한국어 | Русский | Français | Español

cswap list: two accounts with their 5h, 7d and per-model usage, then cswap switch 2

Switch between Claude Code accounts with claude-swap, plus a maintained set of fixes and features.

cswap manages several Claude accounts. It tracks each account's usage and can switch to the one with the most quota left. aswap builds cswap from unmodified upstream source and applies a small set of patches on top. All cswap commands work as before.

The name stands for account swap.

Install

uv tool install aswap  # or: pipx install aswap
aswap --version

aswap accepts every cswap command. It installs next to an upstream cswap without touching it.

To run aswap as cswap too:

aswap link    # add a cswap launcher next to aswap
aswap unlink  # remove it

aswap link only replaces a cswap launcher created by an aswap install. To replace upstream cswap, uninstall it first (uv tool uninstall claude-swap), or pass --force.

To upgrade, run aswap upgrade. It calls uv tool upgrade or pipx upgrade, depending on how aswap was installed.

What aswap adds

Refresh usage on demand

cswap refresh [account ...] fetches usage right away, one account at a time. For a rate-limited account, it shows when the server allows the next retry.

cswap refresh: one account refreshed, the other rate limited with the server retry time

One Claude Desktop window per account

Claude Desktop holds one login at a time. cswap desktop 2 opens account 2 in its own window with its own login, and cswap desktop --all opens every account. The Code tab in each window shows the same local sessions (not on Windows). The approach follows guise.

cswap desktop --all opening one Claude Desktop window per account, then cswap desktop listing both as open

One Chrome profile per account

Claude in Chrome uses the browser's claude.ai login, not the account picked by cswap switch (upstream #256). cswap chrome 2 opens account 2 in a separate copy of your Chrome profile. The extension there runs as account 2, and your main browser keeps its own login.

cswap chrome 2 opening a copy of the stock Chrome profile for account 2, cswap chrome 1 opening account 1, then cswap chrome listing both as open

  • cswap chrome --sync 2 copies your current Chrome profile into account 2 again. Close its window first.
  • cswap config set chrome.followSwitch true brings the account's browser forward on cswap switch.
  • cswap config set chrome.appPath <path> uses another Chromium browser, such as Edge or Brave.

Bug fixes

  • Stale account config. If ~/.claude.json still names account B while the keychain holds account A's token, upstream asks to log in to A again and stops refreshing B. aswap follows the account that owns the live token.
  • Version and upgrade. --version, the update check, and upgrade are hard-coded to the claude-swap package. aswap uses the package it was installed from.
  • Earlier history setting. Older aswap releases stored the choice to keep history per account as session.shareHistory. Upstream reads only run.shareHistory and shares history by default, so that choice would be lost and the histories merged. aswap still honors the old key.

How it is built

upstream.json pins one upstream commit. bun run setup clones that commit unchanged into cswap/. It then applies every patch in patches/ with git am, in the order listed in patches/.patches. This follows the layout Electron uses for its Chromium and Node patches. Each diff stays small and readable, and moving to a newer upstream is a rebase of the series.

Patch Change
Follow the live credential's owner Fix: stale account config
Follow the installed distribution Fix: version and upgrade
Refresh usage on demand Feature: cswap refresh
Open Claude Desktop per account Feature: cswap desktop
Open Chrome per account Feature: cswap chrome
Keep the earlier share-history choice Fix: earlier history setting

Each patch is a single commit, and its message explains the upstream problem. To build from source or work on patches, see CONTRIBUTING.md.

License

MIT, same as claude-swap. See LICENSE.

About

Multi-account switcher for Claude Code and Claude Desktop: claude-swap (cswap) plus a maintained patch series.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

33 stars

Watchers

1 watching

Forks

Releases

Contributors

Languages