Skip to contents

Creates a AnthropicConfig object which can be passed to create_agent()

Usage

config_Anthropic(
  model_name,
  temperature = TEMPERATURE_DEFAULT,
  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,
  anthropic_beta = NULL,
  max_tokens = ANTHROPIC_MAX_TOKENS_DEFAULT,
  timeout = ANTHROPIC_TIMEOUT_DEFAULT,
  extra_headers = NULL,
  extra_body = NULL,
  thinking_budget_tokens = NULL,
  validate_model = FALSE
)

Arguments

model_name

Character: The name of the Anthropic model to use (for example "claude-sonnet-4-6").

temperature

Numeric [0, 2]: The temperature for 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: Value of the required anthropic-version header.

anthropic_beta

Optional character: Value(s) for the anthropic-beta header. A character vector is comma-joined.

max_tokens

Integer [1, Inf): Maximum number of tokens the model may generate. Required by the Messages API.

timeout

Numeric (0, Inf): Request timeout in seconds.

extra_headers

Optional list: Additional HTTP headers.

extra_body

Optional list: Additional request body fields.

thinking_budget_tokens

Optional integer [1024, Inf): Budget for extended thinking. When set, each request enables extended thinking with this budget.

validate_model

Logical: Whether to validate model availability using /models.

Value

AnthropicConfig object

Author

EDG

Examples

cfg <- config <- config_Anthropic(
   model_name = "claude-sonnet-4-6",
   temperature = 0.4,
   api_key = "test-key",
   max_tokens = 1024L,
   validate_model = FALSE
)