Find your next open-source project

Search by name, purpose, or keyword — or paste a GitHub repository URL

realiti4/claude-swap

Developer Tools

Manage multiple Claude Code accounts with quota-aware rotation, live usage dashboards, and parallel sessions.

4,681
506
Python
MIT
10 months old

What it does

claude-swap manages several Claude Code logins on one machine. It stores each account's OAuth credentials, swaps the active login without a full logout, and reads subscription usage so you can see remaining 5-hour and 7-day quota per account. Beyond manual switching, it can watch usage and rotate to another account before a limit is hit, and it can launch Claude Code as a specific account in one terminal while other terminals keep the default. It works with the Claude Code CLI and the VS Code extension.

Quick start

Requirements are Python 3.12+ and an installed, logged-in Claude Code.

  1. Install with uv or pipx:

    uv tool install claude-swap
    
  2. Log into Claude Code with your first account, then register it:

    cswap add
    
  3. To add another account, log in with it (do not run /logout first, which may revoke the refresh token) and run cswap add again.

  4. Inspect accounts and usage, then switch:

    cswap list
    cswap switch          # next account
    cswap switch 2        # specific slot or email
    

To let it switch automatically at 90% of a window:

cswap auto --threshold 80

Or open the full-screen dashboard with a bare cswap. On Linux and Windows the new account is picked up on the next message; on macOS the Keychain cache can delay it by about 30 seconds.

Constraints

claude-swap manages Claude subscription logins and Console API keys only. Third-party providers configured through ANTHROPIC_BASE_URL, ANTHROPIC_API_KEY or ANTHROPIC_AUTH_TOKEN stay in effect after a switch and must be unset to use the swapped account. API-key accounts have no subscription quota, so usage-aware strategies never treat them as rate-limited. Setup-tokens show usage unavailable unless the optional header probe is enabled, and each probe sends a real tiny request on that account. Export files are plaintext JSON by default, so encryption needs an external tool such as gpg. Mappings from directories to accounts are per-machine and not included in exports. Licensed under MIT.

HotRepo's take

The Python daily snapshot from 2026-11-13 shows 4,679 stars and 506 forks, with 29 stars gained that day and a best position of 11 in the Python list. That single record supports the fact that it drew attention on one day but not a longer trend. The README is unusually concrete for a utility of this kind: it documents the auto-switch decision rules, exit codes for cron use, JSON schemas, per-platform credential storage, and the known edge cases around session mode. That detail makes it easy to judge fit before installing.

Project source and documentation

Written by AI from the project's README, updated . The project's own docs are the source of truth.

You might also like

  1. changexbc/workbuddy-switchDesktop app for switching among multiple WorkBuddy and CodeBuddy accounts, copying sessions and tracking credit expiry and token usage.Rust1,518
  2. 1jehuang/jcodeA Rust terminal coding agent optimized for running many parallel agents in one repo with low memory and fast startup.Rust21,383
  3. smtg-ai/claude-squadA terminal TUI that runs multiple AI coding agents in isolated tmux and git worktree workspaces.Go8,789
  4. davila7/claude-code-templatesCLI for browsing, installing, and monitoring Claude Code components like skills, agents, commands, MCPs, and hooks.Python33,116
  5. decolua/9routerA local router that points AI coding CLIs and IDEs at multiple providers, with quota-aware fallback and token compression.JavaScript31,564