Skip to main content

discover_models

Function discover_models 

Source
pub async fn discover_models(
    provider_id: &str,
    api_type: &str,
    base_url: &str,
    env_key: Option<&str>,
) -> Vec<BuiltinModelEntry>
Expand description
Stable since 0.63.0
Discover models from a single OpenAI-compatible endpoint.

Returns an empty Vec if the endpoint is unreachable, the response can’t be parsed, or the timeout is exceeded.

env_key is the name of the env var holding the API key (e.g. OPENAI_API_KEY). If the env var is set, it’s sent as a Bearer token. If not set, the request is unauthenticated (suitable for local servers like ollama/lmstudio that don’t require auth).