Skip to contents

Check Anthropic Model Is Available

Usage

anthropic_check_model(
  x,
  base_url = ANTHROPIC_URL_DEFAULT,
  api_key = NULL,
  api_key_env = ANTHROPIC_API_KEY_ENV_DEFAULT,
  keychain_service = NULL,
  anthropic_version = ANTHROPIC_API_VERSION_DEFAULT
)

Arguments

x

Character: Name of the model.

base_url

Character: Base URL of the Anthropic API.

api_key

Optional character: API key.

api_key_env

Character: Environment variable containing the API key.

keychain_service

Optional character: macOS Keychain service containing the API key.

anthropic_version

Character: anthropic-version header value.

Value

NULL, invisibly, if the model is available; otherwise throws an error.

Author

EDG

Examples

# Requires running Anthropic-compatible server with /models endpoint
if (FALSE) { # \dontrun{
  anthropic_check_model(
    x = "test-model",
    base_url = "http://localhost:1234/v1",
    api_key = "test-key"
  )
} # }