powered by
Check OpenAI-compatible Model Is Available
openai_check_model( x, base_url = OPENAI_URL_DEFAULT, api_key = NULL, api_key_env = OPENAI_API_KEY_ENV_DEFAULT, keychain_service = NULL, organization = NULL, project = NULL )
NULL, invisibly, if model is available; otherwise throws an error.
Character: Name of model.
Character: Base URL of the OpenAI-compatible server.
Optional character: API key.
Character: Environment variable containing the API key.
Optional character: macOS Keychain service containing the API key.
Optional character: OpenAI organization id.
Optional character: OpenAI project id.
EDG
# Requires running OpenAI-compatible server with /models endpoint if (FALSE) { openai_check_model( x = "local-model", base_url = "http://localhost:1234/v1", api_key = "test-key" ) }
Run the code above in your browser using DataLab