Problem
V2 should reconcile each provider's model catalog with the provider's /models endpoint instead of relying only on a static or stale catalog.
Today this can fail in both directions:
- models exposed by the provider may be missing from OpenCode
- models no longer exposed or usable by the provider may remain selectable
That leaves new models unavailable and stale or irrelevant models visible until hardcoded metadata catches up.
Desired behavior
- Fetch model availability from supported providers'
/models endpoints.
- Merge endpoint results with OpenCode metadata needed for capabilities, limits, variants, and display names.
- Drop models that the authoritative endpoint does not expose or marks unavailable for the current account or organization.
- Preserve explicitly configured custom models where appropriate.
- Define fallback behavior when discovery is unsupported, unauthenticated, malformed, or temporarily unavailable.
- Refresh without making startup or model selection depend indefinitely on a slow provider.
Acceptance criteria
- A newly exposed provider model becomes selectable without a static catalog update when the endpoint supplies enough information.
- A model removed from the endpoint is no longer offered unless explicitly configured or covered by a documented fallback.
- Account- or organization-scoped model lists are respected.
- Endpoint failures retain a usable bounded fallback and surface diagnostics without silently replacing a known-good catalog with an empty list.
- Tests cover additions, removals, explicit overrides, scoped availability, malformed responses, and request failure/timeout.
Related scope
This is broader than generic OpenAI-compatible custom-provider discovery: it covers V2's model-catalog reconciliation and filtering semantics across providers that expose authoritative model-list endpoints.
Problem
V2 should reconcile each provider's model catalog with the provider's
/modelsendpoint instead of relying only on a static or stale catalog.Today this can fail in both directions:
That leaves new models unavailable and stale or irrelevant models visible until hardcoded metadata catches up.
Desired behavior
/modelsendpoints.Acceptance criteria
Related scope
This is broader than generic OpenAI-compatible custom-provider discovery: it covers V2's model-catalog reconciliation and filtering semantics across providers that expose authoritative model-list endpoints.