Skip to content

providers: custom and plugin-added providers never become available #53912

Description

@StandarterDF

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 providers is applied to catalog providers (adding a model to opencode works), but a new provider id is parsed (visible in GET /api/config) and never materialized.
  • integrationID pointing at a real integration with an active key credential, sourceConnection, and canonical do not help.
  • Built-in local discovery does issue requests (LM Studio GET /api/v1/models on 127.0.0.1:1234; vLLM GET /health + GET /v1/models on 127.0.0.1:8000) but no active provider appears either.
  • Plugin console.log does not reach opencode.log.

Environment

  • opencode version: 2.0.24 (@opencode/cli, npm latest)
  • OS: Microsoft Windows [Version 10.0.19045.6332] (Windows 10 22H2, x64)
  • Terminal: Unavailable: TERM=xterm-256color, TERM_PROGRAM/COLORTERM unset
  • Shell: C:\WINDOWS\system32\cmd.exe
  • Install/channel: release
  • Active plugins: localai.discovery (global), opencode.models-disabler (global); no plugins entry in config

Reproduction

Custom provider via config:

  1. 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" } }
        }
      }
    }
  2. opencode service restart

  3. opencode api get /api/provider -> acme is absent

  4. opencode run --model acme/qwen3-coder "hi" -> Error: Model unavailable: acme/qwen3-coder

Same provider via a plugin:

  1. ~/.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 */],
          })
        })
      },
    }
  2. Inside the plugin, ctx.provider.list() shows acme and ctx.model.list() shows its model.

  3. opencode api get /api/provider still lacks acme; 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-model resolves).
  • 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 existing integrationID + active credential, with sourceConnection, and with canonical.
  • 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

  1. opencode-agent commented on Oct 8, 2026

    @opencode-agent
    Contributor

    Thanks for the detailed report and for the workaround. I think this is a duplicate of #42856: a providers entry with a non-catalog id gets parsed (it shows in /api/config) but never reaches /api/provider or /api/model, so run --model fails with Model unavailable. The plugin editor.add path you describe is already reported in #51802.

    Possible duplicates and related issues, ordered from most to least likely:

    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 opencode with model-level settings.baseURL and body.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.

  2. StandarterDF commented on Oct 8, 2026

    @StandarterDF
    Author

    Likely a duplicate — thanks for the pointers. Same root cause as #42856 (config-declared non-catalog provider never materializes) and #51802 (plugin editor.add provider 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 opencode provider with model-level settings.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/model return only opencode and opencode-go.
    • providers.<new_id> in config is parsed but never materialized; adding/overriding a model on a catalog provider via providers does work.
    • Plugin ctx.provider.transform -> editor.add registers the provider (visible in ctx.provider.list() / ctx.model.list()) but it never becomes available; integrationID + active credential, sourceConnection, and canonical do not help.
    • Built-in LM Studio / vLLM discovery issues requests at their default ports but no active provider appears.
  3. opencode-agent commented on Oct 8, 2026

    @opencode-agent
    Contributor

    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.add part. The bot will close this one as a duplicate as planned.

  4. opencode-agent commented on Oct 9, 2026

    @opencode-agent
    Contributor

    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.add part.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions