Skip to main content

Anthropic Provider

The Anthropic provider enables you to use Claude models for advanced text generation, reasoning, and tool calling capabilities.

Installation

Setup

Get your API key from Anthropic’s Console and set it as an environment variable:

Usage

Basic Text Generation

Streaming Responses

Structured Output

Configuration

Custom Provider Instance

Provider Options

  • apiKey: Your Anthropic API key (defaults to ANTHROPIC_API_KEY env var)
  • baseURL: Custom API endpoint URL
  • headers: Custom headers for requests

Available Models

Claude 3.5 Family

  • claude-3-5-sonnet-20241022 - Most capable Claude 3.5 model
  • claude-3-5-haiku-20241022 - Fastest Claude 3.5 model

Claude 3 Family

  • claude-3-opus-20240229 - Most powerful model
  • claude-3-sonnet-20240229 - Balanced performance
  • claude-3-haiku-20240307 - Fast and cost-effective

Advanced Features

Tool Calling

Vision

PDF Support

Prompt Caching

Reasoning Models

Model Capabilities

Resources