Metadata-Version: 2.5
Name: llmswap-cli
Version: 1.0.0
Summary: One account switcher for Claude Code, Codex and Gemini CLI: usage, rotation before limits, and warm-up pings
Project-URL: Homepage, https://github.com/richard7ao/llmswap
Project-URL: Repository, https://github.com/richard7ao/llmswap
Project-URL: Issues, https://github.com/richard7ao/llmswap/issues
Project-URL: Upstream, https://github.com/realiti4/claude-swap
Author: Richard Lao
Author-email: Onur Cetinkol <onurcetinkol@gmail.com>
License: MIT
License-File: LICENSE
Keywords: account-switcher,claude-code,cli,codex,gemini-cli,rate-limit
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Utilities
Requires-Python: >=3.12
Requires-Dist: textual<9,>=8.2.8
Requires-Dist: truststore>=0.10.4
Provides-Extra: menubar
Requires-Dist: rumps>=0.4.0; extra == 'menubar'
Description-Content-Type: text/markdown

<!-- README rule: say what the user can do, give a minimal example, and mention only caveats that change their decision.
     Mechanics go in docs/, rationale in the PR. When behavior changes, edit the existing text instead of appending. -->

# llmswap

**One account switcher for every coding-agent CLI.** Save several logins for Claude Code, Codex and Gemini CLI, switch without logging out, see every account's 5-hour and weekly usage in one dashboard, rotate before a limit hits, and start each account's 5-hour window early with scheduled warm-up pings.

<p align="center">
  <img src="docs/img/dashboard.svg" alt="The llmswap dashboard: Claude Code, Codex and Gemini CLI accounts with usage bars and reset countdowns" width="760">
</p>

