Skip to content

Conversation

@andrejvysny
Copy link

@andrejvysny andrejvysny commented Jan 14, 2026

What does this PR do?

This PR implements multi-account support for the OpenAI (Codex/ChatGPT) OAuth provider. It migrates legacy single-account OpenAI OAuth tokens into a new codex-multi format, introduces an on-disk structure and APIs to store and manage multiple Codex accounts, updates the Codex plugin to pick and rotate active accounts (including automatic switching on rate limits), adds CLI UX for listing/switching/removing Codex accounts, and wires detection of Codex multi-account auth into provider/LLM code paths.

How did you verify your code works?

  1. Login two different ChatGPT accounts via opencode auth login openai (or the plugin method).
  2. Run opencode auth list and confirm both accounts appear with the active marker, and that provider entries are shown correctly.
  3. Use opencode auth switch to change the active ChatGPT account; verify the active marker moves.
  4. Simulate or trigger a rate-limit on the active account (or temporarily mark account as rate limited in auth.json) and ensure the plugin switches to the next available account and shows a toast message.
  5. Confirm token refresh flows work: let a token expire or set expires in the past and ensure requests still succeed (refresh path used, tokens updated).
  6. Confirm legacy single-account auth (openai) still works and is migrated to codex on first use.

@github-actions
Copy link
Contributor

Hey! Your PR title [Feature] OpenAI OAuth multi account support doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

@andrejvysny andrejvysny changed the title [Feature] OpenAI OAuth multi account support feat(openai-oauth) OpenAI OAuth multi account support Jan 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant