Repository navigation
Description
Summary
On OpenCode 2.0.24 a provider that is not in the built-in catalog can never be made available — neither via the providers block in opencode.json, nor from a plugin via ctx.provider.transform -> editor.add({ info, models }). The provider/models do appear in the plugin registry (ctx.provider.list() / ctx.model.list()), but they are absent from GET /api/provider and GET /api/model, and opencode run --model <provider>/<model> fails with Model unavailable. This blocks using any custom/local OpenAI-compatible server (e.g. llama.cpp / llama-swap).
Related observations:
- Config
providersis applied to catalog providers (adding a model toopencodeworks), but a new provider id is parsed (visible inGET /api/config) and never materialized. integrationIDpointing at a real integration with an active key credential,sourceConnection, andcanonicaldo not help.- Built-in local discovery does issue requests (LM Studio
GET /api/v1/modelson127.0.0.1:1234; vLLMGET /health+GET /v1/modelson127.0.0.1:8000) but no active provider appears either. - Plugin
console.logdoes not reachopencode.log.
Environment
- opencode version: 2.0.24 (
@opencode/cli, npmlatest) - OS: Microsoft Windows [Version 10.0.19045.6332] (Windows 10 22H2, x64)
- Terminal: Unavailable:
TERM=xterm-256color,TERM_PROGRAM/COLORTERMunset - Shell:
C:\WINDOWS\system32\cmd.exe - Install/channel: release
- Active plugins:
localai.discovery(global),opencode.models-disabler(global); nopluginsentry in config
Reproduction
Custom provider via config:
-
In the global
opencode.json(Windows:%USERPROFILE%\.config\opencode\opencode.json) add:{ "providers": { "acme": { "name": "Acme", "env": ["ACME_API_KEY"], "package": "@opencode/ai/providers/openai-compatible", "settings": { "baseURL": "https://llm.acme.example/v1" }, "models": { "qwen3-coder": { "name": "Qwen 3 Coder" } } } } } -
opencode service restart -
opencode api get /api/provider->acmeis absent -
opencode run --model acme/qwen3-coder "hi"->Error: Model unavailable: acme/qwen3-coder
Same provider via a plugin:
-
~/.config/opencode/plugins/foo/index.js:export default { id: "foo", async setup(ctx) { await ctx.provider.transform((editor) => { editor.add({ info: { id: "acme", name: "Acme", activation: "enabled", package: "@opencode/ai/providers/openai-compatible", settings: { baseURL: "https://llm.acme.example/v1" }, }, models: [/* one valid Model.Info object */], }) }) }, }
-
Inside the plugin,
ctx.provider.list()showsacmeandctx.model.list()shows its model. -
opencode api get /api/providerstill lacksacme;opencode run --model acme/<model>->Model unavailable.
Expected Behavior
Per the V2 docs (Providers -> Custom, and build/plugins -> ctx.provider.transform / editor.add), a non-catalog provider with a valid package, settings.baseURL and at least one model should become available and selectable, the same way catalog providers do.
Actual Behavior
The provider stays inactive and its models are unselectable.
SessionRunnerModel.ModelUnavailableError: Model unavailable: acme/qwen3-coder
GET /api/provider returns only opencode and opencode-go (both have integrationID: "opencode" and an active OAuth credential).
Additional Context
Things that DID work:
- Adding/overriding a model on a catalog provider via
providers(e.g.providers.opencode.models.config-test-model->opencode/config-test-modelresolves). - Adding a model under an available provider from a plugin:
ctx.model.transform(editor => editor.update("opencode", alias, draft => ...)).
Things that did NOT work:
- New provider id via
providers(not even materialized). ctx.provider.transform->editor.add(registered but never active), including with an existingintegrationID+ active credential, withsourceConnection, and withcanonical.- Built-in LM Studio / vLLM discovery endpoints answering correctly at their default ports.
Workaround in use (confirms the catalog-provider path works): attach local models to the active opencode provider as alias models with modelID set to a catalog model, model-level settings.baseURL pointing at the local server, and body.model overriding the outgoing model name. This makes opencode/local-<model> selectable and functional.
Activity
opencode-agent commentedon Oct 8, 2026
Thanks for the detailed report and for the workaround. I think this is a duplicate of #42856: a
providersentry with a non-catalog id gets parsed (it shows in/api/config) but never reaches/api/provideror/api/model, sorun --modelfails withModel unavailable. The plugineditor.addpath you describe is already reported in #51802.Possible duplicates and related issues, ordered from most to least likely:
Model unavailable, missing from/api/provider. Same steps and symptoms; comments confirm it on later 2.0.x releases on Windows.ctx.provider.transform/editor.addproviders never become available. This matches the plugin part of your report.capabilitiesis incomplete. That's a different cause, but it shows up the same way.It would still help to add a comment on #42856 confirming that it happens on 2.0.24, along with your workaround (alias models under
opencodewith model-levelsettings.baseURLandbody.model). Others hitting this may find it useful.The bot will close this issue as a duplicate in 1 day unless you reply explaining how your problem is different.
StandarterDF commentedon Oct 8, 2026
Likely a duplicate — thanks for the pointers. Same root cause as #42856 (config-declared non-catalog provider never materializes) and #51802 (plugin
editor.addprovider never becomes available). Reproduced here on 2.0.24 (Windows 10 22H2), same symptoms.I added a confirming comment + a working workaround on #42856 (alias models under the active
opencodeprovider with model-levelsettings.baseURL+body.model). Happy to have this closed as a duplicate.Summary of what I observed on 2.0.24:
GET /api/provider/GET /api/modelreturn onlyopencodeandopencode-go.providers.<new_id>in config is parsed but never materialized; adding/overriding a model on a catalog provider viaprovidersdoes work.ctx.provider.transform->editor.addregisters the provider (visible inctx.provider.list()/ctx.model.list()) but it never becomes available;integrationID+ active credential,sourceConnection, andcanonicaldo not help.opencode-agent commentedon Oct 8, 2026
Thanks for confirming, and for adding the 2.0.24 repro and workaround to #42856. That's the best place for it. Follow #42856 for the config-declared provider part and #51802 for the plugin
editor.addpart. The bot will close this one as a duplicate as planned.opencode-agent commentedon Oct 9, 2026
Closing this as a duplicate of #42856, as discussed. Thanks for confirming, and for adding the 2.0.24 repro and the alias-model workaround there. Please follow #42856 for the config-declared provider part and #51802 for the plugin
ctx.provider.transform/editor.addpart.