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| [OpenRouter](#openrouter)                       | βœ…                                                                                                                                                                          |
 24| [OpenAI API Compatible](#openai-api-compatible) | 🚫                                                                                                                                                                          |
 25
 26## Use Your Own Keys {#use-your-own-keys}
 27
 28While Zed offers hosted versions of models through [our various plans](./plans-and-usage.md), we're always happy to support users wanting to supply their own API keys.
 29Below, you can learn how to do that for each provider.
 30
 31> 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.
 32
 33### Amazon Bedrock {#amazon-bedrock}
 34
 35> βœ… Supports tool use with models that support streaming tool use.
 36> 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).
 37
 38To use Amazon Bedrock's models, an AWS authentication is required.
 39Ensure your credentials have the following permissions set up:
 40
 41- `bedrock:InvokeModelWithResponseStream`
 42- `bedrock:InvokeModel`
 43- `bedrock:ConverseStream`
 44
 45Your IAM policy should look similar to:
 46
 47```json
 48{
 49  "Version": "2012-10-17",
 50  "Statement": [
 51    {
 52      "Effect": "Allow",
 53      "Action": [
 54        "bedrock:InvokeModel",
 55        "bedrock:InvokeModelWithResponseStream",
 56        "bedrock:ConverseStream"
 57      ],
 58      "Resource": "*"
 59    }
 60  ]
 61}
 62```
 63
 64With that done, choose one of the two authentication methods:
 65
 66#### Authentication via Named Profile (Recommended)
 67
 681. Ensure you have the AWS CLI installed and configured with a named profile
 692. Open your `settings.json` (`zed: open settings`) and include the `bedrock` key under `language_models` with the following settings:
 70   ```json
 71   {
 72     "language_models": {
 73       "bedrock": {
 74         "authentication_method": "named_profile",
 75         "region": "your-aws-region",
 76         "profile": "your-profile-name"
 77       }
 78     }
 79   }
 80   ```
 81
 82#### Authentication via Static Credentials
 83
 84While 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.
 85To do this:
 86
 871. 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).
 882. Create security credentials for that User, save them and keep them secure.
 893. Open the Agent Configuration with (`agent: open configuration`) and go to the Amazon Bedrock section
 904. Copy the credentials from Step 2 into the respective **Access Key ID**, **Secret Access Key**, and **Region** fields.
 91
 92#### Cross-Region Inference
 93
 94The 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.
 95With Cross-Region inference, you can distribute traffic across multiple AWS Regions, enabling higher throughput.
 96
 97For 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`.
 98Cross-Region inference requests are kept within the AWS Regions that are part of the geography where the data originally resides.
 99For example, a request made within the US is kept within the AWS Regions in the US.
100
101Although 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.
102All data will be transmitted encrypted across Amazon's secure network.
103
104We 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).
105
106For 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).
107
108### Anthropic {#anthropic}
109
110> βœ… Supports tool use
111
112You can use Anthropic models by choosing it via the model dropdown in the Agent Panel.
113
1141. Sign up for Anthropic and [create an API key](https://console.anthropic.com/settings/keys)
1152. Make sure that your Anthropic account has credits
1163. Open the settings view (`agent: open configuration`) and go to the Anthropic section
1174. Enter your Anthropic API key
118
119Even 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.
120
121Zed will also use the `ANTHROPIC_API_KEY` environment variable if it's defined.
122
123#### Custom Models {#anthropic-custom-models}
124
125You can add custom models to the Anthropic provider by adding the following to your Zed `settings.json`:
126
127```json
128{
129  "language_models": {
130    "anthropic": {
131      "available_models": [
132        {
133          "name": "claude-3-5-sonnet-20240620",
134          "display_name": "Sonnet 2024-June",
135          "max_tokens": 128000,
136          "max_output_tokens": 2560,
137          "cache_configuration": {
138            "max_cache_anchors": 10,
139            "min_total_token": 10000,
140            "should_speculate": false
141          },
142          "tool_override": "some-model-that-supports-toolcalling"
143        }
144      ]
145    }
146  }
147}
148```
149
150Custom models will be listed in the model dropdown in the Agent Panel.
151
152You 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:
153
154```json
155{
156  "name": "claude-sonnet-4-latest",
157  "display_name": "claude-sonnet-4-thinking",
158  "max_tokens": 200000,
159  "mode": {
160    "type": "thinking",
161    "budget_tokens": 4_096
162  }
163}
164```
165
166### DeepSeek {#deepseek}
167
168> βœ… Supports tool use
169
1701. Visit the DeepSeek platform and [create an API key](https://platform.deepseek.com/api_keys)
1712. Open the settings view (`agent: open configuration`) and go to the DeepSeek section
1723. Enter your DeepSeek API key
173
174The DeepSeek API key will be saved in your keychain.
175
176Zed will also use the `DEEPSEEK_API_KEY` environment variable if it's defined.
177
178#### Custom Models {#deepseek-custom-models}
179
180The 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`:
181
182```json
183{
184  "language_models": {
185    "deepseek": {
186      "api_url": "https://api.deepseek.com",
187      "available_models": [
188        {
189          "name": "deepseek-chat",
190          "display_name": "DeepSeek Chat",
191          "max_tokens": 64000
192        },
193        {
194          "name": "deepseek-reasoner",
195          "display_name": "DeepSeek Reasoner",
196          "max_tokens": 64000,
197          "max_output_tokens": 4096
198        }
199      ]
200    }
201  }
202}
203```
204
205Custom 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.
206
207### GitHub Copilot Chat {#github-copilot-chat}
208
209> βœ… Supports tool use in some cases.
210> 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.
211
212You can use GitHub Copilot Chat with the Zed assistant by choosing it via the model dropdown in the Agent Panel.
213
2141. Open the settings view (`agent: open configuration`) and go to the GitHub Copilot Chat section
2152. Click on `Sign in to use GitHub Copilot`, follow the steps shown in the modal.
216
217Alternatively, you can provide an OAuth token via the `GH_COPILOT_TOKEN` environment variable.
218
219### Google AI {#google-ai}
220
221> βœ… Supports tool use
222
223You can use Gemini models with the Zed assistant by choosing it via the model dropdown in the Agent Panel.
224
2251. Go to the Google AI Studio site and [create an API key](https://aistudio.google.com/app/apikey).
2262. Open the settings view (`agent: open configuration`) and go to the Google AI section
2273. Enter your Google AI API key and press enter.
228
229The Google AI API key will be saved in your keychain.
230
231Zed will also use the `GOOGLE_AI_API_KEY` environment variable if it's defined.
232
233#### Custom Models {#google-ai-custom-models}
234
235By 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). You can configure a model to use [thinking mode](https://ai.google.dev/gemini-api/docs/thinking) (if it supports it) by adding a `mode` configuration to your model. This is useful for controlling reasoning token usage and response speed. If not specified, Gemini will automatically choose the thinking budget.
236
237Here is an example of a custom Google AI model you could add to your Zed `settings.json`:
238
239```json
240{
241  "language_models": {
242    "google": {
243      "available_models": [
244        {
245          "name": "gemini-2.5-flash-preview-05-20",
246          "display_name": "Gemini 2.5 Flash (Thinking)",
247          "max_tokens": 1000000,
248          "mode": {
249            "type": "thinking",
250            "budget_tokens": 24000
251          }
252        }
253      ]
254    }
255  }
256}
257```
258
259Custom models will be listed in the model dropdown in the Agent Panel.
260
261### LM Studio {#lmstudio}
262
263> βœ… Supports tool use
264
2651. Download and install the latest version of LM Studio from https://lmstudio.ai/download
2662. In the app press ⌘/Ctrl + Shift + M and download at least one model, e.g. qwen2.5-coder-7b
267
268   You can also get models via the LM Studio CLI:
269
270   ```sh
271   lms get qwen2.5-coder-7b
272   ```
273
2743. Make sure the LM Studio API server is running by executing:
275
276   ```sh
277   lms server start
278   ```
279
280Tip: 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.
281
282### Mistral {#mistral}
283
284> βœ… Supports tool use
285
2861. Visit the Mistral platform and [create an API key](https://console.mistral.ai/api-keys/)
2872. Open the configuration view (`assistant: show configuration`) and navigate to the Mistral section
2883. Enter your Mistral API key
289
290The Mistral API key will be saved in your keychain.
291
292Zed will also use the `MISTRAL_API_KEY` environment variable if it's defined.
293
294#### Custom Models {#mistral-custom-models}
295
296The 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`:
297
298```json
299{
300  "language_models": {
301    "mistral": {
302      "api_url": "https://api.mistral.ai/v1",
303      "available_models": [
304        {
305          "name": "mistral-tiny-latest",
306          "display_name": "Mistral Tiny",
307          "max_tokens": 32000,
308          "max_output_tokens": 4096,
309          "max_completion_tokens": 1024,
310          "supports_tools": true,
311          "supports_images": false
312        }
313      ]
314    }
315  }
316}
317```
318
319Custom models will be listed in the model dropdown in the assistant panel.
320
321### Ollama {#ollama}
322
323> βœ… Supports tool use
324
325Download and install Ollama from [ollama.com/download](https://ollama.com/download) (Linux or macOS) and ensure it's running with `ollama --version`.
326
3271. Download one of the [available models](https://ollama.com/models), for example, for `mistral`:
328
329   ```sh
330   ollama pull mistral
331   ```
332
3332. Make sure that the Ollama server is running. You can start it either via running Ollama.app (macOS) or launching:
334
335   ```sh
336   ollama serve
337   ```
338
3393. In the Agent Panel, select one of the Ollama models using the model dropdown.
340
341#### Ollama Context Length {#ollama-context}
342
343Zed has pre-configured maximum context lengths (`max_tokens`) to match the capabilities of common models.
344Zed 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.
345See [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.
346
347> **Note**: Token counts displayed in the Agent Panel are only estimates and will differ from the model's native tokenizer.
348
349Depending on your hardware or use-case you may wish to limit or increase the context length for a specific model via settings.json:
350
351```json
352{
353  "language_models": {
354    "ollama": {
355      "api_url": "http://localhost:11434",
356      "available_models": [
357        {
358          "name": "qwen2.5-coder",
359          "display_name": "qwen 2.5 coder 32K",
360          "max_tokens": 32768,
361          "supports_tools": true,
362          "supports_thinking": true,
363          "supports_images": true
364        }
365      ]
366    }
367  }
368}
369```
370
371If you specify a context length that is too large for your hardware, Ollama will log an error.
372You can watch these logs by running: `tail -f ~/.ollama/logs/ollama.log` (macOS) or `journalctl -u ollama -f` (Linux).
373Depending on the memory available on your machine, you may need to adjust the context length to a smaller value.
374
375You may also optionally specify a value for `keep_alive` for each available model.
376This can be an integer (seconds) or alternatively a string duration like "5m", "10m", "1h", "1d", etc.
377For example, `"keep_alive": "120s"` will allow the remote server to unload the model (freeing up GPU VRAM) after 120 seconds.
378
379The `supports_tools` option controls whether or not the model will use additional tools.
380If 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.
381If 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.
382
383The `supports_thinking` option controls whether or not the model will perform an explicit β€œthinking” (reasoning) pass before producing its final answer.
384If the model is tagged with `thinking` in the Ollama catalog, set this option and you can use it in zed.
385
386The `supports_images` option enables the model’s vision capabilities, allowing it to process images included in the conversation context.
387If the model is tagged with `vision` in the Ollama catalog, set this option and you can use it in zed.
388
389### OpenAI {#openai}
390
391> βœ… Supports tool use
392
3931. Visit the OpenAI platform and [create an API key](https://platform.openai.com/account/api-keys)
3942. Make sure that your OpenAI account has credits
3953. Open the settings view (`agent: open configuration`) and go to the OpenAI section
3964. Enter your OpenAI API key
397
398The OpenAI API key will be saved in your keychain.
399
400Zed will also use the `OPENAI_API_KEY` environment variable if it's defined.
401
402#### Custom Models {#openai-custom-models}
403
404The 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).
405To 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`:
406
407```json
408{
409  "language_models": {
410    "openai": {
411      "available_models": [
412        {
413          "name": "gpt-4o-2024-08-06",
414          "display_name": "GPT 4o Summer 2024",
415          "max_tokens": 128000
416        },
417        {
418          "name": "o1-mini",
419          "display_name": "o1-mini",
420          "max_tokens": 128000,
421          "max_completion_tokens": 20000
422        }
423      ],
424      "version": "1"
425    }
426  }
427}
428```
429
430You 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).
431OpenAI `o1` models should set `max_completion_tokens` as well to avoid incurring high reasoning token costs.
432Custom models will be listed in the model dropdown in the Agent Panel.
433
434### OpenRouter {#openrouter}
435
436> βœ… Supports tool use
437
438OpenRouter provides access to multiple AI models through a single API. It supports tool use for compatible models.
439
4401. Visit [OpenRouter](https://openrouter.ai) and create an account
4412. Generate an API key from your [OpenRouter keys page](https://openrouter.ai/keys)
4423. Open the settings view (`agent: open configuration`) and go to the OpenRouter section
4434. Enter your OpenRouter API key
444
445The OpenRouter API key will be saved in your keychain.
446
447Zed will also use the `OPENROUTER_API_KEY` environment variable if it's defined.
448
449### OpenAI API Compatible {#openai-api-compatible}
450
451Zed supports using OpenAI compatible APIs by specifying a custom `endpoint` and `available_models` for the OpenAI provider.
452
453#### X.ai Grok
454
455Example configuration for using X.ai Grok with Zed:
456
457```json
458  "language_models": {
459    "openai": {
460      "api_url": "https://api.x.ai/v1",
461      "available_models": [
462        {
463          "name": "grok-beta",
464          "display_name": "X.ai Grok (Beta)",
465          "max_tokens": 131072
466        }
467      ],
468      "version": "1"
469    },
470  }
471```
472
473## Advanced Configuration {#advanced-configuration}
474
475### Custom Provider Endpoints {#custom-provider-endpoint}
476
477You can use a custom API endpoint for different providers, as long as it's compatible with the provider's API structure.
478To do so, add the following to your `settings.json`:
479
480```json
481{
482  "language_models": {
483    "some-provider": {
484      "api_url": "http://localhost:11434"
485    }
486  }
487}
488```
489
490Where `some-provider` can be any of the following values: `anthropic`, `google`, `ollama`, `openai`.
491
492### Default Model {#default-model}
493
494Zed's hosted LLM service sets `claude-sonnet-4` as the default model.
495However, 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:
496
497```json
498{
499  "agent": {
500    "version": "2",
501    "default_model": {
502      "provider": "zed.dev",
503      "model": "gpt-4o"
504    }
505  }
506}
507```
508
509### Feature-specific Models {#feature-specific-models}
510
511If 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.
512
513You can configure the following feature-specific models:
514
515- Thread summary model: Used for generating thread summaries
516- Inline assistant model: Used for the inline assistant feature
517- Commit message model: Used for generating Git commit messages
518
519Example configuration:
520
521```json
522{
523  "agent": {
524    "version": "2",
525    "default_model": {
526      "provider": "zed.dev",
527      "model": "claude-sonnet-4"
528    },
529    "inline_assistant_model": {
530      "provider": "anthropic",
531      "model": "claude-3-5-sonnet"
532    },
533    "commit_message_model": {
534      "provider": "openai",
535      "model": "gpt-4o-mini"
536    },
537    "thread_summary_model": {
538      "provider": "google",
539      "model": "gemini-2.0-flash"
540    }
541  }
542}
543```
544
545### Alternative Models for Inline Assists {#alternative-assists}
546
547You can configure additional models that will be used to perform inline assists in parallel.
548When you do this, the inline assist UI will surface controls to cycle between the alternatives generated by each model.
549
550The models you specify here are always used in _addition_ to your [default model](#default-model).
551For example, the following configuration will generate two outputs for every assist.
552One with Claude 3.7 Sonnet, and one with GPT-4o.
553
554```json
555{
556  "agent": {
557    "default_model": {
558      "provider": "zed.dev",
559      "model": "claude-sonnet-4"
560    },
561    "inline_alternatives": [
562      {
563        "provider": "zed.dev",
564        "model": "gpt-4o"
565      }
566    ],
567    "version": "2"
568  }
569}
570```
571
572## Default View
573
574Use the `default_view` setting to set change the default view of the Agent Panel.
575You can choose between `thread` (the default) and `text_thread`:
576
577```json
578{
579  "agent": {
580    "default_view": "text_thread".
581  }
582}
583```