1# Configuring the Assistant
2
3## Providers {#providers}
4
5The following providers are supported:
6
7- [Zed AI (Configured by default when signed in)](#zed-ai)
8- [Anthropic](#anthropic)
9- [GitHub Copilot Chat](#github-copilot-chat) [^1]
10- [Google AI](#google-ai) [^1]
11- [Ollama](#ollama)
12- [OpenAI](#openai)
13
14To configure different providers, run `assistant: show configuration` in the command palette, or click on the hamburger menu at the top-right of the assistant panel and select "Configure".
15
16[^1]: This provider does not support the [`/workflow`](./commands#workflow-not-generally-available) command.
17
18To further customize providers, you can use `settings.json` to do that as follows:
19
20- [Configuring endpoints](#custom-endpoint)
21- [Configuring timeouts](#provider-timeout)
22- [Configuring default model](#default-model)
23
24### Zed AI {#zed-ai}
25
26A hosted service providing convenient and performant support for AI-enabled coding in Zed, powered by Anthropic's Claude 3.5 Sonnet and accessible just by signing in.
27
28### Anthropic {#anthropic}
29
30You can use Claude 3.5 Sonnet via [Zed AI](#zed-ai) for free. To use other Anthropic models you will need to configure it by providing your own API key.
31
321. Sign up for Anthropic and [create an API key](https://console.anthropic.com/settings/keys)
332. Make sure that your Anthropic account has credits
343. Open the configuration view (`assistant: show configuration`) and navigate to the Anthropic section
354. Enter your Anthropic API key
36
37Even if you pay for Claude Pro, you will still have to [pay for additional credits](https://console.anthropic.com/settings/plans) to use it via the API.
38
39Zed will also use the `ANTHROPIC_API_KEY` environment variable if it's defined.
40
41#### Anthropic Custom Models {#anthropic-custom-models}
42
43You can add custom models to the Anthropic provider by adding the following to your Zed `settings.json`:
44
45```json
46{
47 "language_models": {
48 "anthropic": {
49 "available_models": [
50 {
51 "name": "some-model",
52 "display_name": "some-model",
53 "max_tokens": 128000,
54 "max_output_tokens": 2560,
55 "cache_configuration": {
56 "max_cache_anchors": 10,
57 "min_total_token": 10000,
58 "should_speculate": false
59 },
60 "tool_override": "some-model-that-supports-toolcalling"
61 }
62 ]
63 }
64 }
65}
66```
67
68Custom models will be listed in the model dropdown in the assistant panel.
69
70### GitHub Copilot Chat {#github-copilot-chat}
71
72You can use GitHub Copilot chat with the Zed assistant by choosing it via the model dropdown in the assistant panel.
73
74### Google AI {#google-ai}
75
76You can use Gemini 1.5 Pro/Flash with the Zed assistant by choosing it via the model dropdown in the assistant panel.
77
781. Go the Google AI Studio site and [create an API key](https://aistudio.google.com/app/apikey).
792. Open the configuration view (`assistant: show configuration`) and navigate to the Google AI section
803. Enter your Google AI API key
81
82The Google AI API key will be saved in your keychain.
83
84Zed will also use the `GOOGLE_AI_API_KEY` environment variable if it's defined.
85
86#### Google AI custom models {#google-ai-custom-models}
87
88You can add custom models to the Google AI provider by adding the following to your Zed `settings.json`:
89
90```json
91{
92 "language_models": {
93 "google": {
94 "available_models": [
95 {
96 "name": "custom-model",
97 "max_tokens": 128000
98 }
99 ]
100 }
101 }
102}
103```
104
105Custom models will be listed in the model dropdown in the assistant panel.
106
107### Ollama {#ollama}
108
109Download and install Ollama from [ollama.com/download](https://ollama.com/download) (Linux or macOS) and ensure it's running with `ollama --version`.
110
111You can use Ollama with the Zed assistant by making Ollama appear as an OpenAPI endpoint.
112
1131. Download, for example, the `mistral` model with Ollama:
114
115 ```sh
116 ollama pull mistral
117 ```
118
1192. Make sure that the Ollama server is running. You can start it either via running the Ollama app, or launching:
120
121 ```sh
122 ollama serve
123 ```
124
1253. In the assistant panel, select one of the Ollama models using the model dropdown.
1264. (Optional) If you want to change the default URL that is used to access the Ollama server, you can do so by adding the following settings:
127
128```json
129{
130 "language_models": {
131 "ollama": {
132 "api_url": "http://localhost:11434"
133 }
134 }
135}
136```
137
138### OpenAI {#openai}
139
1401. Visit the OpenAI platform and [create an API key](https://platform.openai.com/account/api-keys)
1412. Make sure that your OpenAI account has credits
1423. Open the configuration view (`assistant: show configuration`) and navigate to the OpenAI section
1434. Enter your OpenAI API key
144
145The OpenAI API key will be saved in your keychain.
146
147Zed will also use the `OPENAI_API_KEY` environment variable if it's defined.
148
149#### OpenAI Custom Models {#openai-custom-models}
150
151You can add custom models to the OpenAI provider, by adding the following to your Zed `settings.json`:
152
153```json
154{
155 "language_models": {
156 "openai": {
157 "version": "1",
158 "available_models": [
159 {
160 "name": "custom-model",
161 "max_tokens": 128000
162 }
163 ]
164 }
165 }
166}
167```
168
169Custom models will be listed in the model dropdown in the assistant panel.
170
171### Advanced configuration {#advanced-configuration}
172
173#### Example Configuration
174
175```json
176{
177 "assistant": {
178 "enabled": true,
179 "default_model": {
180 "provider": "zed.dev",
181 "model": "claude-3-5-sonnet"
182 },
183 "version": "2",
184 "button": true,
185 "default_width": 480,
186 "dock": "right"
187 }
188}
189```
190
191#### Custom endpoints {#custom-endpoint}
192
193You can use a custom API endpoint for different providers, as long as it's compatible with the providers API structure.
194
195To do so, add the following to your Zed `settings.json`:
196
197```json
198{
199 "language_models": {
200 "some-provider": {
201 "api_url": "http://localhost:11434/v1"
202 }
203 }
204}
205```
206
207Where `some-provider` can be any of the following values: `anthropic`, `google`, `ollama`, `openai`.
208
209#### Custom timeout {#provider-timeout}
210
211You can customize the timeout that's used for LLM requests, by adding the following to your Zed `settings.json`:
212
213```json
214{
215 "language_models": {
216 "some-provider": {
217 "low_speed_timeout_in_seconds": 10
218 }
219 }
220}
221```
222
223Where `some-provider` can be any of the following values: `anthropic`, `copilot_chat`, `google`, `ollama`, `openai`.
224
225#### Configuring the default model {#default-model}
226
227The default model can be set via the model dropdown in the assistant panel's top-right corner. Selecting a model saves it as the default.
228You can also manually edit the `default_model` object in your settings:
229
230```json
231{
232 "assistant": {
233 "version": "2",
234 "default_model": {
235 "provider": "zed.dev",
236 "model": "claude-3-5-sonnet"
237 }
238 }
239}
240```
241
242#### Common Panel Settings
243
244| key | type | default | description |
245| -------------- | ------- | ------- | ------------------------------------------------------------------------------------- |
246| enabled | boolean | true | Setting this to `false` will completely disable the assistant |
247| button | boolean | true | Show the assistant icon in the status bar |
248| dock | string | "right" | The default dock position for the assistant panel. Can be ["left", "right", "bottom"] |
249| default_height | string | null | The pixel height of the assistant panel when docked to the bottom |
250| default_width | string | null | The pixel width of the assistant panel when docked to the left or right |