feat(provider): discover models for openai-compatible providers - #48486
feat(provider): discover models for openai-compatible providers#48486nikakoy131 wants to merge 1 commit into
Conversation
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
|
The following comment was made by an LLM, it may be inaccurate: Found potential duplicate PRs:
These PRs appear to be directly related or may already address the model discovery functionality for OpenAI-compatible providers. You should review their status and implementation to ensure PR #48486 isn't duplicating existing work. |
Adds automatic model discovery for OpenAI-compatible providers.
Changes
baseURLand no explicitmodels(using@ai-sdk/openai-compatible, explicitly or by default) are probed viaGET <baseURL>/modelsduring provider init. Discovered entries are mapped to model definitions (id, name, modalities frominput_modalities, zero-cost defaults) and merged with any manually configured models — manual entries always win.defaultModelIDsno longer throws for empty provider maps.Provider.refreshDiscovery()re-runs discovery;opencode models --refreshuses it to re-fetch discovered model lists.Testing
baseURL+apiKeylists its discovered models.baseURLdoes not crash; the provider is simply omitted from listings.