| AnthropicProvider | R Documentation |
Provider class for Anthropic. Can create language models.
specification_versionProvider spec version.
new()Initialize the Anthropic provider.
AnthropicProvider$new( api_key = NULL, base_url = NULL, api_version = NULL, headers = NULL, name = NULL, timeout_seconds = NULL, total_timeout_seconds = NULL, first_byte_timeout_seconds = NULL, connect_timeout_seconds = NULL, idle_timeout_seconds = NULL )
api_keyAnthropic API key. Defaults to ANTHROPIC_API_KEY env var.
base_urlBase URL for API calls. Defaults to https://api.anthropic.com/v1.
api_versionAnthropic API version header. Defaults to "2023-06-01".
headersOptional additional headers.
nameOptional provider name override.
timeout_secondsLegacy alias for total_timeout_seconds.
total_timeout_secondsOptional total request timeout in seconds for API calls.
first_byte_timeout_secondsOptional time-to-first-byte timeout in seconds for API calls.
connect_timeout_secondsOptional connection-establishment timeout in seconds for API calls.
idle_timeout_secondsOptional stall timeout in seconds for API calls.
enable_caching()Enable or disable prompt caching.
AnthropicProvider$enable_caching(enable = TRUE)
enableLogical.
language_model()Create a language model.
AnthropicProvider$language_model(model_id = "claude-sonnet-4-20250514")
model_idThe model ID (e.g., "claude-sonnet-4-20250514", "claude-3-5-sonnet-20241022").
An AnthropicLanguageModel object.
clone()The objects of this class are cloneable with this method.
AnthropicProvider$clone(deep = FALSE)
deepWhether to make a deep clone.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.