anomalyco / anomalyco/opencode

V2: switching an existing session from ChatGPT Codex OAuth to an OpenAI API key keeps the Codex endpoint

Open
#45,334 1 comment 1 reaction 1 assignee View on GitHub

@kitlangton is already working on this.

Since Aug 26, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

I use both ChatGPT Codex OAuth and an OpenAI API key. If I switch the active OpenAI account from ChatGPT Codex OAuth to an API key while an existing session is open, the next prompt keeps using the Codex endpoint and fails with API keys are not supported by this endpoint. I expect the next prompt to use the normal OpenAI API endpoint and the newly active API key, without interrupting the session.

Plugins

opencode-chatgpt-websearch

OpenCode version

0.0.0-dev-18308 when observed, currently 0.0.0-dev-18313

Steps to reproduce

  1. Connect a ChatGPT account through the ChatGPT Codex OAuth flow.
  2. Start a session with an OpenAI model that routes through Codex.
  3. Add or activate an OpenAI API-key account.
  4. In the same session, send the next prompt.
  5. The request still targets https://chatgpt.com/backend-api/codex and fails because it received the API key.

Operating System

Linux 7.1.10-200.fc44.x86_64

Terminal

Alacritty

Additional context

This is distinct from #7699 and #34765. This case is an API-key request retaining the Codex route after an active-account switch in an existing session.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.