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"`.
5
6Alternatively, 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".
7
8## LLM Providers
9
10Zed supports multiple large language model providers.
11Here's an overview of the supported providers and tool call support:
12
13| Provider | Tool Use Supported |
14| ----------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
15| [Amazon Bedrock](#amazon-bedrock) | Depends on the model |
16| [Anthropic](#anthropic) | ✅ |
17| [DeepSeek](#deepseek) | ✅ |
18| [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)) |
19| [Google AI](#google-ai) | ✅ |
20| [LM Studio](#lmstudio) | ✅ |
21| [Mistral](#mistral) | ✅ |
22| [Ollama](#ollama) | ✅ |
23| [OpenAI](#openai) | ✅ |
24| [OpenAI API Compatible](#openai-api-compatible) | 🚫 |
25| [OpenRouter](#openrouter) | ✅ |
26
27## Use Your Own Keys {#use-your-own-keys}
28
29While 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.
30Below, you can learn how to do that for each provider.
31
32> 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.
33
34### Amazon Bedrock {#amazon-bedrock}
35
36> ✅ Supports tool use with models that support streaming tool use.
37> 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).
38
39To use Amazon Bedrock's models, an AWS authentication is required.
40Ensure your credentials have the following permissions set up:
41
42- `bedrock:InvokeModelWithResponseStream`
43- `bedrock:InvokeModel`
44- `bedrock:ConverseStream`
45
46Your IAM policy should look similar to:
47
48```json
49{
50 "Version": "2012-10-17",
51 "Statement": [
52 {
53 "Effect": "Allow",
54 "Action": [
55 "bedrock:InvokeModel",
56 "bedrock:InvokeModelWithResponseStream",
57 "bedrock:ConverseStream"
58 ],
59 "Resource": "*"
60 }
61 ]
62}
63```
64
65With that done, choose one of the two authentication methods:
66
67#### Authentication via Named Profile (Recommended)
68
691. Ensure you have the AWS CLI installed and configured with a named profile
702. Open your `settings.json` (`zed: open settings`) and include the `bedrock` key under `language_models` with the following settings:
71 ```json
72 {
73 "language_models": {
74 "bedrock": {
75 "authentication_method": "named_profile",
76 "region": "your-aws-region",
77 "profile": "your-profile-name"
78 }
79 }
80 }
81 ```
82
83#### Authentication via Static Credentials
84
85While 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.
86To do this:
87
881. 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).
892. Create security credentials for that User, save them and keep them secure.
903. Open the Agent Configuration with (`agent: open configuration`) and go to the Amazon Bedrock section
914. Copy the credentials from Step 2 into the respective **Access Key ID**, **Secret Access Key**, and **Region** fields.
92
93#### Cross-Region Inference
94
95The 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.
96With Cross-Region inference, you can distribute traffic across multiple AWS Regions, enabling higher throughput.
97
98For 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`.
99Cross-Region inference requests are kept within the AWS Regions that are part of the geography where the data originally resides.
100For example, a request made within the US is kept within the AWS Regions in the US.
101
102Although 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.
103All data will be transmitted encrypted across Amazon's secure network.
104
105We 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).
106
107For 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).
108
109### Anthropic {#anthropic}
110
111> ✅ Supports tool use
112
113You can use Anthropic models by choosing it via the model dropdown in the Agent Panel.
114
1151. Sign up for Anthropic and [create an API key](https://console.anthropic.com/settings/keys)
1162. Make sure that your Anthropic account has credits
1173. Open the settings view (`agent: open configuration`) and go to the Anthropic section
1184. Enter your Anthropic API key
119
120Even 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.
121
122Zed will also use the `ANTHROPIC_API_KEY` environment variable if it's defined.
123
124#### Custom Models {#anthropic-custom-models}
125
126You can add custom models to the Anthropic provider by adding the following to your Zed `settings.json`:
127
128```json
129{
130 "language_models": {
131 "anthropic": {
132 "available_models": [
133 {
134 "name": "claude-3-5-sonnet-20240620",
135 "display_name": "Sonnet 2024-June",
136 "max_tokens": 128000,
137 "max_output_tokens": 2560,
138 "cache_configuration": {
139 "max_cache_anchors": 10,
140 "min_total_token": 10000,
141 "should_speculate": false
142 },
143 "tool_override": "some-model-that-supports-toolcalling"
144 }
145 ]
146 }
147 }
148}
149```
150
151Custom models will be listed in the model dropdown in the Agent Panel.
152
153You 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:
154
155```json
156{
157 "name": "claude-sonnet-4-latest",
158 "display_name": "claude-sonnet-4-thinking",
159 "max_tokens": 200000,
160 "mode": {
161 "type": "thinking",
162 "budget_tokens": 4_096
163 }
164}
165```
166
167### DeepSeek {#deepseek}
168
169> ✅ Supports tool use
170
1711. Visit the DeepSeek platform and [create an API key](https://platform.deepseek.com/api_keys)
1722. Open the settings view (`agent: open configuration`) and go to the DeepSeek section
1733. Enter your DeepSeek API key
174
175The DeepSeek API key will be saved in your keychain.
176
177Zed will also use the `DEEPSEEK_API_KEY` environment variable if it's defined.
178
179#### Custom Models {#deepseek-custom-models}
180
181The Zed agent comes pre-configured to use the latest version for common models (DeepSeek Chat, DeepSeek Reasoner).
182If you wish to use alternate models or customize the API endpoint, you can do so by adding the following to your Zed `settings.json`:
183
184```json
185{
186 "language_models": {
187 "deepseek": {
188 "api_url": "https://api.deepseek.com",
189 "available_models": [
190 {
191 "name": "deepseek-chat",
192 "display_name": "DeepSeek Chat",
193 "max_tokens": 64000
194 },
195 {
196 "name": "deepseek-reasoner",
197 "display_name": "DeepSeek Reasoner",
198 "max_tokens": 64000,
199 "max_output_tokens": 4096
200 }
201 ]
202 }
203 }
204}
205```
206
207Custom models will be listed in the model dropdown in the Agent Panel.
208You can also modify the `api_url` to use a custom endpoint if needed.
209
210### GitHub Copilot Chat {#github-copilot-chat}
211
212> ✅ Supports tool use in some cases.
213> 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.
214
215You can use GitHub Copilot Chat with the Zed agent by choosing it via the model dropdown in the Agent Panel.
216
2171. Open the settings view (`agent: open configuration`) and go to the GitHub Copilot Chat section
2182. Click on `Sign in to use GitHub Copilot`, follow the steps shown in the modal.
219
220Alternatively, you can provide an OAuth token via the `GH_COPILOT_TOKEN` environment variable.
221
222> **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).
223
224### Google AI {#google-ai}
225
226> ✅ Supports tool use
227
228You can use Gemini models with the Zed agent by choosing it via the model dropdown in the Agent Panel.
229
2301. Go to the Google AI Studio site and [create an API key](https://aistudio.google.com/app/apikey).
2312. Open the settings view (`agent: open configuration`) and go to the Google AI section
2323. Enter your Google AI API key and press enter.
233
234The Google AI API key will be saved in your keychain.
235
236Zed will also use the `GOOGLE_AI_API_KEY` environment variable if it's defined.
237
238#### Custom Models {#google-ai-custom-models}
239
240By 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.
241
242Here is an example of a custom Google AI model you could add to your Zed `settings.json`:
243
244```json
245{
246 "language_models": {
247 "google": {
248 "available_models": [
249 {
250 "name": "gemini-2.5-flash-preview-05-20",
251 "display_name": "Gemini 2.5 Flash (Thinking)",
252 "max_tokens": 1000000,
253 "mode": {
254 "type": "thinking",
255 "budget_tokens": 24000
256 }
257 }
258 ]
259 }
260 }
261}
262```
263
264Custom models will be listed in the model dropdown in the Agent Panel.
265
266### LM Studio {#lmstudio}
267
268> ✅ Supports tool use
269
2701. Download and install [the latest version of LM Studio](https://lmstudio.ai/download)
2712. In the app press `cmd/ctrl-shift-m` and download at least one model (e.g., qwen2.5-coder-7b). Alternatively, you can get models via the LM Studio CLI:
272
273 ```sh
274 lms get qwen2.5-coder-7b
275 ```
276
2773. Make sure the LM Studio API server is running by executing:
278
279 ```sh
280 lms server start
281 ```
282
283Tip: 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.
284
285### Mistral {#mistral}
286
287> ✅ Supports tool use
288
2891. Visit the Mistral platform and [create an API key](https://console.mistral.ai/api-keys/)
2902. Open the configuration view (`agent: open configuration`) and navigate to the Mistral section
2913. Enter your Mistral API key
292
293The Mistral API key will be saved in your keychain.
294
295Zed will also use the `MISTRAL_API_KEY` environment variable if it's defined.
296
297#### Custom Models {#mistral-custom-models}
298
299The Zed agent 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).
300All the default models support tool use.
301If you wish to use alternate models or customize their parameters, you can do so by adding the following to your Zed `settings.json`:
302
303```json
304{
305 "language_models": {
306 "mistral": {
307 "api_url": "https://api.mistral.ai/v1",
308 "available_models": [
309 {
310 "name": "mistral-tiny-latest",
311 "display_name": "Mistral Tiny",
312 "max_tokens": 32000,
313 "max_output_tokens": 4096,
314 "max_completion_tokens": 1024,
315 "supports_tools": true,
316 "supports_images": false
317 }
318 ]
319 }
320 }
321}
322```
323
324Custom models will be listed in the model dropdown in the Agent Panel.
325
326### Ollama {#ollama}
327
328> ✅ Supports tool use
329
330Download and install Ollama from [ollama.com/download](https://ollama.com/download) (Linux or macOS) and ensure it's running with `ollama --version`.
331
3321. Download one of the [available models](https://ollama.com/models), for example, for `mistral`:
333
334 ```sh
335 ollama pull mistral
336 ```
337
3382. Make sure that the Ollama server is running. You can start it either via running Ollama.app (macOS) or launching:
339
340 ```sh
341 ollama serve
342 ```
343
3443. In the Agent Panel, select one of the Ollama models using the model dropdown.
345
346#### Ollama Context Length {#ollama-context}
347
348Zed has pre-configured maximum context lengths (`max_tokens`) to match the capabilities of common models.
349Zed API requests to Ollama include this as the `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.
350
351See [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.
352
353> **Note**: Token counts displayed in the Agent Panel are only estimates and will differ from the model's native tokenizer.
354
355Depending on your hardware or use-case you may wish to limit or increase the context length for a specific model via settings.json:
356
357```json
358{
359 "language_models": {
360 "ollama": {
361 "api_url": "http://localhost:11434",
362 "available_models": [
363 {
364 "name": "qwen2.5-coder",
365 "display_name": "qwen 2.5 coder 32K",
366 "max_tokens": 32768,
367 "supports_tools": true,
368 "supports_thinking": true,
369 "supports_images": true
370 }
371 ]
372 }
373 }
374}
375```
376
377If you specify a context length that is too large for your hardware, Ollama will log an error.
378You can watch these logs by running: `tail -f ~/.ollama/logs/ollama.log` (macOS) or `journalctl -u ollama -f` (Linux).
379Depending on the memory available on your machine, you may need to adjust the context length to a smaller value.
380
381You may also optionally specify a value for `keep_alive` for each available model.
382This can be an integer (seconds) or alternatively a string duration like "5m", "10m", "1h", "1d", etc.
383For example, `"keep_alive": "120s"` will allow the remote server to unload the model (freeing up GPU VRAM) after 120 seconds.
384
385The `supports_tools` option controls whether the model will use additional tools.
386If the model is tagged with `tools` in the Ollama catalog, this option should be supplied, and the built-in profiles `Ask` and `Write` can be used.
387If the model is not tagged with `tools` in the Ollama catalog, this option can still be supplied with the value `true`; however, be aware that only the `Minimal` built-in profile will work.
388
389The `supports_thinking` option controls whether the model will perform an explicit "thinking" (reasoning) pass before producing its final answer.
390If the model is tagged with `thinking` in the Ollama catalog, set this option and you can use it in Zed.
391
392The `supports_images` option enables the model's vision capabilities, allowing it to process images included in the conversation context.
393If the model is tagged with `vision` in the Ollama catalog, set this option and you can use it in Zed.
394
395### OpenAI {#openai}
396
397> ✅ Supports tool use
398
3991. Visit the OpenAI platform and [create an API key](https://platform.openai.com/account/api-keys)
4002. Make sure that your OpenAI account has credits
4013. Open the settings view (`agent: open configuration`) and go to the OpenAI section
4024. Enter your OpenAI API key
403
404The OpenAI API key will be saved in your keychain.
405
406Zed will also use the `OPENAI_API_KEY` environment variable if it's defined.
407
408#### Custom Models {#openai-custom-models}
409
410The Zed agent 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).
411To 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`:
412
413```json
414{
415 "language_models": {
416 "openai": {
417 "available_models": [
418 {
419 "name": "gpt-4o-2024-08-06",
420 "display_name": "GPT 4o Summer 2024",
421 "max_tokens": 128000
422 },
423 {
424 "name": "o1-mini",
425 "display_name": "o1-mini",
426 "max_tokens": 128000,
427 "max_completion_tokens": 20000
428 }
429 ],
430 "version": "1"
431 }
432 }
433}
434```
435
436You 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).
437
438OpenAI `o1` models should set `max_completion_tokens` as well to avoid incurring high reasoning token costs.
439Custom models will be listed in the model dropdown in the Agent Panel.
440
441### OpenAI API Compatible {#openai-api-compatible}
442
443Zed supports using OpenAI compatible APIs by specifying a custom `endpoint` and `available_models` for the OpenAI provider.
444
445You can add a custom API URL for OpenAI either via the UI or by editing your `settings.json`.
446Here are a few model examples you can plug in by using this feature:
447
448#### X.ai Grok
449
450Example configuration for using X.ai Grok with Zed:
451
452```json
453 "language_models": {
454 "openai": {
455 "api_url": "https://api.x.ai/v1",
456 "available_models": [
457 {
458 "name": "grok-beta",
459 "display_name": "X.ai Grok (Beta)",
460 "max_tokens": 131072
461 }
462 ],
463 "version": "1"
464 },
465 }
466```
467
468### OpenRouter {#openrouter}
469
470> ✅ Supports tool use
471
472OpenRouter provides access to multiple AI models through a single API. It supports tool use for compatible models.
473
4741. Visit [OpenRouter](https://openrouter.ai) and create an account
4752. Generate an API key from your [OpenRouter keys page](https://openrouter.ai/keys)
4763. Open the settings view (`agent: open configuration`) and go to the OpenRouter section
4774. Enter your OpenRouter API key
478
479The OpenRouter API key will be saved in your keychain.
480
481Zed will also use the `OPENROUTER_API_KEY` environment variable if it's defined.
482
483#### Custom Models {#openrouter-custom-models}
484
485You can add custom models to the OpenRouter provider by adding the following to your Zed `settings.json`:
486
487```json
488{
489 "language_models": {
490 "open_router": {
491 "api_url": "https://openrouter.ai/api/v1",
492 "available_models": [
493 {
494 "name": "google/gemini-2.0-flash-thinking-exp",
495 "display_name": "Gemini 2.0 Flash (Thinking)",
496 "max_tokens": 200000,
497 "max_output_tokens": 8192,
498 "supports_tools": true,
499 "supports_images": true,
500 "mode": {
501 "type": "thinking",
502 "budget_tokens": 8000
503 }
504 }
505 ]
506 }
507 }
508}
509```
510
511The available configuration options for each model are:
512
513- `name` (required): The model identifier used by OpenRouter
514- `display_name` (optional): A human-readable name shown in the UI
515- `max_tokens` (required): The model's context window size
516- `max_output_tokens` (optional): Maximum tokens the model can generate
517- `max_completion_tokens` (optional): Maximum completion tokens
518- `supports_tools` (optional): Whether the model supports tool/function calling
519- `supports_images` (optional): Whether the model supports image inputs
520- `mode` (optional): Special mode configuration for thinking models
521
522You can find available models and their specifications on the [OpenRouter models page](https://openrouter.ai/models).
523
524Custom models will be listed in the model dropdown in the Agent Panel.
525
526### Vercel v0
527
528[Vercel v0](https://vercel.com/docs/v0/api) is an expert model for generating full-stack apps, with framework-aware completions optimized for modern stacks like Next.js and Vercel.
529It supports text and image inputs and provides fast streaming responses.
530
531The v0 models are [OpenAI-compatible models](/#openai-api-compatible), but Vercel is listed as first-class provider in the panel's settings view.
532
533To start using it with Zed, ensure you have first created a [v0 API key](https://v0.dev/chat/settings/keys).
534Once you have it, paste it directly into the Vercel provider section in the panel's settings view.
535
536You should then find it as `v0-1.5-md` in the model dropdown in the Agent Panel.
537
538## Advanced Configuration {#advanced-configuration}
539
540### Custom Provider Endpoints {#custom-provider-endpoint}
541
542You can use a custom API endpoint for different providers, as long as it's compatible with the provider's API structure.
543To do so, add the following to your `settings.json`:
544
545```json
546{
547 "language_models": {
548 "some-provider": {
549 "api_url": "http://localhost:11434"
550 }
551 }
552}
553```
554
555Where `some-provider` can be any of the following values: `anthropic`, `google`, `ollama`, `openai`.
556
557### Default Model {#default-model}
558
559Zed's hosted LLM service sets `claude-sonnet-4` as the default model.
560However, 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:
561
562```json
563{
564 "agent": {
565 "version": "2",
566 "default_model": {
567 "provider": "zed.dev",
568 "model": "gpt-4o"
569 }
570 }
571}
572```
573
574### Feature-specific Models {#feature-specific-models}
575
576If 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.
577
578You can configure the following feature-specific models:
579
580- Thread summary model: Used for generating thread summaries
581- Inline assistant model: Used for the inline assistant feature
582- Commit message model: Used for generating Git commit messages
583
584Example configuration:
585
586```json
587{
588 "agent": {
589 "version": "2",
590 "default_model": {
591 "provider": "zed.dev",
592 "model": "claude-sonnet-4"
593 },
594 "inline_assistant_model": {
595 "provider": "anthropic",
596 "model": "claude-3-5-sonnet"
597 },
598 "commit_message_model": {
599 "provider": "openai",
600 "model": "gpt-4o-mini"
601 },
602 "thread_summary_model": {
603 "provider": "google",
604 "model": "gemini-2.0-flash"
605 }
606 }
607}
608```
609
610### Alternative Models for Inline Assists {#alternative-assists}
611
612You can configure additional models that will be used to perform inline assists in parallel.
613When you do this, the inline assist UI will surface controls to cycle between the alternatives generated by each model.
614
615The models you specify here are always used in _addition_ to your [default model](#default-model).
616For example, the following configuration will generate two outputs for every assist.
617One with Claude 3.7 Sonnet, and one with GPT-4o.
618
619```json
620{
621 "agent": {
622 "default_model": {
623 "provider": "zed.dev",
624 "model": "claude-sonnet-4"
625 },
626 "inline_alternatives": [
627 {
628 "provider": "zed.dev",
629 "model": "gpt-4o"
630 }
631 ],
632 "version": "2"
633 }
634}
635```
636
637### Default View
638
639Use the `default_view` setting to set change the default view of the Agent Panel.
640You can choose between `thread` (the default) and `text_thread`:
641
642```json
643{
644 "agent": {
645 "default_view": "text_thread"
646 }
647}
648```
649
650### Edit Card
651
652Use the `expand_edit_card` setting to control whether edit cards show the full diff in the Agent Panel.
653It is set to `true` by default, but if set to false, the card's height is capped to a certain number of lines, requiring a click to be expanded.
654
655```json
656{
657 "agent": {
658 "expand_edit_card": "false"
659 }
660}
661```
662
663This setting is currently only available in Preview.
664It should be up in Stable by the next release.