def list_models(
    provider: Optional[str] = None,
    api_key: Optional[str] = None,
) -> List[str]:

source code

Get a list of available models, either in total or for a specific provider.

Arguments:

  • provider - If specified, returns the list of models supporting this provider.
  • api_key - If specified, unify API key to be used. Defaults

Returns:

A list of available model names if successful, otherwise an empty list. Raises: BadRequestError: If there was an HTTP error. ValueError: If there was an error parsing the JSON response.

  • BadRequestError - If there was an HTTP error.
  • ValueError - If there was an error parsing the JSON response.