Skip to content

Accounts

Yohan Marshall edited this page Oct 17, 2026 · 9 revisions

Accounts

Claude and Codex are separate rosters. Each saved login is a slot (Account-1, Account-2, …, or codex:1 in the extra). OpenSwap swaps only that account’s login. Machine-wide MCP / plugin OAuth stays put.

The extra’s second tab shows the Codex roster. It is called Codex, or ChatGPT once you turn on ChatGPT desktop switching; its bars are Codex usage either way. ChatGPT.

Add (Claude)

In the extra, click Add account on the Claude page (Sign in with Claude when it has no accounts yet; also More › Add account › Sign in with Claude…). Sign in through your browser. OpenSwap first refreshes the saved copy of the account you are on, then saves whoever signs in: a new card, or a refresh of one already saved. Claude Code ends up on that account.

From a terminal, log into Claude Code with the account (claude auth login), then:

openswap add                     # current Claude Code login
openswap add --slot 3            # prompts before overwrite
openswap add --alias work

If a token has expired, the card says Signed out. Click that card: if Claude Code is already that account, OpenSwap saves the new login; otherwise it runs the Claude sign-in in your browser with that email filled in (asking first if that would sign another saved account out). Or log in with Claude Code yourself, then More → Refresh current credentials / openswap add. That updates the stored credentials instead of creating a duplicate.

From an API key or setup token

Paste a Claude Console API key (sk-ant-api…) or an OAuth setup token (sk-ant-oat01-…). Extra: More → Add account → From API key or setup token…. CLI:

openswap add-token sk-ant-api03-...          # API key (switch only, no usage bars)
openswap add-token sk-ant-oat01-...          # OAuth setup-token
openswap add-token sk-ant-api03-... --slot 3
openswap add-token - --slot 3                # stdin
openswap add-token --email you@example.com   # optional label

API-key slots have no 5h/7d quota. Kickoff skips them, and combined remaining on the widget omits them. Auto-switch uses a key only as a last resort: link it to a subscription (below), or set autoswitch.includeApiKeyAccounts.

API credit fallback

Link an API key to one of your subscription accounts and it becomes that account’s API credit: auto-switch moves Claude Code onto the key only when every subscription is at its limit, and moves back as soon as one has room again.

openswap add-token sk-ant-api03-... --for 1      # slot number, email or alias

In the extra, the From API key or setup token… page has a Use as API credit for menu that appears once you paste an sk-ant-api… key. A linked key’s card is titled API credit with “for <account email>” under it. While Claude Code runs on it, the popover says Holding on API credit.

Two things to know before you link a key:

  • It spends credit you bought in the Claude Console. The monthly API credit included with Max and Team plans does not cover Claude Code, so a key whose organization holds only that credit fails with “Credit balance too low”.
  • OpenSwap does not cap what a key spends. It cannot see a key’s spend, and a running Claude Code session keeps spending until a request fails. To cap it, create the key in its own Console workspace and set a monthly spend limit on that workspace (Console › Settings › Workspaces › Spend limits; the Default workspace cannot have one).

OpenSwap checks each key every 30 minutes with a free request (every 5 minutes after a failure). A key that stops working shows one of these notes, and auto-switch never moves onto it. If auto-switch put you on that key, it moves you off right away; a key you picked by hand is named in the hold line but left alone:

Note Meaning Fix
API key revoked or invalid The Console rejected the key Make a new key and add it again
API key out of credit The organization’s credit balance is too low Buy credit in the Console
API key at its spend limit The workspace or organization hit its spend limit Raise the limit, or wait for the month to reset

The last two are best-effort: Anthropic does not document whether that free check reports the balance or the spend limit, so a key can still look healthy and then fail in Claude Code.

Add (Codex / ChatGPT)

openswap codex add
openswap codex add --alias work

Or the Codex tab’s Add account / Sign in with ChatGPT (browser, does not log out your current login), or Save current login.

List and status

openswap list
openswap list --token-status
openswap list --json
openswap status
openswap codex list

Rows can show (disabled), (ahead) (weekly spend faster than even pace), and an age such as · 6m ago when the next usage fetch has not run yet.

Switch

openswap switch
openswap switch 2
openswap switch user@example.com
openswap switch work
openswap switch --strategy best
openswap switch --strategy next-available   # skip accounts that are rate-limited or whose key is dead
openswap codex switch 2

Disabled accounts are skipped by rotate / best / next-available, but openswap switch 2 still works if you name the slot. ChatGPT app restarts are a separate, confirmed path: ChatGPT.

Alias, disable, move, remove

In the extra, each card has a ··· button with Rename…, Disable / Enable, and Remove…. From a terminal:

openswap alias 2 work
openswap alias 2 --unset
openswap alias

openswap disable 2              # keep the login, leave it out of rotation
openswap enable 2

openswap move 2 1               # reassign slots (swaps if the target is taken)
openswap swap 1 2

openswap remove 2

openswap codex alias 2 work
openswap codex disable 2
openswap codex enable 2
openswap codex move 2 1
openswap codex swap 1 2
openswap codex remove 2

Disable is for a work account you do not want auto-switch to touch, or one you are resting. The extra and openswap disable / openswap enable toggle the same state.

Two orgs, same email

Claude Code can have two organizations on the same user. OpenSwap tells them apart by organization, not by email. Give each slot an alias (personal, adsonline) so the extra and openswap list stay readable.

A warning that two slots “hold the same credential” means the stored credential fingerprint matches (one slot’s backup was overwritten). Same email with different orgs is expected and is not that warning.

Unclaimed credentials

Sometimes a Claude swap leaves a stashed credential that no longer belongs to a slot. Codex has no unclaimed stash.

openswap unclaimed
openswap unclaimed --purge ID

Purging deletes the bytes. Recover that login with /login and openswap add.

Clone this wiki locally