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