Skip to content

Latest commit

 

History

History
87 lines (55 loc) · 2.93 KB

File metadata and controls

87 lines (55 loc) · 2.93 KB

omp-account-switcher

omp-account-switcher

Switch between multiple Anthropic accounts in Oh My Pi without logging out.

Why? · Installation · Usage

Why?

You have a personal Anthropic account and a work one. Every time you need to switch, you log out, log back in, and wait for OAuth to do its thing. It's tedious.

omp-account-switcher fixes this. Log in to both accounts once, then flip between them with a single slash command. Your active account shows in the footer so you always know which one you're using.

How does it work?

OMP stores OAuth credentials in a SQLite database. Each credential has a disabled flag. This extension toggles that flag to switch which account is active, then tells OMP to reload its auth state. No logout, no re-auth, no token expiry issues.

  • /account to switch between accounts via a selector
  • /account label to name them (e.g., "personal", "work")
  • Footer shows acct:<label> when multiple accounts exist

Installation

Clone the repo and symlink the extension into your OMP extensions directory:

git clone git@github.com:sasha-computer/omp-account-switcher.git ~/Developer/omp-account-switcher
ln -sf ~/Developer/omp-account-switcher/src/account-switcher.ts ~/.omp/agent/extensions/account-switcher.ts
ln -sf ~/Developer/omp-account-switcher/src/account-store.ts ~/.omp/agent/extensions/account-store.ts

Restart OMP. The extension loads automatically from ~/.omp/agent/extensions/.

Setup

  1. /login and pick Anthropic (first account)
  2. /login and pick Anthropic (second account)
  3. /account label to name them
  4. /account to switch

Usage

Switch accounts

Type /account to open the account selector. Pick the account you want. OMP reloads auth immediately.

Label accounts

Type /account label to set friendly names for each credential. Without labels, accounts show as "Account 1", "Account 2", etc.

Footer status

When you have 2+ Anthropic credentials, the footer shows acct:<label> so you can see which account is active at a glance.

How it works internally

The extension uses three tables in OMP's agent.db:

Table Purpose
auth_credentials Stores OAuth tokens; disabled column controls which are active
cache Stores account labels with key account_label:{id}

Switching runs in a transaction: disable all Anthropic credentials, enable the selected one, then call authStorage.reload(). If anything fails, the transaction rolls back.

Labels persist across sessions. OAuth token refresh continues to work because OMP's own auth layer manages the active credential.

Tests

bun test

18 tests covering credential queries, label priority, account switching, and transaction rollback.

License

MIT