llmswap is a fork of [claude-swap](https://github.com/realiti4/claude-swap) by Onur Cetinkol (MIT). Everything claude-swap does for Claude Code is kept; Codex, Gemini CLI, the unified dashboard and warm-up are new. See [credits](#credits).

## Install

```bash
uv tool install llmswap-cli          # or: pipx install llmswap-cli
```

The command is `llmswap`. (The name `llmswap` on PyPI belongs to an unrelated project, so the package is `llmswap-cli`.) Python 3.12+.

llmswap ships claude-swap's `claude_swap` package inside it. Install it in its own tool environment (uv tool or pipx, as above) and do not put it in the same Python environment as the standalone `claude-swap` package: both provide `claude_swap`.

## Quick start

```bash
llmswap add                  # save the login every installed CLI is signed in with now
llmswap codex login          # sign in to a second Codex account without touching the first
llmswap list -r              # every account, every window, read live
llmswap switch codex:2       # make Codex account 2 the default login
llmswap run codex:1 -- exec "fix the tests"   # run as account 1 in this terminal only
llmswap                      # the dashboard
```

`llmswap list` on a terminal draws a bar per window:

<p align="center">
  <img src="docs/img/list.svg" alt="llmswap list: bars for the 5-hour and 7-day windows of each account" width="720">
</p>

## What it does

| | Claude Code | Codex | Gemini CLI |
|---|---|---|---|
| Save and switch logins without logging out | yes | yes | run only ¹ |
| Live 5-hour and weekly usage | yes | yes | not reported ² |
| Rotate before a limit (`llmswap auto`) | yes | yes | – |
| Parallel sessions (`llmswap run`) | yes | yes | yes |
| Warm-up pings | yes | yes | – ³ |

¹ Gemini CLI keeps its one default login in the system keychain, which llmswap does not touch. Each Gemini account lives in its own private home and runs with `llmswap run gemini:<n>`.
² Gemini reports quota per model per day inside the CLI. llmswap does not read it yet.
³ Gemini has no 5-hour window to start.

Per-provider commands (`llmswap <provider> ...`): `add`, `login`, `switch`, `run`, `remove`, `alias`, `enable`/`disable` (hold an account out of rotation), `usage`. `llmswap claude ...` is claude-swap's complete command set, documented in [docs/claude-code.md](docs/claude-code.md). Provider details and the evidence behind each are in [docs/providers.md](docs/providers.md).

`llmswap list --json` is a stable contract: fields are added, never renamed or removed ([docs/json-output.md](docs/json-output.md#llmswap-list---json-all-providers)).

## Rotate before a limit

```bash
llmswap auto               # watch every minute, switch when the active account reaches 90%
llmswap auto --once        # one pass, for cron
llmswap codex disable 3   # keep an account out of rotation
```

Claude Code uses claude-swap's engine with its cooldowns, per-account thresholds and tiers ([docs/auto-switch.md](docs/auto-switch.md)). Other providers move to the account with the most headroom once the active one reaches the threshold, skipping disabled and API-key accounts, with a five-minute cooldown. Running Codex sessions need a restart to use the new login.

## Warm-up pings

A 5-hour window starts at an account's first request and ends five hours later. If you start work cold, the window you burn through ends mid-day. Warm-up sends the smallest possible request through the official CLI as soon as an account's window has reset (or never started), so the window is already running when you sit down, and the next one starts as early as possible.

```bash
llmswap warm add codex:1 claude:2     # choose accounts (nothing is warmed by default)
llmswap warm quiet 23:00 07:00        # no pings overnight
llmswap warm enable                   # installs the schedule
llmswap warm status                   # what is due and when
```

It is **opt-in and off by default**, and `llmswap warm enable` makes you confirm you have read the terms below before it installs anything. `enable` installs a job in your platform's own scheduler (launchd on macOS, a systemd user timer or cron on Linux, Task Scheduler on Windows) that runs `llmswap warm tick` every five minutes. Most ticks do nothing: a tick pings an account only when its 5-hour window is cold, it is outside quiet hours, and it has not just been pinged. A failing account is retried with growing delay. `llmswap warm disable` removes the job. Details: [docs/warm-up.md](docs/warm-up.md).

**Read your provider's terms first.** Warm-up sends real requests with your own logins through the official CLIs, on a schedule, unattended, and spends a little of your quota.

- Anthropic's [Consumer Terms](https://www.anthropic.com/legal/consumer-terms) say you may not, "except when you are accessing our Services via an Anthropic API Key or where we otherwise explicitly permit it, … access the Services through automated or non-human means, whether through a bot, script, or otherwise." A scheduled `claude -p` on a Pro or Max login can fall under that. Team and Enterprise accounts are on different terms, and Anthropic may permit it explicitly; checking is your job. For that reason `warm add --all` skips Claude accounts: each one must be named.
- OpenAI's [Terms of Use](https://openai.com/policies/terms-of-use/) bar "automatically or programmatically extracting data or Output" and making your account available to anyone else.

Use only accounts you own. Turning warm-up on is your decision and your risk. The same goes for `llmswap auto` and `llmswap run`: they use your own logins, and you are responsible for how your plan's terms treat them.

## Menu bar (macOS)

```bash
uv tool install 'llmswap-cli[menubar]'
llmswap menubar              # runs under launchd, starts at login
```

Shows the fullest active window in the menu bar, every account's usage in the menu, and switches or pings with a click. `llmswap menubar --uninstall` removes it.

## Compared with the others

What each project's own README says it does (checked 5 Dec 2026). Where another project does something llmswap does not, the table says so.

| | llmswap | [claude-swap](https://github.com/realiti4/claude-swap) | [codex-swap](https://github.com/aneym/codex-swap) | [ccswap](https://github.com/errhythm/ccswap) | [Codex Switcher](https://github.com/Lampese/codex-switcher) | [PlanSwap](https://github.com/n2ns/planswap) | [cwarm](https://github.com/wonderbyte/cwarm) | [aisw](https://github.com/burakdede/aisw) |
|---|---|---|---|---|---|---|---|---|
| Claude Code | yes | yes | – | yes | – | yes | warm only | yes |
| Codex | yes | – | yes | yes | yes | yes | – | yes |
| Gemini CLI | run only ¹ | – | – | – | – | – | – | switch |
| Antigravity | – | – | – | yes | – | yes | – | – |
| Switch without logging out | yes | yes | yes | yes | yes | yes | – | yes |
| Live 5h / weekly usage | Claude, Codex | yes | yes | yes | yes | yes | – | – |
| Auto-rotate before a limit | yes | yes | at launch | yes | – | recommends | – | – |
| Parallel sessions | yes | yes | – | yes | – | – | – | – |
| Folder-to-account mapping | Claude only | yes | – | yes | – | – | – | – |
| Terminal dashboard | yes | yes | – | yes | – | – | – | – |
| Menu bar | macOS | macOS | – | macOS | yes (app) | – | – | – |
| Other front ends | – | VS Code extension works | – | Raycast, T3 hub | – | VS Code | – | shell hook |
| Scheduled warm-up | yes, native scheduler | – | manual `anchor` | during auto-switch | yes (app) | – | yes, Claude only | – |
| Form | CLI | CLI | CLI | CLI | desktop app | VS Code | CLI | CLI |

llmswap's differences: one provider interface (a new CLI is one module), warm-up that follows each account's own reset time and runs from the platform scheduler, and a single command over Claude Code, Codex and Gemini CLI. Research notes and what was borrowed from each: [docs/feature-map.md](docs/feature-map.md).

## Status and known limits

- Claude Code support is the inherited claude-swap engine, unchanged.
- Codex and the warm-up pings were built from Codex CLI 0.174.0's source and checked with fixtures and a fake `codex` binary in a temporary home. They have **not yet been run against a live Codex or Claude account**. In particular, the rule "0% used with a full window away means the window is cold" is documented by other tools but not yet confirmed here on a real account. Report what you see.
- Gemini CLI: private homes and `llmswap run gemini:<n>` only. Usage is not read and there is no default-login switch, because Gemini keeps its login in the OS keychain or an encrypted file.
- Copilot CLI, opencode, Cursor CLI and Grok CLI are left out for now; [docs/providers.md](docs/providers.md) says why for each.

## Safety

- Tests and development never touch real logins: they run against temporary homes and fake keychains.
- A login is written into a saved slot only when its identity matches that slot, and the default login is never overwritten if it is not saved. Rotated refresh tokens are captured back before a switch.
- llmswap never runs `codex logout` or any logout: those revoke the refresh token on the provider's side and break every saved copy.
- Tokens are never printed, logged or put in `--json` output.

## Data locations

llmswap keeps its own data in `~/.llmswap/` (macOS, Windows) or `${XDG_DATA_HOME:-~/.local/share}/llmswap/` (Linux); set `LLMSWAP_HOME` to move it. Claude Code accounts stay where claude-swap keeps them ([docs/claude-code.md](docs/claude-code.md#data-locations)).

## Credits

- [claude-swap](https://github.com/realiti4/claude-swap) by Onur Cetinkol: the Claude Code engine, TUI, menu bar, usage store and auto-switch this project is built on. MIT; the original copyright is kept in [LICENSE](LICENSE).
- Patterns studied in [codex-swap](https://github.com/aneym/codex-swap), [ccswap](https://github.com/errhythm/ccswap), [Codex Switcher](https://github.com/Lampese/codex-switcher), [cwarm](https://github.com/wonderbyte/cwarm), [aisw](https://github.com/burakdede/aisw) and [CodexBar](https://github.com/steipete/CodexBar); see [docs/feature-map.md](docs/feature-map.md).
- Claude, Codex and Gemini are products of Anthropic, OpenAI and Google. llmswap is not affiliated with them.

## License

MIT. Copyright (c) 2026 Richard Lao and Onur Cetinkol. See [LICENSE](LICENSE).

Contributing: [CONTRIBUTING.md](CONTRIBUTING.md) and [AGENTS.md](AGENTS.md).
