OpenCode TUI plugin for switching between saved OpenAI OAuth accounts with a single /switch command.
- one
/switchcommand for login, switching, and removal - uses the native OpenCode OpenAI OAuth flow
- supports multiple saved accounts
- marks the current account in the picker
- keeps saved-account removal separate from the active session
Install the plugin with the OpenCode plugin command:
opencode plugin @harars/opencode-switch-openai-auth-pluginRun the command below in OpenCode:
/switch
From there you can:
- sign in with another OpenAI account
- switch to a saved account
- remove a saved account
Saved accounts are stored in a plugin-managed JSON file:
- Linux:
~/.local/share/opencode/auth-switch/accounts.json - macOS:
~/Library/Application Support/opencode/auth-switch/accounts.json - Windows:
%LOCALAPPDATA%/opencode/auth-switch/accounts.json
Install dependencies:
bun installRun checks:
bun test
bunx tsc -p tsconfig.json --noEmitBuild the package output:
bun run buildFor local development, point your workspace tui.json at the local source entry:
{
"plugin": [
"file:///absolute/path/to/opencode-switch-openai-auth-plugin/src/tui.tsx"
],
"plugin_enabled": {
"harars.switch-auth": true
}
}- package name:
@harars/opencode-switch-openai-auth-plugin - license: MIT