Overview
The Anthropic provider gives you access to Claude models with advanced reasoning capabilities through adaptive and manual thinking modes.Installation
createAnthropic()
Create an Anthropic provider instance.Options
Your Anthropic API key. Defaults to
ANTHROPIC_API_KEY environment variable.Custom base URL for API requests.
Default maximum tokens for completions. Can be overridden per request.
Provide your own configured Anthropic client instance.
Returns
AnthropicProvider with method chatModel().
Supported models
Claude 4.6 (adaptive thinking)
Claude 4.6 (adaptive thinking)
Latest generation with adaptive thinking mode.
- claude-opus-4-6 - Most capable, supports max effort
- claude-sonnet-4-6 - Balanced performance and speed
Claude 4.5 (manual thinking)
Claude 4.5 (manual thinking)
Previous generation with manual thinking budget control.
- claude-opus-4-5 - High capability
- claude-sonnet-4-5 - Efficient reasoning
- claude-haiku-4-5 - Fast and lightweight
Claude 4 and earlier
Claude 4 and earlier
- claude-opus-4-1 - Enhanced reasoning
- claude-opus-4 - Strong performance
- claude-sonnet-4 - Balanced model
- claude-sonnet-3-7 - Previous generation
Capabilities
| Feature | Support |
|---|---|
| Chat Completion | Yes |
| Streaming | Yes |
| Function Calling | Yes |
| Vision | Yes |
| Reasoning | Yes |
| Prompt Caching | Yes |
| Embeddings | No |
| Image Generation | No |
Examples
Basic chat
Extended thinking
Streaming
Tool calling
Vision and file inputs
Anthropic accepts image parts and PDF file parts. Other file MIME types are rejected.
Thinking modes
Adaptive thinking (Claude 4.6)
The model automatically determines thinking depth based on the effort level.Only
claude-opus-4-6 supports 'max' effort directly. On claude-sonnet-4-6, 'max' is clamped to 'high'.Manual thinking budget (Claude 4.5 and earlier)
Token budgets:minimal -> 1,024, low -> 2,048, medium -> 8,192, high -> 32,768, max -> 65,536.
Reasoning restrictions
When reasoning is enabled, Anthropic enforces additional request constraints:temperaturemust be omittedtopPmust be between0.95and1toolChoicemust be'auto'or'none'providerOptions.anthropic.topKmust be omitted
When you combine reasoning with tools, the adapter automatically adds the
interleaved-thinking-2025-05-14 beta.Reasoning metadata
When reasoning is enabled, Anthropic reasoning parts include provider metadata with signature and redacted data fields. UsegetProviderMetadata to access them in a type-safe way.
AnthropicReasoningMetadata type contains:
signature— cryptographic signature for multi-turn reasoning fidelityredactedData— redacted thinking content, if present
Provider-specific options
Options are namespaced underanthropic in providerOptions:
topK, stopSequences, betas, outputConfig, cacheControl.
Prompt caching
UsecacheControl to enable Anthropic prompt caching. This maps to Anthropic’s top-level cache_control request field and uses automatic caching for the reusable prompt prefix.
result.usage.inputTokenDetails:
cacheReadTokens: Tokens served from an existing cache entrycacheWriteTokens: Tokens written to the cache for future requests
- 1024 tokens for Claude Sonnet 4.5, Claude Opus 4.1, Claude Opus 4, Claude Sonnet 4, and Claude Sonnet 3.7
- 2048 tokens for Claude Sonnet 4.6
- 4096 tokens for Claude Opus 4.6, Claude Opus 4.5, and Claude Haiku 4.5
Error handling
Related
OpenAI Provider
GPT models with reasoning capabilities
Google GenAI Provider
Gemini models with multimodal support
Chat Completion Guide
Learn how to use chat completion