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 Fable and Mythos (adaptive thinking)
Claude Fable and Mythos (adaptive thinking)
Claude Fable and Mythos models use adaptive thinking mode.
- claude-fable-5 - Widely available model for demanding reasoning and agentic work
- claude-mythos-5 - Limited-access model with the same capability handling
- claude-mythos-preview - Limited-access preview model
Claude Opus and Sonnet (adaptive thinking)
Claude Opus and Sonnet (adaptive thinking)
Current Opus and Sonnet models use effort-based adaptive thinking.
- claude-sonnet-5 - Most agentic Sonnet model with near-Opus performance at lower cost
- claude-opus-4-8 - Opus model for complex reasoning and agentic coding
- claude-opus-4-7 - Opus model with max effort support
- claude-opus-4-6 - Opus model with max effort support
- claude-sonnet-4-6 - Balanced performance and speed with max effort support
Claude 4.5 (manual thinking)
Claude 4.5 (manual thinking)
Models 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 |
ChatModel.capabilities or getAnthropicModelCapabilities(modelId) to inspect reasoning support at runtime:
restrictsSamplingParams is true, do not set temperature (and keep topP in the allowed range) while reasoning is enabled.
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
The model automatically determines thinking depth based on the effort level.claude-fable-5, claude-mythos-5, claude-mythos-preview,
claude-opus-4-8, claude-opus-4-7, claude-opus-4-6, claude-sonnet-5,
and claude-sonnet-4-6 support 'max' effort directly.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 Opus 4.8
- 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