Skip to content

Conversation

@jroth1111
Copy link

@jroth1111 jroth1111 commented Dec 18, 2025

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.

@jroth1111
Copy link
Author

Context: #5748.

Heads-up: these auth-v2 PRs are stacked in my fork, so GitHub will show the full diff vs sst:dev here.

For just the incremental changes in this PR (on top of auth-v2 core), you can use:

If you prefer a single diff to review, #5746 is the combined PR.

@jroth1111
Copy link
Author

Superseded by #5754 (focused multi-account OAuth subscription failover using Bun.secrets). Closing to reduce noise; happy to reopen if you want the broader scope.

@jroth1111 jroth1111 closed this Dec 18, 2025
@jroth1111 jroth1111 deleted the auth-v2-model-discovery branch January 14, 2026 23:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant