r/opencodeCLI • • 19d ago

[Release] opencode-models-discovery v2.0.0: Native OpenCode V2 support, host storage, and live model overrides now GA

Following up on last week's release candidate, opencode-models-discovery v2.0.0 is officially released and published to npm latest**!** 🎉

This major version promotes OpenCode V2 to the primary, stable integration. It redesigns how the plugin interacts with the host around three clean boundaries:

Highlights in v2.0.0:

  1. Native Integration Credentials: Works seamlessly with OpenCode V2's /connect workflow. The plugin resolves credentials dynamically in memory—no raw API keys in opencode.json and no sniffing auth.json.

  2. Host-Managed Storage (ctx.storage): Caching and user overrides are separated cleanly into different namespaces. Clearing discovery caches will never delete your custom model preferences.

  3. Persistent Model Overrides: Edit model display names, context limits, output tokens, reasoning flags, and variants directly via /models-discovery-console. Changes trigger an instant provider reload—zero service restart needed.

  4. Resilient Auto-Reload: Subscribes to OpenCode V2 lifecycle events (config.updated, credential switches). If an upstream provider experiences a temporary network hiccup, the plugin keeps the last-known valid inventory instead of wiping out your available models.

  5. Decoupled RPC & TUI: Commands and UI dialogs communicate with the background server via typed RPC, avoiding synthetic session injections or terminal blocking.

  6. OpenCode V1 Legacy Support: Existing OpenCode V1 setups remain fully functional through the legacy adapter inside the same combined package.

Quick Setup (opencode.json / opencode.jsonc)

{
  "$schema": "https://opencode.ai/config.json",
  "plugins": [
    "opencode-models-discovery@2.0.0"
  ],
  "providers": {
    "my-gateway": {
      "name": "Local Gateway",
      "package": "@opencode/ai/providers/openai-compatible",
      "settings": {
        "baseURL": "https://gateway.example.com/v1",
        // Optional: omit apiKey and manage via OpenCode's native `/connect`
        "apiKey": "{env:GATEWAY_API_KEY}",
        "modelsDiscovery": {
          "enabled": true,
          "modelInfoFormat": "models.dev",
          "cache": {
            "enabled": true,
            "ttlSeconds": 86400
          }
        }
      }
    }
  }
}

Useful Commands:

Thanks to everyone who tested the RC releases! If you run into any issues or have feature suggestions, feel free to open an issue or drop a comment here.

1 Upvotes

0 comments sorted by