Elffuss BraidHub

kikocis/continue public

main · 2.1 KiBRawPermalink
1---
2title: "How to Configure Anthropic Claude Models with Continue"
3slug: ../anthropic
4sidebarTitle: "Anthropic"
5---
6
7<Tip>
8 **Discover Anthropic models [here](https://hub.continue.dev/anthropic)**
9</Tip>
10
11<Info>
12 Get an API key from the [Anthropic Console](https://console.anthropic.com/account/keys)
13</Info>
14
15## Configuration
16
17<Tabs>
18 <Tab title="YAML">
19 ```yaml title="config.yaml"
20 models:
21 - name: <MODEL_NAME>
22 provider: anthropic
23 model: <MODEL_ID>
24 apiKey: <YOUR_ANTHROPIC_API_KEY>
25 ```
26 </Tab>
27 <Tab title="JSON (Deprecated)">
28 ```json title="config.json"
29 {
30 "models": [
31 {
32 "title": "<MODEL_NAME>",
33 "provider": "anthropic",
34 "model": "<MODEL_ID>",
35 "apiKey": "<YOUR_ANTHROPIC_API_KEY>"
36 }
37 ]
38 }
39 ```
40 </Tab>
41</Tabs>
42
43<Info>
44 **Check out a more advanced configuration [here](https://hub.continue.dev/anthropic/claude-4-sonnet?view=config)**
45</Info>
46
47## How to Enable Prompt Caching with Claude
48
49Anthropic 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.
50
51To enable caching of the system message and the turn-by-turn conversation, update your model configuration as follows:
52
53<Tabs>
54 <Tab title="YAML">
55 ```yaml title="config.yaml"
56 models:
57 - name: <MODEL_NAME>
58 provider: anthropic
59 model: <MODEL_ID>
60 apiKey: <YOUR_ANTHROPIC_API_KEY>
61 roles:
62 - chat
63 defaultCompletionOptions:
64 promptCaching: true
65 ```
66 </Tab>
67 <Tab title="JSON (Deprecated)">
68 ```json title="config.json"
69 {
70 "models": [
71 {
72 "cacheBehavior": {
73 "cacheSystemMessage": true,
74 "cacheConversation": true
75 },
76 "title": "<MODEL_NAME>",
77 "provider": "anthropic",
78 "model": "<MODEL_ID>",
79 "defaultCompletionOptions": {
80 "promptCaching": true
81 },
82 "apiKey": "<YOUR_ANTHROPIC_API_KEY>"
83 }
84 ]
85 }
86 ```
87 </Tab>
88</Tabs>