ProviderModelNotFoundError on a model the provider clearly serves
OpenCode refuses a model that works when you query the provider's own API directly. Usually a custom-provider block that isn't being loaded, not a wrong model name.
Workaround verified
1 confirmation · 2 environments
- Applies through
- 1.18.4 – 1.18.11
- Last confirmed
- 2d ago
Who confirmed ▸
- renzo.t · 2d ago
- Applies to
- OpenCode long-standing; reproduced on 1.18.4 and 1.18.11
- Environments
- Custom providers, OpenRouter, GitHub Actions runners, the VS Code extension · All
- Severity
- Medium
Filed by moss.dev · Jul 27, 2026
Prove which config is loaded before touching the model id
Nearly every report resolves to the config file not being read in that context. Confirm the provider list the running process actually sees, then fix the path rather than the model name.
- 01List the providers the running binary resolves. If your custom provider is absent, the model id was never the problem:
opencode models - 02Point at the config explicitly rather than relying on discovery — this is what fixes the CI and extension cases:
OPENCODE_CONFIG=$PWD/opencode.json opencode run -m myprovider/my-model "hello" - 03If /v1/models succeeds but chat is refused with 401, the block is upstream. Confirm with a direct call before filing anything here:
curl -sS -H "Authorization: Bearer $KEY" $BASE_URL/chat/completions -d '{"model":"...","messages":[{"role":"user","content":"hi"}]}'
Fix applies to 1.18.4 – 1.18.11
Members' reports are attributed. Anonymous ones are counted separately.
Does it still happen?
What each release of OpenCode has been reported to do with this issue.
- 1.17.10Not yet tested— running OpenCode 1.17.10? Tell us below.
- 1.18.3Not yet tested— running OpenCode 1.18.3? Tell us below.
- 1.18.4Still affected — 1 report
- 1.18.10Not yet tested— running OpenCode 1.18.10? Tell us below.
- 1.18.11Still affected — 1 report
Why this happens
Selecting a model fails with:
ProviderModelNotFoundErrorThe same model id returns results from the provider's own /v1/models endpoint, which is what makes it maddening. Related shapes in the same family: Provider returned error from the CLI, and a 401 Request blocked by upstream provider where /v1/models succeeds but chat/completions is refused. In the VS Code extension the symptom is different again — configured Google, Copilot and OpenRouter providers simply never appear in the picker.
Likely causeCustom provider definitions are read from config that the running context may not load — a different config path under CI or the extension host, so only the built-in providers resolve. The 401 variant is a genuine upstream refusal for the chat route specifically, which is an account or routing issue at the provider rather than an OpenCode one.
Confirmed environments2
| Agent | Version | Model | OS | Framework | Outcome |
|---|---|---|---|---|---|
| OpenCode | 1.18.4 | Qwen3 Coder | macOS 15.5 | — | Reproduced |
| OpenCode | 1.18.11 | Kimi K2.6 | Ubuntu 24.04 | — | Reproduced |
Approaches that failed1
Trying every spelling of the model id
Spent an hour on prefixes and slashes. The id was right the whole time; the provider block wasn't loaded. `opencode models` would have told me in one second.
finchley · 2d ago
Other approaches that worked1
Explicit OPENCODE_CONFIG in CI
The runner's home directory wasn't where I thought, so discovery found nothing and only built-in providers loaded. Setting the path explicitly fixed it permanently.
moss.dev · 4d ago
Discussion · 1 comment
Strong evidence gets promoted into the record above.
Sign in to join the discussion, vote, and verify fixes.
Related pages
opencode modelsfirst, always. It answers the only question that matters — does this process see your provider at all — and it rules out the entire model-id rabbit hole in one command.