feat: support fetching models from API provider#5520
feat: support fetching models from API provider#5520sammcj wants to merge 2 commits intoblock:mainfrom
Conversation
Signed-off-by: Sam <sammcj@users.noreply.github.com>
Signed-off-by: Sam <sammcj@users.noreply.github.com>
DOsinga
left a comment
There was a problem hiding this comment.
This seems like it would be a great feature, but I think it can be done easier if we just add it to the existing route
| "/config/providers/fetch-models", | ||
| post(fetch_custom_provider_models), | ||
| ) | ||
| .route("/config/providers/{name}/models", get(get_provider_models)) |
There was a problem hiding this comment.
why do we need a new handler for this? we have /config/providers/{name}/models here that fetches the models for a particular provider. to make this work I think all you need to do is either assume that the custom models have model fetch in the same location as openai (which should be straightforward), or add a field to custom providers where the user can specify the path to fetch the models (which would be more general)
There was a problem hiding this comment.
getting models for custom providers used to work in older versions already, something changed in that area with the custom provider rewrite.
|
This pull request has been automatically marked as stale because it has not had recent activity for 23 days. What happens next?
Thank you for your contribution! 🚀 |
|
closing for being stale. I'll base something on this to fix the same |
This pull request adds support for automatically fetching available models from custom AI providers in both the CLI and desktop UI, improving the user experience when configuring providers. The changes include a new API endpoint for fetching models, updates to the CLI workflow to attempt model fetching before manual entry, and enhancements to the desktop UI to allow users to fetch and select models interactively.
Backend changes (API and CLI):
/config/providers/fetch-modelsin the server (fetch_custom_provider_models) that takes provider details and returns available models, handling authentication and error cases. [1] [2] [3] [4] [5]try_fetch_custom_provider_modelsin the CLI to fetch models from providers using the new endpoint, supporting retries with API keys and improved error handling.add_providerflow to try fetching models automatically before falling back to manual entry, and to prompt for API keys only if needed. [1] [2]Frontend changes (Desktop UI):