configuration.md

  1# Configuration
  2
  3There are various aspects about the Agent Panel that you can customize.
  4All of them can be seen by either visiting [the Configuring Zed page](../configuring-zed.md#agent) or by running the `zed: open default settings` action and searching for `"agent"`.
  5Alternatively, you can also visit the panel's Settings view by running the `agent: open configuration` action or going to the top-right menu and hitting "Settings".
  6
  7## LLM Providers
  8
  9Zed supports multiple large language model providers.
 10Here's an overview of the supported providers and tool call support:
 11
 12| Provider                                        | Tool Use Supported                                                                                                                                                          |
 13| ----------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
 14| [Amazon Bedrock](#amazon-bedrock)               | Depends on the model                                                                                                                                                        |
 15| [Anthropic](#anthropic)                         | ✅                                                                                                                                                                          |
 16| [DeepSeek](#deepseek)                           | 🚫                                                                                                                                                                          |
 17| [GitHub Copilot Chat](#github-copilot-chat)     | For Some Models ([link](https://github.com/zed-industries/zed/blob/9e0330ba7d848755c9734bf456c716bddf0973f3/crates/language_models/src/provider/copilot_chat.rs#L189-L198)) |
 18| [Google AI](#google-ai)                         | ✅                                                                                                                                                                          |
 19| [LM Studio](#lmstudio)                          | ✅                                                                                                                                                                          |
 20| [Mistral](#mistral)                             | ✅                                                                                                                                                                          |
 21| [Ollama](#ollama)                               | ✅                                                                                                                                                                          |
 22| [OpenAI](#openai)                               | ✅                                                                                                                                                                          |
 23| [OpenAI API Compatible](#openai-api-compatible) | 🚫                                                                                                                                                                          |
 24
 25## Use Your Own Keys {#use-your-own-keys}
 26
 27While Zed offers hosted versions of models through [our various plans](/ai/plans-and-usage), we're always happy to support users wanting to supply their own API keys.
 28Below, you can learn how to do that for each provider.
 29
 30> Using your own API keys is _free_—you do not need to subscribe to a Zed plan to use our AI features with your own keys.
 31
 32### Amazon Bedrock {#amazon-bedrock}
 33
 34> ✅ Supports tool use with models that support streaming tool use.
 35> More details can be found in the [Amazon Bedrock's Tool Use documentation](https://docs.aws.amazon.com/bedrock/latest/userguide/conversation-inference-supported-models-features.html).
 36
 37To use Amazon Bedrock's models, an AWS authentication is required.
 38Ensure your credentials have the following permissions set up:
 39
 40- `bedrock:InvokeModelWithResponseStream`
 41- `bedrock:InvokeModel`
 42- `bedrock:ConverseStream`
 43
 44Your IAM policy should look similar to:
 45
 46```json
 47{
 48  "Version": "2012-10-17",
 49  "Statement": [
 50    {
 51      "Effect": "Allow",
 52      "Action": [
 53        "bedrock:InvokeModel",
 54        "bedrock:InvokeModelWithResponseStream",
 55        "bedrock:ConverseStream"
 56      ],
 57      "Resource": "*"
 58    }
 59  ]
 60}
 61```
 62
 63With that done, choose one of the two authentication methods:
 64
 65#### Authentication via Named Profile (Recommended)
 66
 671. Ensure you have the AWS CLI installed and configured with a named profile
 682. Open your `settings.json` (`zed: open settings`) and include the `bedrock` key under `language_models` with the following settings:
 69   ```json
 70   {
 71     "language_models": {
 72       "bedrock": {
 73         "authentication_method": "named_profile",
 74         "region": "your-aws-region",
 75         "profile": "your-profile-name"
 76       }
 77     }
 78   }
 79   ```
 80
 81#### Authentication via Static Credentials
 82
 83While it's possible to configure through the Agent Panel settings UI by entering your AWS access key and secret directly, we recommend using named profiles instead for better security practices.
 84To do this:
 85
 861. Create an IAM User that you can assume in the [IAM Console](https://us-east-1.console.aws.amazon.com/iam/home?region=us-east-1#/users).
 872. Create security credentials for that User, save them and keep them secure.
 883. Open the Agent Configuration with (`agent: open configuration`) and go to the Amazon Bedrock section
 894. Copy the credentials from Step 2 into the respective **Access Key ID**, **Secret Access Key**, and **Region** fields.
 90
 91#### Cross-Region Inference
 92
 93The Zed implementation of Amazon Bedrock uses [Cross-Region inference](https://docs.aws.amazon.com/bedrock/latest/userguide/cross-region-inference.html) for all the models and region combinations that support it.
 94With Cross-Region inference, you can distribute traffic across multiple AWS Regions, enabling higher throughput.
 95
 96For example, if you use `Claude Sonnet 3.7 Thinking` from `us-east-1`, it may be processed across the US regions, namely: `us-east-1`, `us-east-2`, or `us-west-2`.
 97Cross-Region inference requests are kept within the AWS Regions that are part of the geography where the data originally resides.
 98For example, a request made within the US is kept within the AWS Regions in the US.
 99
100Although the data remains stored only in the source Region, your input prompts and output results might move outside of your source Region during cross-Region inference.
101All data will be transmitted encrypted across Amazon's secure network.
102
103We will support Cross-Region inference for each of the models on a best-effort basis, please refer to the [Cross-Region Inference method Code](https://github.com/zed-industries/zed/blob/main/crates/bedrock/src/models.rs#L297).
104
105For the most up-to-date supported regions and models, refer to the [Supported Models and Regions for Cross Region inference](https://docs.aws.amazon.com/bedrock/latest/userguide/inference-profiles-support.html).
106
107### Anthropic {#anthropic}
108
109> ✅ Supports tool use
110
111You can use Anthropic models by choosing it via the model dropdown in the Agent Panel.
112
1131. Sign up for Anthropic and [create an API key](https://console.anthropic.com/settings/keys)
1142. Make sure that your Anthropic account has credits
1153. Open the settings view (`agent: open configuration`) and go to the Anthropic section
1164. Enter your Anthropic API key
117
118Even 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.
119
120Zed will also use the `ANTHROPIC_API_KEY` environment variable if it's defined.
121
122#### Custom Models {#anthropic-custom-models}
123
124You can add custom models to the Anthropic provider by adding the following to your Zed `settings.json`:
125
126```json
127{
128  "language_models": {
129    "anthropic": {
130      "available_models": [
131        {
132          "name": "claude-3-5-sonnet-20240620",
133          "display_name": "Sonnet 2024-June",
134          "max_tokens": 128000,
135          "max_output_tokens": 2560,
136          "cache_configuration": {
137            "max_cache_anchors": 10,
138            "min_total_token": 10000,
139            "should_speculate": false
140          },
141          "tool_override": "some-model-that-supports-toolcalling"
142        }
143      ]
144    }
145  }
146}
147```
148
149Custom models will be listed in the model dropdown in the Agent Panel.
150
151You can configure a model to use [extended thinking](https://docs.anthropic.com/en/docs/about-claude/models/extended-thinking-models) (if it supports it) by changing the mode in your model's configuration to `thinking`, for example:
152
153```json
154{
155  "name": "claude-sonnet-4-latest",
156  "display_name": "claude-sonnet-4-thinking",
157  "max_tokens": 200000,
158  "mode": {
159    "type": "thinking",
160    "budget_tokens": 4_096
161  }
162}
163```
164
165### DeepSeek {#deepseek}
166
167> 🚫 Does not support tool use
168
1691. Visit the DeepSeek platform and [create an API key](https://platform.deepseek.com/api_keys)
1702. Open the settings view (`agent: open configuration`) and go to the DeepSeek section
1713. Enter your DeepSeek API key
172
173The DeepSeek API key will be saved in your keychain.
174
175Zed will also use the `DEEPSEEK_API_KEY` environment variable if it's defined.
176
177#### Custom Models {#deepseek-custom-models}
178
179The Zed Assistant comes pre-configured to use the latest version for common models (DeepSeek Chat, DeepSeek Reasoner). If you wish to use alternate models or customize the API endpoint, you can do so by adding the following to your Zed `settings.json`:
180
181```json
182{
183  "language_models": {
184    "deepseek": {
185      "api_url": "https://api.deepseek.com",
186      "available_models": [
187        {
188          "name": "deepseek-chat",
189          "display_name": "DeepSeek Chat",
190          "max_tokens": 64000
191        },
192        {
193          "name": "deepseek-reasoner",
194          "display_name": "DeepSeek Reasoner",
195          "max_tokens": 64000,
196          "max_output_tokens": 4096
197        }
198      ]
199    }
200  }
201}
202```
203
204Custom models will be listed in the model dropdown in the Agent Panel. You can also modify the `api_url` to use a custom endpoint if needed.
205
206### GitHub Copilot Chat {#github-copilot-chat}
207
208> ✅ Supports tool use in some cases.
209> Visit [the Copilot Chat code](https://github.com/zed-industries/zed/blob/9e0330ba7d848755c9734bf456c716bddf0973f3/crates/language_models/src/provider/copilot_chat.rs#L189-L198) for the supported subset.
210
211You can use GitHub Copilot chat with the Zed assistant by choosing it via the model dropdown in the Agent Panel.
212
213### Google AI {#google-ai}
214
215> ✅ Supports tool use
216
217You can use Gemini 1.5 Pro/Flash with the Zed assistant by choosing it via the model dropdown in the Agent Panel.
218
2191. Go to the Google AI Studio site and [create an API key](https://aistudio.google.com/app/apikey).
2202. Open the settings view (`agent: open configuration`) and go to the Google AI section
2213. Enter your Google AI API key and press enter.
222
223The Google AI API key will be saved in your keychain.
224
225Zed will also use the `GOOGLE_AI_API_KEY` environment variable if it's defined.
226
227#### Custom Models {#google-ai-custom-models}
228
229By default, Zed will use `stable` versions of models, but you can use specific versions of models, including [experimental models](https://ai.google.dev/gemini-api/docs/models/experimental-models), with the Google AI provider by adding the following to your Zed `settings.json`:
230
231```json
232{
233  "language_models": {
234    "google": {
235      "available_models": [
236        {
237          "name": "gemini-1.5-flash-latest",
238          "display_name": "Gemini 1.5 Flash (Latest)",
239          "max_tokens": 1000000
240        }
241      ]
242    }
243  }
244}
245```
246
247Custom models will be listed in the model dropdown in the Agent Panel.
248
249### LM Studio {#lmstudio}
250
251> ✅ Supports tool use
252
2531. Download and install the latest version of LM Studio from https://lmstudio.ai/download
2542. In the app press ⌘/Ctrl + Shift + M and download at least one model, e.g. qwen2.5-coder-7b
255
256   You can also get models via the LM Studio CLI:
257
258   ```sh
259   lms get qwen2.5-coder-7b
260   ```
261
2623. Make sure the LM Studio API server is running by executing:
263
264   ```sh
265   lms server start
266   ```
267
268Tip: Set [LM Studio as a login item](https://lmstudio.ai/docs/advanced/headless#run-the-llm-service-on-machine-login) to automate running the LM Studio server.
269
270### Mistral {#mistral}
271
272> ✅ Supports tool use
273
2741. Visit the Mistral platform and [create an API key](https://console.mistral.ai/api-keys/)
2752. Open the configuration view (`assistant: show configuration`) and navigate to the Mistral section
2763. Enter your Mistral API key
277
278The Mistral API key will be saved in your keychain.
279
280Zed will also use the `MISTRAL_API_KEY` environment variable if it's defined.
281
282#### Custom Models {#mistral-custom-models}
283
284The Zed Assistant comes pre-configured with several Mistral models (codestral-latest, mistral-large-latest, mistral-medium-latest, mistral-small-latest, open-mistral-nemo, and open-codestral-mamba). All the default models support tool use. If you wish to use alternate models or customize their parameters, you can do so by adding the following to your Zed `settings.json`:
285
286```json
287{
288  "language_models": {
289    "mistral": {
290      "api_url": "https://api.mistral.ai/v1",
291      "available_models": [
292        {
293          "name": "mistral-tiny-latest",
294          "display_name": "Mistral Tiny",
295          "max_tokens": 32000,
296          "max_output_tokens": 4096,
297          "max_completion_tokens": 1024,
298          "supports_tools": true
299        }
300      ]
301    }
302  }
303}
304```
305
306Custom models will be listed in the model dropdown in the assistant panel.
307
308### Ollama {#ollama}
309
310> ✅ Supports tool use
311
312Download and install Ollama from [ollama.com/download](https://ollama.com/download) (Linux or macOS) and ensure it's running with `ollama --version`.
313
3141. Download one of the [available models](https://ollama.com/models), for example, for `mistral`:
315
316   ```sh
317   ollama pull mistral
318   ```
319
3202. Make sure that the Ollama server is running. You can start it either via running Ollama.app (macOS) or launching:
321
322   ```sh
323   ollama serve
324   ```
325
3263. In the Agent Panel, select one of the Ollama models using the model dropdown.
327
328#### Ollama Context Length {#ollama-context}
329
330Zed has pre-configured maximum context lengths (`max_tokens`) to match the capabilities of common models.
331Zed API requests to Ollama include this as `num_ctx` parameter, but the default values do not exceed `16384` so users with ~16GB of ram are able to use most models out of the box.
332See [get_max_tokens in ollama.rs](https://github.com/zed-industries/zed/blob/main/crates/ollama/src/ollama.rs) for a complete set of defaults.
333
334> **Note**: Token counts displayed in the Agent Panel are only estimates and will differ from the model's native tokenizer.
335
336Depending on your hardware or use-case you may wish to limit or increase the context length for a specific model via settings.json:
337
338```json
339{
340  "language_models": {
341    "ollama": {
342      "api_url": "http://localhost:11434",
343      "available_models": [
344        {
345          "name": "qwen2.5-coder",
346          "display_name": "qwen 2.5 coder 32K",
347          "max_tokens": 32768,
348          "supports_tools": true
349        }
350      ]
351    }
352  }
353}
354```
355
356If you specify a context length that is too large for your hardware, Ollama will log an error.
357You can watch these logs by running: `tail -f ~/.ollama/logs/ollama.log` (macOS) or `journalctl -u ollama -f` (Linux).
358Depending on the memory available on your machine, you may need to adjust the context length to a smaller value.
359
360You may also optionally specify a value for `keep_alive` for each available model.
361This can be an integer (seconds) or alternatively a string duration like "5m", "10m", "1h", "1d", etc.
362For example, `"keep_alive": "120s"` will allow the remote server to unload the model (freeing up GPU VRAM) after 120 seconds.
363
364The `supports_tools` option controls whether or not the model will use additional tools.
365If the model is tagged with `tools` in the Ollama catalog this option should be supplied, and built in profiles `Ask` and `Write` can be used.
366If the model is not tagged with `tools` in the Ollama catalog, this option can still be supplied with value `true`; however be aware that only the `Minimal` built in profile will work.
367
368### OpenAI {#openai}
369
370> ✅ Supports tool use
371
3721. Visit the OpenAI platform and [create an API key](https://platform.openai.com/account/api-keys)
3732. Make sure that your OpenAI account has credits
3743. Open the settings view (`agent: open configuration`) and go to the OpenAI section
3754. Enter your OpenAI API key
376
377The OpenAI API key will be saved in your keychain.
378
379Zed will also use the `OPENAI_API_KEY` environment variable if it's defined.
380
381#### Custom Models {#openai-custom-models}
382
383The Zed Assistant comes pre-configured to use the latest version for common models (GPT-3.5 Turbo, GPT-4, GPT-4 Turbo, GPT-4o, GPT-4o mini).
384To use alternate models, perhaps a preview release or a dated model release, or if you wish to control the request parameters, you can do so by adding the following to your Zed `settings.json`:
385
386```json
387{
388  "language_models": {
389    "openai": {
390      "available_models": [
391        {
392          "name": "gpt-4o-2024-08-06",
393          "display_name": "GPT 4o Summer 2024",
394          "max_tokens": 128000
395        },
396        {
397          "name": "o1-mini",
398          "display_name": "o1-mini",
399          "max_tokens": 128000,
400          "max_completion_tokens": 20000
401        }
402      ],
403      "version": "1"
404    }
405  }
406}
407```
408
409You must provide the model's Context Window in the `max_tokens` parameter; this can be found in the [OpenAI model documentation](https://platform.openai.com/docs/models).
410OpenAI `o1` models should set `max_completion_tokens` as well to avoid incurring high reasoning token costs.
411Custom models will be listed in the model dropdown in the Agent Panel.
412
413### OpenAI API Compatible {#openai-api-compatible}
414
415Zed supports using OpenAI compatible APIs by specifying a custom `endpoint` and `available_models` for the OpenAI provider.
416
417#### X.ai Grok
418
419Example configuration for using X.ai Grok with Zed:
420
421```json
422  "language_models": {
423    "openai": {
424      "api_url": "https://api.x.ai/v1",
425      "available_models": [
426        {
427          "name": "grok-beta",
428          "display_name": "X.ai Grok (Beta)",
429          "max_tokens": 131072
430        }
431      ],
432      "version": "1"
433    },
434  }
435```
436
437## Advanced Configuration {#advanced-configuration}
438
439### Custom Provider Endpoints {#custom-provider-endpoint}
440
441You can use a custom API endpoint for different providers, as long as it's compatible with the provider's API structure.
442To do so, add the following to your `settings.json`:
443
444```json
445{
446  "language_models": {
447    "some-provider": {
448      "api_url": "http://localhost:11434"
449    }
450  }
451}
452```
453
454Where `some-provider` can be any of the following values: `anthropic`, `google`, `ollama`, `openai`.
455
456### Default Model {#default-model}
457
458Zed's hosted LLM service sets `claude-sonnet-4` as the default model.
459However, you can change it either via the model dropdown in the Agent Panel's bottom-right corner or by manually editing the `default_model` object in your settings:
460
461```json
462{
463  "agent": {
464    "version": "2",
465    "default_model": {
466      "provider": "zed.dev",
467      "model": "gpt-4o"
468    }
469  }
470}
471```
472
473### Feature-specific Models {#feature-specific-models}
474
475If a feature-specific model is not set, it will fall back to using the default model, which is the one you set on the Agent Panel.
476
477You can configure the following feature-specific models:
478
479- Thread summary model: Used for generating thread summaries
480- Inline assistant model: Used for the inline assistant feature
481- Commit message model: Used for generating Git commit messages
482
483Example configuration:
484
485```json
486{
487  "agent": {
488    "version": "2",
489    "default_model": {
490      "provider": "zed.dev",
491      "model": "claude-sonnet-4"
492    },
493    "inline_assistant_model": {
494      "provider": "anthropic",
495      "model": "claude-3-5-sonnet"
496    },
497    "commit_message_model": {
498      "provider": "openai",
499      "model": "gpt-4o-mini"
500    },
501    "thread_summary_model": {
502      "provider": "google",
503      "model": "gemini-2.0-flash"
504    }
505  }
506}
507```
508
509### Alternative Models for Inline Assists {#alternative-assists}
510
511You can configure additional models that will be used to perform inline assists in parallel.
512When you do this, the inline assist UI will surface controls to cycle between the alternatives generated by each model.
513
514The models you specify here are always used in _addition_ to your [default model](#default-model).
515For example, the following configuration will generate two outputs for every assist.
516One with Claude 3.7 Sonnet, and one with GPT-4o.
517
518```json
519{
520  "agent": {
521    "default_model": {
522      "provider": "zed.dev",
523      "model": "claude-sonnet-4"
524    },
525    "inline_alternatives": [
526      {
527        "provider": "zed.dev",
528        "model": "gpt-4o"
529      }
530    ],
531    "version": "2"
532  }
533}
534```
535
536## Default View
537
538Use the `default_view` setting to set change the default view of the Agent Panel.
539You can choose between `thread` (the default) and `text_thread`:
540
541```json
542{
543  "agent": {
544    "default_view": "text_thread".
545  }
546}
547```