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> **Note**: If you don't see specific models in the dropdown, you may need to enable them in your [GitHub Copilot settings](https://github.com/settings/copilot/features).
220
221### Google AI {#google-ai}
222
223> βœ… Supports tool use
224
225You can use Gemini models with the Zed assistant by choosing it via the model dropdown in the Agent Panel.
226
2271. Go to the Google AI Studio site and [create an API key](https://aistudio.google.com/app/apikey).
2282. Open the settings view (`agent: open configuration`) and go to the Google AI section
2293. Enter your Google AI API key and press enter.
230
231The Google AI API key will be saved in your keychain.
232
233Zed will also use the `GOOGLE_AI_API_KEY` environment variable if it's defined.
234
235#### Custom Models {#google-ai-custom-models}
236
237By 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.
238
239Here is an example of a custom Google AI model you could add to your Zed `settings.json`:
240
241```json
242{
243  "language_models": {
244    "google": {
245      "available_models": [
246        {
247          "name": "gemini-2.5-flash-preview-05-20",
248          "display_name": "Gemini 2.5 Flash (Thinking)",
249          "max_tokens": 1000000,
250          "mode": {
251            "type": "thinking",
252            "budget_tokens": 24000
253          }
254        }
255      ]
256    }
257  }
258}
259```
260
261Custom models will be listed in the model dropdown in the Agent Panel.
262
263### LM Studio {#lmstudio}
264
265> βœ… Supports tool use
266
2671. Download and install the latest version of LM Studio from https://lmstudio.ai/download
2682. In the app press ⌘/Ctrl + Shift + M and download at least one model, e.g. qwen2.5-coder-7b
269
270   You can also get models via the LM Studio CLI:
271
272   ```sh
273   lms get qwen2.5-coder-7b
274   ```
275
2763. Make sure the LM Studio API server is running by executing:
277
278   ```sh
279   lms server start
280   ```
281
282Tip: 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.
283
284### Mistral {#mistral}
285
286> βœ… Supports tool use
287
2881. Visit the Mistral platform and [create an API key](https://console.mistral.ai/api-keys/)
2892. Open the configuration view (`assistant: show configuration`) and navigate to the Mistral section
2903. Enter your Mistral API key
291
292The Mistral API key will be saved in your keychain.
293
294Zed will also use the `MISTRAL_API_KEY` environment variable if it's defined.
295
296#### Custom Models {#mistral-custom-models}
297
298The 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`:
299
300```json
301{
302  "language_models": {
303    "mistral": {
304      "api_url": "https://api.mistral.ai/v1",
305      "available_models": [
306        {
307          "name": "mistral-tiny-latest",
308          "display_name": "Mistral Tiny",
309          "max_tokens": 32000,
310          "max_output_tokens": 4096,
311          "max_completion_tokens": 1024,
312          "supports_tools": true,
313          "supports_images": false
314        }
315      ]
316    }
317  }
318}
319```
320
321Custom models will be listed in the model dropdown in the assistant panel.
322
323### Ollama {#ollama}
324
325> βœ… Supports tool use
326
327Download and install Ollama from [ollama.com/download](https://ollama.com/download) (Linux or macOS) and ensure it's running with `ollama --version`.
328
3291. Download one of the [available models](https://ollama.com/models), for example, for `mistral`:
330
331   ```sh
332   ollama pull mistral
333   ```
334
3352. Make sure that the Ollama server is running. You can start it either via running Ollama.app (macOS) or launching:
336
337   ```sh
338   ollama serve
339   ```
340
3413. In the Agent Panel, select one of the Ollama models using the model dropdown.
342
343#### Ollama Context Length {#ollama-context}
344
345Zed has pre-configured maximum context lengths (`max_tokens`) to match the capabilities of common models.
346Zed 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.
347See [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.
348
349> **Note**: Token counts displayed in the Agent Panel are only estimates and will differ from the model's native tokenizer.
350
351Depending on your hardware or use-case you may wish to limit or increase the context length for a specific model via settings.json:
352
353```json
354{
355  "language_models": {
356    "ollama": {
357      "api_url": "http://localhost:11434",
358      "available_models": [
359        {
360          "name": "qwen2.5-coder",
361          "display_name": "qwen 2.5 coder 32K",
362          "max_tokens": 32768,
363          "supports_tools": true,
364          "supports_thinking": true,
365          "supports_images": true
366        }
367      ]
368    }
369  }
370}
371```
372
373If you specify a context length that is too large for your hardware, Ollama will log an error.
374You can watch these logs by running: `tail -f ~/.ollama/logs/ollama.log` (macOS) or `journalctl -u ollama -f` (Linux).
375Depending on the memory available on your machine, you may need to adjust the context length to a smaller value.
376
377You may also optionally specify a value for `keep_alive` for each available model.
378This can be an integer (seconds) or alternatively a string duration like "5m", "10m", "1h", "1d", etc.
379For example, `"keep_alive": "120s"` will allow the remote server to unload the model (freeing up GPU VRAM) after 120 seconds.
380
381The `supports_tools` option controls whether or not the model will use additional tools.
382If 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.
383If 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.
384
385The `supports_thinking` option controls whether or not the model will perform an explicit β€œthinking” (reasoning) pass before producing its final answer.
386If the model is tagged with `thinking` in the Ollama catalog, set this option and you can use it in zed.
387
388The `supports_images` option enables the model’s vision capabilities, allowing it to process images included in the conversation context.
389If the model is tagged with `vision` in the Ollama catalog, set this option and you can use it in zed.
390
391### OpenAI {#openai}
392
393> βœ… Supports tool use
394
3951. Visit the OpenAI platform and [create an API key](https://platform.openai.com/account/api-keys)
3962. Make sure that your OpenAI account has credits
3973. Open the settings view (`agent: open configuration`) and go to the OpenAI section
3984. Enter your OpenAI API key
399
400The OpenAI API key will be saved in your keychain.
401
402Zed will also use the `OPENAI_API_KEY` environment variable if it's defined.
403
404#### Custom Models {#openai-custom-models}
405
406The 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).
407To 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`:
408
409```json
410{
411  "language_models": {
412    "openai": {
413      "available_models": [
414        {
415          "name": "gpt-4o-2024-08-06",
416          "display_name": "GPT 4o Summer 2024",
417          "max_tokens": 128000
418        },
419        {
420          "name": "o1-mini",
421          "display_name": "o1-mini",
422          "max_tokens": 128000,
423          "max_completion_tokens": 20000
424        }
425      ],
426      "version": "1"
427    }
428  }
429}
430```
431
432You 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).
433OpenAI `o1` models should set `max_completion_tokens` as well to avoid incurring high reasoning token costs.
434Custom models will be listed in the model dropdown in the Agent Panel.
435
436### OpenAI API Compatible {#openai-api-compatible}
437
438Zed supports using OpenAI compatible APIs by specifying a custom `endpoint` and `available_models` for the OpenAI provider.
439
440You can add a custom API URL for OpenAI either via the UI or by editing the your `settings.json`.
441Here are a few model examples you can plug in by using this feature:
442
443#### X.ai Grok
444
445Example configuration for using X.ai Grok with Zed:
446
447```json
448  "language_models": {
449    "openai": {
450      "api_url": "https://api.x.ai/v1",
451      "available_models": [
452        {
453          "name": "grok-beta",
454          "display_name": "X.ai Grok (Beta)",
455          "max_tokens": 131072
456        }
457      ],
458      "version": "1"
459    },
460  }
461```
462
463#### Vercel's v0
464
465To use Vercel's v0 models with Zed, ensure you have created a [v0 API key first](https://v0.dev/chat/settings/keys).
466Once that's done, insert that into the OpenAI API key section, and add this API endpoint:
467
468```json
469  "language_models": {
470    "openai": {
471      "api_url": "https://api.v0.dev/v1",
472      "version": "1"
473    },
474  }
475```
476
477### OpenRouter {#openrouter}
478
479> βœ… Supports tool use
480
481OpenRouter provides access to multiple AI models through a single API. It supports tool use for compatible models.
482
4831. Visit [OpenRouter](https://openrouter.ai) and create an account
4842. Generate an API key from your [OpenRouter keys page](https://openrouter.ai/keys)
4853. Open the settings view (`agent: open configuration`) and go to the OpenRouter section
4864. Enter your OpenRouter API key
487
488The OpenRouter API key will be saved in your keychain.
489
490Zed will also use the `OPENROUTER_API_KEY` environment variable if it's defined.
491
492#### Custom Models {#openrouter-custom-models}
493
494You can add custom models to the OpenRouter provider by adding the following to your Zed `settings.json`:
495
496```json
497{
498  "language_models": {
499    "open_router": {
500      "api_url": "https://openrouter.ai/api/v1",
501      "available_models": [
502        {
503          "name": "google/gemini-2.0-flash-thinking-exp",
504          "display_name": "Gemini 2.0 Flash (Thinking)",
505          "max_tokens": 200000,
506          "max_output_tokens": 8192,
507          "supports_tools": true,
508          "supports_images": true,
509          "mode": {
510            "type": "thinking",
511            "budget_tokens": 8000
512          }
513        }
514      ]
515    }
516  }
517}
518```
519
520The available configuration options for each model are:
521
522- `name`: The model identifier used by OpenRouter (required)
523- `display_name`: A human-readable name shown in the UI (optional)
524- `max_tokens`: The model's context window size (required)
525- `max_output_tokens`: Maximum tokens the model can generate (optional)
526- `max_completion_tokens`: Maximum completion tokens (optional)
527- `supports_tools`: Whether the model supports tool/function calling (optional)
528- `supports_images`: Whether the model supports image inputs (optional)
529- `mode`: Special mode configuration for thinking models (optional)
530
531You can find available models and their specifications on the [OpenRouter models page](https://openrouter.ai/models).
532
533Custom models will be listed in the model dropdown in the Agent Panel.
534
535## Advanced Configuration {#advanced-configuration}
536
537### Custom Provider Endpoints {#custom-provider-endpoint}
538
539You can use a custom API endpoint for different providers, as long as it's compatible with the provider's API structure.
540To do so, add the following to your `settings.json`:
541
542```json
543{
544  "language_models": {
545    "some-provider": {
546      "api_url": "http://localhost:11434"
547    }
548  }
549}
550```
551
552Where `some-provider` can be any of the following values: `anthropic`, `google`, `ollama`, `openai`.
553
554### Default Model {#default-model}
555
556Zed's hosted LLM service sets `claude-sonnet-4` as the default model.
557However, 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:
558
559```json
560{
561  "agent": {
562    "version": "2",
563    "default_model": {
564      "provider": "zed.dev",
565      "model": "gpt-4o"
566    }
567  }
568}
569```
570
571### Feature-specific Models {#feature-specific-models}
572
573If 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.
574
575You can configure the following feature-specific models:
576
577- Thread summary model: Used for generating thread summaries
578- Inline assistant model: Used for the inline assistant feature
579- Commit message model: Used for generating Git commit messages
580
581Example configuration:
582
583```json
584{
585  "agent": {
586    "version": "2",
587    "default_model": {
588      "provider": "zed.dev",
589      "model": "claude-sonnet-4"
590    },
591    "inline_assistant_model": {
592      "provider": "anthropic",
593      "model": "claude-3-5-sonnet"
594    },
595    "commit_message_model": {
596      "provider": "openai",
597      "model": "gpt-4o-mini"
598    },
599    "thread_summary_model": {
600      "provider": "google",
601      "model": "gemini-2.0-flash"
602    }
603  }
604}
605```
606
607### Alternative Models for Inline Assists {#alternative-assists}
608
609You can configure additional models that will be used to perform inline assists in parallel.
610When you do this, the inline assist UI will surface controls to cycle between the alternatives generated by each model.
611
612The models you specify here are always used in _addition_ to your [default model](#default-model).
613For example, the following configuration will generate two outputs for every assist.
614One with Claude 3.7 Sonnet, and one with GPT-4o.
615
616```json
617{
618  "agent": {
619    "default_model": {
620      "provider": "zed.dev",
621      "model": "claude-sonnet-4"
622    },
623    "inline_alternatives": [
624      {
625        "provider": "zed.dev",
626        "model": "gpt-4o"
627      }
628    ],
629    "version": "2"
630  }
631}
632```
633
634## Default View
635
636Use the `default_view` setting to set change the default view of the Agent Panel.
637You can choose between `thread` (the default) and `text_thread`:
638
639```json
640{
641  "agent": {
642    "default_view": "text_thread".
643  }
644}
645```