Repository navigation
v2.0.0
v2.0.0
Stable OpenCode v2 support
opencode-models-discovery@2.0.0 promotes OpenCode v2 to the primary, stable integration. V2 uses the native plugins / providers configuration shape, the provider lifecycle API, host-managed storage, Integration credentials, the native TUI, RPC handlers, and Agent Tools.
Highlights
Model Metadata Enrichment
V2.0.0 officially documents and supports nine model info metadata formats, decoupling provider metadata ingestion from core discovery scheduling:
- OpenRouter (
"openrouter"): Reads OpenRouter's inline/v1/modelsmetadata without making a secondary request. Maps context length, top provider output limits, architecture modalities (text,image,audio, etc.), prompt/completion and cache pricing, tool-calling flags, and reasoning effort variants (low,medium,high, etc.). - AIProxy (
"aiproxy"): Composes AIProxy inline limits, pricing, and effort tiers with models.dev display names and metadata. - Bifrost AI Gateway (
"bifrost"): Reads inline limits, modalities, per-token pricing, and reasoning variants. - LiteLLM (
"litellm"): Requests/v1/model/infoto ingest rich model metadata, context limits, pricing, and capabilities. - LM Studio (
"lmstudio"): Enriches/v1/modelswith loaded instance configurations from LM Studio 0.4.0+'s native/api/v1/modelsendpoint. - llama-swap (
"llama-swap"): Inline discovery of context lengths, architectures, and function-calling flags. - models.dev (
"models.dev"): Public catalog lookup for general context limits and capabilities. - OmniRoute (
"omniroute"): Inline metadata mapping for limits, multimodal capabilities, and service-tier variants (fast,flex). - vLLM (
"vllm"): Inline extraction of numericmax_model_lenlimits without secondary requests.
OpenCode v2 Integration Credentials
OpenCode v2 providers can manage credentials interactively using OpenCode's native /connect workflow through the host Integration API. When configured via /connect, API keys do not need to be written into opencode.json or opencode.jsonc.
V2 Model Overrides
V2 model overrides are persisted in host storage under:
overrides:<providerID>:<modelID>
Overrides can be listed, edited, enabled, disabled, and deleted through the V2 RPC contract and the /models-discovery-console model interaction. The model list marks overridden models with *. Cache clearing does not delete overrides.
Supported fields include display name, limits, capabilities, reasoning, attachments, variants, cost, and compatibility metadata. Credential and authorization fields are rejected and are never persisted.
Configuration
OpenCode v2 configuration uses opencode.jsonc (or opencode.json) with the primary path:
providers.<provider-id>.settings.modelsDiscovery
Example:
Use /connect or a host environment substitution ({env:KEY}) for credentials. V2 does not read V1 auth.json or OPENCODE_AUTH_CONTENT fallback data.
TUI and Agent Tools
Available V2 commands and tools include:
/models-discovery-refresh
/models-discovery-console
models_discovery_refresh
models_discovery_status
The console supports interactive model browsing, metadata inspection, cache operations, and model override editing. Override changes reload the provider and refresh the current TUI model list without restarting the service.
OpenCode v1 Legacy Support
The OpenCode v1 adapter remains available through the combined package entrypoint. Existing V1 configuration, provider-level discovery settings, XDG cache, auth fallback, and helper commands remain supported for compatibility, security fixes, and severe regressions.
New lifecycle, cache, TUI, RPC, and model override features target OpenCode v2 first and are not automatically backported to V1.
Migration
V1 users can continue using the legacy adapter. Users moving to OpenCode v2 should follow Migrating Configuration from OpenCode v1 to OpenCode v2.
V1 XDG cache files are not imported into V2. V2 cache and override storage are host-managed and use separate namespaces.
Validation
This release is validated by the repository's V1/V2 unit and contract tests (41 test files, 314 tests), local OpenAI-compatible HTTP integration tests, compiled package validation checks, and Node package-loadability dry-run tests.
{ "$schema": "https://opencode.ai/config.json", "plugins": [ "opencode-models-discovery@2.0.0" ], "providers": { "gateway": { "package": "@opencode-ai/ai/providers/openai-compatible", "name": "My Gateway", "settings": { "baseURL": "https://gateway.example.com/v1", // Optional: omit if managing credentials interactively via OpenCode '/connect' "apiKey": "example_api_key", "modelsDiscovery": { "enabled": true, "cache": { "enabled": true, "ttlSeconds": 86400 } } } } } }