Skip to main content

fetch_models_async

Function fetch_models_async 

Source
pub async fn fetch_models_async(
    base_url: &str,
    api_key: &str,
) -> Result<Vec<String>, String>
Expand description

Model fetching utilities (async and blocking). Fetch the model list from an OpenAI-compatible /v1/models endpoint asynchronously.

This is the async counterpart to fetch_models_blocking. Uses the shared async reqwest::Client from the provider module.

base_url should be something like "https://api.openai.com/v1". The function appends /models and issues a GET with a Bearer token.

§Errors

Returns a human-readable error string on failure (network, auth, parse).