SIGN IN SIGN UP

feat!: rewrite plugin to use provider.models hook (BREAKING)

The 0.2.x architecture used the 'config' lifecycle hook to mutate
config.provider.litellm.models at startup. That turned out to be a
read-only notification in OpenCode's plugin API — our writes never
reached the runtime, so the formatter and discovery logic were dead
code in production. The 'provider.models' hook is the documented
mechanism for plugins to add models to a provider; this release
switches to it.

Key changes:

- Plugin emits V2 Model entries via the provider.models hook.
  api.id is set per-model so the @ai-sdk/openai-compatible adapter
  sends the correct upstream model name on the wire (without this,
  requests fail with errors like 'Tried to access litellm').

- Two Plugin exports: LiteLLMPlugin (id 'litellm') and
  LiteLLMResponsesPlugin (id 'litellm-responses'). The responses
  plugin only takes effect when the user has declared the matching
  provider in opencode.json.

- All discovered models register under 'litellm' by default, including
  reasoning-tier models like gpt-5*. Previously those were routed
  exclusively to a 'litellm-responses' provider, which silently
  dropped ~30 models from the picker for users who hadn't declared
  that second provider.

- Requires @opencode-ai/plugin >= 1.14 for the provider.models hook
  contract and the @opencode-ai/sdk/v2 Model/Provider types.

Files removed: src/plugin/config-hook.ts, src/plugin/enhance-config.ts.
Files added: src/plugin/build-model.ts, src/plugin/discover.ts.
Y
Yusef Mohamadi committed
e6ed1d37801700a7be19013c7908d400cd76f1d4
Parent: 9daa75e