---
title: "Anthropic Plugin"
description: "Claude models integration for elizaOS"
---


The Anthropic plugin provides access to Claude models for text generation. Note that it does not support embeddings, so you'll need a fallback plugin.

## Features

- **Claude 3 models** - Access to Claude 3 Opus, Sonnet, and Haiku
- **Long context** - Up to 200k tokens context window
- **XML formatting** - Optimized for structured responses
- **Safety features** - Built-in content moderation

## Installation

```bash
elizaos plugins add @elizaos/plugin-anthropic
```

## Configuration

### Environment Variables

```bash
# Required
ANTHROPIC_API_KEY=sk-ant-...

# Optional model configuration
# You can use any available Anthropic model
ANTHROPIC_SMALL_MODEL=claude-3-haiku-20240307      # Default: claude-3-haiku-20240307
ANTHROPIC_LARGE_MODEL=claude-3-5-sonnet-latest     # Default: claude-3-5-sonnet-latest

# Examples of other available models:
# ANTHROPIC_SMALL_MODEL=claude-3-haiku-20240307
# ANTHROPIC_LARGE_MODEL=claude-3-opus-20240229
# ANTHROPIC_LARGE_MODEL=claude-3-5-sonnet-20241022
# ANTHROPIC_LARGE_MODEL=claude-3-5-haiku-20241022
```

### Character Configuration

```json
{
  "name": "MyAgent",
  "plugins": [
    "@elizaos/plugin-anthropic",
    "@elizaos/plugin-openai"  // For embeddings
  ]
}
```

## Supported Operations

| Operation | Support | Notes |
|-----------|---------|-------|
| TEXT_GENERATION | ✅ | All Claude models |
| EMBEDDING | ❌ | Use fallback plugin |
| OBJECT_GENERATION | ✅ | Via XML formatting |

## Important: Embedding Fallback

Since Anthropic doesn't provide embedding models, always include a fallback:

```json
{
  "plugins": [
    "@elizaos/plugin-anthropic",  // Primary for text
    "@elizaos/plugin-openai"       // Fallback for embeddings
  ]
}
```

## Model Configuration

The plugin uses two model categories:

- **SMALL_MODEL**: For faster, cost-effective responses
- **LARGE_MODEL**: For complex reasoning and best quality

You can use any available Claude model, including:
- Claude 3.5 Sonnet (latest and dated versions)
- Claude 3 Opus, Sonnet, and Haiku
- Claude 3.5 Haiku
- Any new models Anthropic releases

## Usage Tips

1. **XML Templates** - Claude excels at XML-formatted responses
2. **System Prompts** - Effective for character personality
3. **Context Management** - Leverage the 200k token window

## External Resources

- [Plugin Source](https://github.com/elizaos/eliza/tree/main/packages/plugin-anthropic)
- [Anthropic API Documentation](https://docs.anthropic.com)
- [Model Comparison](https://docs.anthropic.com/claude/docs/models-overview)