Repository navigation
Description
Description
ChatGPT OAuth login for the OpenAI provider succeeds on v2.0.20 (credential stored, token valid), but the openai provider never registers in the provider registry, so nothing is selectable in /models. This happens with every auth method:
-
ChatGPT Pro/Plus (browser)/(headless)(Codex scope set): token lacks the API scopes; the model refresh hits the endpoint directly and gets rejected:GET https://api.openai.com/v1/models → HTTP 403 {"error":"... Missing scopes: api.model.read ..."}Server log:
failed to refresh ChatGPT models(WARN, no cause attached). -
Sign in with ChatGPT(token-sharing): login completes, credential carrieschatgpt.tokens.use.direct+ dynamicclientID (oaiapp_...). The refresh endpoint now returns HTTP 200 with the account's 5 models (verified with the stored token directly:gpt-6-astra,gpt-5.6-sol/terra/luna,gpt-5.5). The models are even written to plugin storage (kv→models:<clientID>).Yet the provider is still absent — silently.
GET /api/provider/openai→ 404ProviderNotFoundError, and/api/providerlists onlyopencode-goandopencode. No WARN/ERROR in the log after login.
Eliminated causes:
- models.dev catalog (bundled snapshot and live) contains
openaiincl. the fallback models (gpt-5.5,gpt-5.6-*,gpt-6-astra) - No user config at all (no
opencode.json, no env overrides) — nothing disables it - ChatGPT plugin loads: its OAuth methods are registered on integration
openai, and the integration shows the active connection - Codex CLI works fine with the same ChatGPT account — the account/plan/identity is not the problem
opencode service restartdoesn't change anything
The plugin's provider.transform bails at const item = providers.get(providerID); if (!item) return — worth checking whether models.dev snapshot records actually reach provider state at all, because on this install no models.dev provider materializes (only the console-provided opencode / opencode-go do).
Plugins
None (no opencode.json, no .opencode/plugin/, no env overrides)
OpenCode version
2.0.20 (channel: latest)
Steps to reproduce
opencode auth login openai— try any of the three ChatGPT OAuth methodsopencode service restartopencode models | grep ^openai/→ emptyopencode api get /api/provider→ onlyopencode-goandopencodeopencode api get /api/provider/openai→ 404ProviderNotFoundError
Screenshot and/or share link
n/a (nothing crashes — provider just never appears)
Operating System
Linux x64
Terminal
xterm-256color
Activity
github-actions commentedon Sep 30, 2026
This issue might be a duplicate of an existing issue. Please check:
wadalin commentedon Sep 30, 2026
Additional data point — this is not ChatGPT-plugin-specific:
After removing the ChatGPT OAuth credential and connecting OpenAI with a plain API key (
opencode auth login openai→ "Manually enter API Key"), and a fullopencode service restart:integrationID=openai type=key active=true/api/integration/openaishows thekeymethod + active connectionGET /api/providerstill lists onlyopencode-goandopencodeGET /api/provider/openai→ still 404ProviderNotFoundErroropencode models | grep ^openai/→ still 0So even the plain models.dev-catalog + API-key path fails to add the
openairecord to provider state on this install. That strengthens the suspicion in the original report: models.dev snapshot provider records aren't materializing in the registry at all (only the console-providedopencode/opencode-goshow up), and the ChatGPT plugin'sproviders.get("openai")guard is just where it becomes user-visible.Environment recap: opencode 2.0.20 (latest), no
opencode.jsonanywhere, no env overrides,opencode service restartrepeatedly, models.dev reachable (curl HTTP 200).wadalin commentedon Sep 30, 2026
Even config-declared providers are affected:
Created
~/.config/opencode/opencode.jsonwith:{ "$schema": "https://opencode.ai/config.json", "providers": { "openai": { "models": { "gpt-5.5": { "name": "GPT-5.5" } } } } }opencode debug configshows the document is loaded (and the server logs aconfig.updatedevent)/api/providerunchanged,opencode run -m openai/gpt-5.5 ...→Error: Model unavailable: openai/gpt-5.5model: "openai/gpt-5.5"(falls back to a default model instead)-m anthropic/claude-modelerrors identically (no models.dev providers materialize on this install)So on v2.0.20, no provider definition reaches the registry here — not credential-based (OAuth key or API key), not config-declared. Only
opencode-goandopencodework, which suggests the channel that provisions console providers succeeds while everything routed through the provider/config transform pipeline is silently dropped. Happy to run one-repro traces (OPENCODE_LOG_LEVEL=DEBUG, freshrun=window grep) on request.wadalin commentedon Oct 1, 2026
Another finding that narrows this down: OpenAI works perfectly when it is the only connected provider. Removing both OpenCode Zen and OpenCode Go makes all OpenAI models appear and work. Adding back either Zen or Go makes the OpenAI models disappear again.
For context, my current OpenCode Zen configuration has “Free models” and “New models” turned off. The only enabled models are glm-5.3-flash and deepseek-v4.1-flash.
This revises my earlier suspicion: OpenAI provider registration works in isolation. The failure appears to be triggered by coexistence with Zen or Go, rather than by the OpenAI credentials or models.dev catalog alone.
[-]openai: ChatGPT OAuth connects but provider never registers — models not selectable[/-][+]OpenAI models disappear when OpenCode Zen or Go is connected[/+]AlexJoaquimPereira commentedon Oct 9, 2026
I've been facing the same issue on 1.18.35 too now
shadowrootdev commentedon Oct 20, 2026
Cross-referencing #57458 — we hit the same thing on 2.1.1 and can now reproduce it deterministically, which may help narrow this down.
The provider registry is populated from a live fetch of
https://models.opencode.ai/api.json. With the network to that host blocked, a fresh server reports zero providers:HTTPS_PROXY=http://127.0.0.1:9 HTTP_PROXY=http://127.0.0.1:9 opencode serve --port 46003 opencode api --server http://127.0.0.1:46003 provider.list # -> {"data":[]}The locally cached catalog (
models-dev:catalogin thekvtable, 231 providers, written by that same service) does not seed the registry, so a failed fetch leaves it empty. On the same install,ANTHROPIC_API_KEY=dummy opencode models | grep -c '^anthropic/'returns0, while the console-providedopencode-gokeeps its 29 models — consistent with "no models.dev provider materializes".Also relevant for the
if (!item) returnbail quoted above:github-copilothas the same shape. Its plugin only callsh.add()when the model sync succeeded, and that sync uses a hard-codedAbortSignal.timeout(5000):The Copilot timeout itself is tracked in #57264, and the same symptom with a Go/Zen credential stored in #55082.
neriousy commentedon Oct 23, 2026
Preserving the deterministic reproduction from #55516: on v2.0.32, connecting OpenCode Console caused the available OpenAI models to drop from 16 to 0; disconnecting restored all 16 while OAuth remained valid. The report also contains managed-configuration and rollback observations that may help isolate the provider-removal path.
opencodejr commentedon Oct 28, 2026
Thanks for the detailed report and the follow-up findings. I couldn't reproduce this here: it only happens once an OpenCode Console (Zen) or OpenCode Go account is connected, and this sandbox has no such account. #55516 (closed as a duplicate of this issue) has a clear reproduction on 2.0.32: OpenAI showed 16 models, connecting the Console dropped it to 0, and disconnecting brought them back.
There is a likely lead in the code, but I haven't confirmed it. OpenCode applies
provider.usepolicies from the config that a Console connection supplies, including anyenabled_providersallow-list. A denied provider is removed with only a debug-level log line, which would match the silentProviderNotFoundErroryou see.If you can, it would help to restart the service with debug logging while Zen/Go is connected. Then check the log for a line saying
providers denied by policyand post what it lists. A maintainer with a Console account will need to take it from there.Related:
opencode/opencode-goare connectedwadalin commentedon Oct 30, 2026
Quick update: I can't reproduce this on 2.2.4 anymore. Same OpenAI OAuth credential and Console workspace, and
openaiis back in/api/providerwith 19 models./api/provider/openaireturns 200 and points at the Codex backend, so the plugin transform is running.I also did a quick isolated 2.0.20 vs 2.2.4 comparison with models.dev blocked. On 2.0.20 the provider list comes up empty at startup and the app keeps showing it empty. On 2.2.4 the full list is there immediately. Looks like the startup race is gone.
Unless someone still hits this on 2.2.x, I think it can be closed as fixed.
deltacat commentedon Nov 1, 2026
2.2.5, same problem. see #60997
AlexJoaquimPereira commentedon Nov 11, 2026
It happened again on 2.2.7 for me #63296.
provider.useshows"resource": "*", "effect": "deny"too as attached fromopencode debug config:Short-term solutions are: