[PR #5744] auth v2 model discovery #11560

Closed
opened 2026-02-16 18:16:24 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/5744

State: closed
Merged: No


Context: #5748.

Builds on auth v2 core branch jroth1111:auth-v2-core.

Summary

Adds opt-in model discovery for OpenAI-compatible providers by calling the upstream /models endpoint and caching the result. This helps keep model lists current without shipping static IDs.

What changed

  • ModelDiscovery.discover: fetches ${baseURL}/models (fallback ${baseURL}/v1/models) and caches under the local cache dir (TTL 12h).
  • Uses OAuth rotation fetch when running in subscription mode with stored OAuth creds; falls back to API key when in API mode.
  • Gated behind config option: provider.<id>.options.discoverModels: true to avoid surprising network calls.
  • Discovered model IDs are added to the provider model registry using an existing model as a template.

How to test

  • Enable discoverModels for an OpenAI-compatible provider, restart, and verify additional models appear.
  • Confirm the cache file is written and reused until TTL expiry.
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/5744 **State:** closed **Merged:** No --- Context: #5748. Builds on auth v2 core branch `jroth1111:auth-v2-core`. ## Summary Adds opt-in model discovery for OpenAI-compatible providers by calling the upstream `/models` endpoint and caching the result. This helps keep model lists current without shipping static IDs. ## What changed - `ModelDiscovery.discover`: fetches `${baseURL}/models` (fallback `${baseURL}/v1/models`) and caches under the local cache dir (TTL 12h). - Uses OAuth rotation fetch when running in subscription mode with stored OAuth creds; falls back to API key when in API mode. - Gated behind config option: `provider.<id>.options.discoverModels: true` to avoid surprising network calls. - Discovered model IDs are added to the provider model registry using an existing model as a template. ## How to test - Enable `discoverModels` for an OpenAI-compatible provider, restart, and verify additional models appear. - Confirm the cache file is written and reused until TTL expiry.
yindo added the pull-request label 2026-02-16 18:16:24 -05:00
yindo closed this issue 2026-02-16 18:16:25 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#11560