> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Anthropic Provider

> Use Anthropic Claude models with PraisonAI TypeScript

```mermaid theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
graph LR
    U[Input] --> A[Agent]
    A --> O[Output]

    classDef agent fill:#8B0000,color:#fff
    classDef tool fill:#189AB4,color:#fff

    class A agent
    class U,O tool
```

# Anthropic Provider

Use Anthropic's Claude models including Claude 4, Claude 3.5 Sonnet, and Claude 3 Opus.

## Environment Variables

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
export ANTHROPIC_API_KEY=sk-ant-...
```

| Variable | Required | Description |
| - | - | - |
| `ANTHROPIC_API_KEY` | Yes | Your Anthropic API key |

## Supported Modalities

| Modality | Supported |
| - | - |
| Text/Chat | ✅ |
| Embeddings | ❌ |
| Image | ✅ |
| Audio | ❌ |
| Speech | ❌ |
| Tools | ✅ |

## Quick Start

**1. Simple Usage**

```typescript theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
import { Agent } from 'praisonai';

const agent = new Agent({
  name: 'Claude',
  instructions: 'You are a helpful assistant.',
  llm: 'anthropic/claude-sonnet-4-20250514'
});

const response = await agent.chat('Hello!');
console.log(response);
```

**2. With Configuration**

Adjust provider credentials and model settings for production — see the sections above.

## Available Models

| Model | Description | Context |
| - | - | - |
| `claude-sonnet-4-20250514` | Latest Claude 4 Sonnet | 200K |
| `claude-opus-4-5` | Most capable | 200K |
| `claude-3-5-sonnet-20241022` | Claude 3.5 Sonnet | 200K |
| `claude-3-opus-20240229` | Claude 3 Opus | 200K |
| `claude-3-haiku-20240307` | Fast, efficient | 200K |

## Advanced Configuration

```typescript theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
import { Agent } from 'praisonai';

const agent = new Agent({
  name: 'AnalystClaude',
  instructions: 'You are an expert analyst.',
  llm: 'anthropic/claude-sonnet-4-20250514',
  llmConfig: {
    temperature: 0.7,
    maxTokens: 8192,
  }
});
```

## With Tools

```typescript theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
import { Agent } from 'praisonai';

const calculatorTool = {
  name: 'calculator',
  description: 'Perform calculations',
  parameters: {
    type: 'object',
    properties: {
      expression: { type: 'string', description: 'Math expression' }
    },
    required: ['expression']
  },
  execute: async ({ expression }) => {
    return eval(expression).toString();
  }
};

const agent = new Agent({
  name: 'MathClaude',
  instructions: 'Help with calculations.',
  llm: 'anthropic/claude-sonnet-4-20250514',
  tools: [calculatorTool]
});
```

## Vision (Image Input)

```typescript theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
import { Agent } from 'praisonai';

const agent = new Agent({
  name: 'VisionClaude',
  instructions: 'Analyze images.',
  llm: 'anthropic/claude-sonnet-4-20250514'
});

const response = await agent.chat({
  content: 'What is in this image?',
  images: ['https://example.com/image.jpg']
});
```

## Streaming

```typescript theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
import { Agent } from 'praisonai';

const agent = new Agent({
  name: 'StreamClaude',
  instructions: 'You are helpful.',
  llm: 'anthropic/claude-sonnet-4-20250514'
});

for await (const chunk of agent.stream('Tell me a story')) {
  process.stdout.write(chunk);
}
```

## Multi-Agent Workflow

```typescript theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
import { Agent, AgentTeam } from 'praisonai';

const researcher = new Agent({
  name: 'Researcher',
  instructions: 'Research topics thoroughly.',
  llm: 'anthropic/claude-sonnet-4-20250514'
});

const writer = new Agent({
  name: 'Writer',
  instructions: 'Write clear summaries.',
  llm: 'anthropic/claude-3-haiku-20240307'
});

const agents = new AgentTeam({
  agents: [researcher, writer],
  tasks: [
    { agent: researcher, description: 'Research {topic}' },
    { agent: writer, description: 'Summarize the research' }
  ]
});

const result = await agents.start({ topic: 'quantum computing' });
```

## Troubleshooting

### Invalid API Key

```
Error: Authentication failed
```

**Solution**: Verify your `ANTHROPIC_API_KEY` starts with `sk-ant-`.

### Rate Limits

```
Error: Rate limit exceeded
```

**Solution**: Implement retry logic or contact Anthropic for higher limits.

### Model Not Found

```
Error: Model not found
```

**Solution**: Check the model name includes the date suffix (e.g., `claude-sonnet-4-20250514`).

## Related

> [card] [Anthropic CLI Usage](https://praison.ai/docs/js/providers/anthropic-cli.md)
>
> Anthropic CLI Usage

> [card] [Providers Overview](https://praison.ai/docs/js/providers.md)
>
> Providers Overview


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.