Skip to content

Support for OpenCode Desktop #5

Closed

Description

@kiblik

What problem are you trying to solve?

I'm testing OpenCode Desktop now and I noticed models are not recognised there (only in CLI version)

Proposed solution

Look deeper into what is happening in the Desktop version differently and try to investigate.

Alternatives considered

No response

Scope check

  • My request is related to LiteLLM model discovery, configuration, or routing

Activity

  1. exx-trost commented on May 29, 2026

    @exx-trost

    I ran into the same problem and did some analyzation. It seems like the discovered models are never written back to the config object for the desktop app since it is not designed for it.

    In plugin/index.ts — the config() hook on the plugin is called like this:

    for (const hook of hooks) {
      yield* Effect.tryPromise({
        try: () => Promise.resolve((hook as any).config?.(cfg)),  // <-- cfg is a local snapshot!
        ...
      })
    }
    

    The cfg passed to hook.config(cfg) is a local copy obtained earlier in the same InstanceState.make callback. In provider/provider.ts, the Provider service does its own separate config.get() call:
    const cfg = yield* config.get()

    might be actually related to: anomalyco/opencode#25630

  2. yuseferi commented on Jul 24, 2026

    @yuseferi
    Owner

    Thanks for the detailed analysis and reporting! You are absolutely right.

    In the Desktop version of OpenCode, there is a known limitation/bug where mutations made by plugins inside the config hook are performed on a local snapshot of the configuration and are not properly propagated or written back to the core UI. Because of this, dynamically discovered models do not appear in the Desktop model picker.

    This is an issue in the OpenCode core/desktop app hook lifecycle (which is why the CLI version works perfectly). Our plugin is fully compliant with the OpenCode specification.

    We recommend tracking this upstream on the OpenCode repository. Once they fix the propagation of config mutations in the desktop runtime, the model picker will automatically start working there as well. If we discover any plugin-side workarounds in the future, we will certainly update the plugin to support it!

  3. yuseferi commented on Sep 29, 2026

    @yuseferi
    Owner

    Update: this is now supported in opencode-plugin-litellm v1.4.0.

    The original behavior was caused by a runtime difference:

    • OpenCode 1 uses the legacy config hook.
    • OpenCode 2/Desktop uses the provider registry API, so the legacy hook was not enough for the Desktop model picker.

    PR #32 adds a dual-runtime plugin entrypoint. On OpenCode 2 it registers LiteLLM-discovered models through ctx.provider.transform, while preserving the existing OpenCode 1 behavior. It also supplies the model metadata needed for Desktop visibility and keeps the existing discovery, caching, authentication, filtering, and capability handling.

    Please upgrade to opencode-plugin-litellm@1.4.0 and use the OpenCode 2 plugins / providers configuration format. The implementation is here:
    #32

    If models still do not appear after upgrading, please share the OpenCode/plugin version and the plugin log output so we can investigate a separate provider or picker issue.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions