| 1 | --- |
| 2 | title: Anthropic |
| 3 | slug: ../anthropic |
| 4 | --- |
| 5 | |
| 6 | <Info> |
| 7 | You can get an API key from the [Anthropic |
| 8 | console](https://console.anthropic.com/account/keys). |
| 9 | </Info> |
| 10 | |
| 11 | ## Chat model |
| 12 | |
| 13 | We recommend configuring **Claude 4 Sonnet** as your chat model. |
| 14 | |
| 15 | <Tabs> |
| 16 | <Tab title="YAML"> |
| 17 | ```yaml title="config.yaml" |
| 18 | models: |
| 19 | - name: Claude 4 Sonnet |
| 20 | provider: anthropic |
| 21 | model: claude-sonnet-4-20250514 |
| 22 | apiKey: <YOUR_ANTHROPIC_API_KEY> |
| 23 | ``` |
| 24 | </Tab> |
| 25 | <Tab title="JSON"> |
| 26 | ```json title="config.json" |
| 27 | { |
| 28 | "models": [ |
| 29 | { |
| 30 | "title": "Claude 4 Sonnet", |
| 31 | "provider": "anthropic", |
| 32 | "model": "claude-sonnet-4-latest", |
| 33 | "apiKey": "<YOUR_ANTHROPIC_API_KEY>" |
| 34 | } |
| 35 | ] |
| 36 | } |
| 37 | ``` |
| 38 | </Tab> |
| 39 | </Tabs> |
| 40 | |
| 41 | ## Autocomplete model |
| 42 | |
| 43 | Anthropic currently does not offer any autocomplete models. |
| 44 | |
| 45 | [Click here](../../model-roles/autocomplete.md) to see a list of autocomplete model providers. |
| 46 | |
| 47 | ## Embeddings model |
| 48 | |
| 49 | Anthropic currently does not offer any embeddings models. |
| 50 | |
| 51 | [Click here](../../model-roles/embeddings.mdx) to see a list of embeddings model providers. |
| 52 | |
| 53 | ## Reranking model |
| 54 | |
| 55 | Anthropic currently does not offer any reranking models. |
| 56 | |
| 57 | [Click here](../../model-roles/reranking.mdx) to see a list of reranking model providers. |
| 58 | |
| 59 | ## Prompt caching |
| 60 | |
| 61 | Anthropic supports [prompt caching with Claude](https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching), which allows Claude models to cache system messages and conversation history between requests to improve performance and reduce costs. |
| 62 | |
| 63 | Prompt caching is generally available for: |
| 64 | |
| 65 | - Claude 4 Sonnet |
| 66 | - Claude 3.7 Sonnet |
| 67 | - Claude 3.5 Sonnet |
| 68 | - Claude 3.5 Haiku |
| 69 | |
| 70 | To enable caching of the system message and the turn-by-turn conversation, update your model configuration as follows: |
| 71 | |
| 72 | <Tabs> |
| 73 | <Tab title="YAML"> |
| 74 | ```yaml title="config.yaml" |
| 75 | models: |
| 76 | - name: Anthropic |
| 77 | provider: anthropic |
| 78 | model: claude-sonnet-4-20250514 |
| 79 | apiKey: <YOUR_ANTHROPIC_API_KEY> |
| 80 | roles: |
| 81 | - chat |
| 82 | defaultCompletionOptions: |
| 83 | promptCaching: true |
| 84 | ``` |
| 85 | </Tab> |
| 86 | <Tab title="JSON"> |
| 87 | ```json title="config.json" |
| 88 | { |
| 89 | "models": [ |
| 90 | { |
| 91 | "cacheBehavior": { |
| 92 | "cacheSystemMessage": true, |
| 93 | "cacheConversation": true |
| 94 | }, |
| 95 | "title": "Anthropic", |
| 96 | "provider": "anthropic", |
| 97 | "model": "claude-sonnet-4-latest", |
| 98 | "defaultCompletionOptions": { |
| 99 | "promptCaching": true |
| 100 | }, |
| 101 | "apiKey": "<YOUR_ANTHROPIC_API_KEY>" |
| 102 | } |
| 103 | ] |
| 104 | } |
| 105 | ``` |
| 106 | </Tab> |
| 107 | </Tabs> |