Skip to content

bug(opencode): Zen provider ships no model catalog — every Zen model must be hand-registered (opencode-go discovers, opencode does not) #92479

Description

@aaajiao

Summary

The bundled opencode (Zen) provider plugin ships no model catalog, so every Zen model a user wants must be hand-declared in models.providers.opencode.models[] with full routing (api + baseUrl + per-model metadata). The sibling opencode-go plugin does not have this problem — it bundles extensions/opencode-go/provider-catalog.ts with both a static seed and live discovery against https://opencode.ai/zen/go/v1/models.

Evidence (v2026.6.6)

extensions/opencode-go/ extensions/opencode/ (Zen)
provider-catalog.ts ✅ present ❌ absent
index.ts catalog.run / augmentModelCatalog / resolveDynamicModel ✅ wired ❌ none
openclaw.plugin.json modelCatalog null (models: NO, defaultModels: null)

The Zen models endpoint exists and mirrors the Go one:

  • GET https://opencode.ai/zen/v1/modelsHTTP 200, OpenAI-style {data:[…]}, 48 models (claude-fable-5, claude-opus-4-8, …, gpt-5.5, gemini-3.5-flash, grok-…, deepseek-…, etc.).
  • Per-model payload is IDs only ({id, object, created, owned_by}) — no cost/context, same as the Go endpoint, so a static metadata seed is still needed for rich fields.

Impact / repro

  1. Configure agents.defaults.model.primary: "opencode/claude-opus-4-8" (or any Zen model) without a models.providers.opencode.models[] entry → model_not_found.
  2. Add only { "id": "...", "name": "..." } (no baseUrl) → request silently misroutes to platform.openai.com and the Zen key 401s. (The error message for this was improved in bug(models): model_not_found remediation message is incomplete — suggests { "id": ... } but name is required and api/baseUrl are silently needed (misroutes to OpenAI) #89192 / fix(models): keep bundled provider catalog when configured base URL is blank (#91270) #91292, but the underlying "you must hand-register Zen models" remains.)

Proposed fix

Port the opencode-go pattern to the opencode plugin:

  • Add extensions/opencode/provider-catalog.ts — Zen base URL(s) + OPENCODE_MODELS_ENDPOINT = https://opencode.ai/zen/v1/models, a static metadata seed, and buildStatic… / buildLive…ProviderConfig (via buildLiveModelProviderConfig) / listModelCatalogEntries / resolveModel / normalizeBaseUrl.
  • Wire extensions/opencode/index.ts: catalog: { order, run } (static when no discovery key, live otherwise), augmentModelCatalog, resolveDynamicModel, and the normalize* hooks — mirroring opencode-go.

Questions before I send a PR

  1. Is the missing Zen catalog intentional (Zen as a user-curated proxy) or an oversight?
  2. If a PR is welcome, what seed scope do you prefer — the full live catalog seeded statically (48 models, more pricing upkeep), a curated headline subset (e.g. the Claude family) with live discovery covering the rest, or live-discovery-only with a minimal seed?
  3. Any reason the live /zen/v1/models discovery shouldn't be enabled by default for Zen the way it is for Go?

Happy to send the PR once you confirm direction. I have the port largely worked out against opencode-go.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority user-facing bug, regression, or broken workflow.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions