View source: R/provider_anthropic.R
| create_anthropic | R Documentation |
Factory function to create an Anthropic provider.
create_anthropic(
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_key |
Anthropic API key. Defaults to ANTHROPIC_API_KEY env var. |
base_url |
Base URL for API calls. Defaults to https://api.anthropic.com/v1. |
api_version |
Anthropic API version header. Defaults to "2023-06-01". |
headers |
Optional additional headers. |
name |
Optional provider name override. |
timeout_seconds |
Legacy alias for |
total_timeout_seconds |
Optional total request timeout in seconds for API calls. |
first_byte_timeout_seconds |
Optional time-to-first-byte timeout in seconds for API calls. |
connect_timeout_seconds |
Optional connection-establishment timeout in seconds for API calls. |
idle_timeout_seconds |
Optional stall timeout in seconds for API calls. |
An AnthropicProvider object.
claude-opus-4-7: Anthropic's most capable model for complex reasoning and coding. (Reasoning, Vision, Tools, Structured) | ctx: 1000k
claude-opus-4-6: Previous generation of Claude Opus with 1M context. (Reasoning, Vision, Tools, Structured) | ctx: 1000k
claude-opus-4-5: Claude Opus 4.5 with 200K context. (Reasoning, Vision, Tools, Structured) | ctx: 200k
claude-sonnet-4-6: Balanced model for coding and agentic workflows with 1M context. (Reasoning, Vision, Tools, Structured) | ctx: 1000k
claude-sonnet-4-5: Claude Sonnet 4.5 with 200K context. (Reasoning, Vision, Tools, Structured) | ctx: 200k
claude-sonnet-4: Original Claude Sonnet 4 with 200K context. (Reasoning, Vision, Tools, Structured) | ctx: 200k
claude-haiku-4-5: Fast and cost-effective model for simple tasks and chatbots. (Vision, Tools, Structured) | ctx: 200k
if (interactive()) {
anthropic <- create_anthropic(api_key = "sk-ant-...")
model <- anthropic$language_model("claude-sonnet-4-20250514")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.