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). 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.
230
231Here is an example of a custom Google AI model you could add to your Zed `settings.json`:
232
233```json
234{
235 "language_models": {
236 "google": {
237 "available_models": [
238 {
239 "name": "gemini-2.5-flash-preview-05-20",
240 "display_name": "Gemini 2.5 Flash (Thinking)",
241 "max_tokens": 1000000,
242 "mode": {
243 "type": "thinking",
244 "budget_tokens": 24000
245 }
246 }
247 ]
248 }
249 }
250}
251```
252
253Custom models will be listed in the model dropdown in the Agent Panel.
254
255### LM Studio {#lmstudio}
256
257> ✅ Supports tool use
258
2591. Download and install the latest version of LM Studio from https://lmstudio.ai/download
2602. In the app press ⌘/Ctrl + Shift + M and download at least one model, e.g. qwen2.5-coder-7b
261
262 You can also get models via the LM Studio CLI:
263
264 ```sh
265 lms get qwen2.5-coder-7b
266 ```
267
2683. Make sure the LM Studio API server is running by executing:
269
270 ```sh
271 lms server start
272 ```
273
274Tip: 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.
275
276### Mistral {#mistral}
277
278> ✅ Supports tool use
279
2801. Visit the Mistral platform and [create an API key](https://console.mistral.ai/api-keys/)
2812. Open the configuration view (`assistant: show configuration`) and navigate to the Mistral section
2823. Enter your Mistral API key
283
284The Mistral API key will be saved in your keychain.
285
286Zed will also use the `MISTRAL_API_KEY` environment variable if it's defined.
287
288#### Custom Models {#mistral-custom-models}
289
290The 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`:
291
292```json
293{
294 "language_models": {
295 "mistral": {
296 "api_url": "https://api.mistral.ai/v1",
297 "available_models": [
298 {
299 "name": "mistral-tiny-latest",
300 "display_name": "Mistral Tiny",
301 "max_tokens": 32000,
302 "max_output_tokens": 4096,
303 "max_completion_tokens": 1024,
304 "supports_tools": true
305 }
306 ]
307 }
308 }
309}
310```
311
312Custom models will be listed in the model dropdown in the assistant panel.
313
314### Ollama {#ollama}
315
316> ✅ Supports tool use
317
318Download and install Ollama from [ollama.com/download](https://ollama.com/download) (Linux or macOS) and ensure it's running with `ollama --version`.
319
3201. Download one of the [available models](https://ollama.com/models), for example, for `mistral`:
321
322 ```sh
323 ollama pull mistral
324 ```
325
3262. Make sure that the Ollama server is running. You can start it either via running Ollama.app (macOS) or launching:
327
328 ```sh
329 ollama serve
330 ```
331
3323. In the Agent Panel, select one of the Ollama models using the model dropdown.
333
334#### Ollama Context Length {#ollama-context}
335
336Zed has pre-configured maximum context lengths (`max_tokens`) to match the capabilities of common models.
337Zed 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.
338See [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.
339
340> **Note**: Token counts displayed in the Agent Panel are only estimates and will differ from the model's native tokenizer.
341
342Depending on your hardware or use-case you may wish to limit or increase the context length for a specific model via settings.json:
343
344```json
345{
346 "language_models": {
347 "ollama": {
348 "api_url": "http://localhost:11434",
349 "available_models": [
350 {
351 "name": "qwen2.5-coder",
352 "display_name": "qwen 2.5 coder 32K",
353 "max_tokens": 32768,
354 "supports_tools": true
355 }
356 ]
357 }
358 }
359}
360```
361
362If you specify a context length that is too large for your hardware, Ollama will log an error.
363You can watch these logs by running: `tail -f ~/.ollama/logs/ollama.log` (macOS) or `journalctl -u ollama -f` (Linux).
364Depending on the memory available on your machine, you may need to adjust the context length to a smaller value.
365
366You may also optionally specify a value for `keep_alive` for each available model.
367This can be an integer (seconds) or alternatively a string duration like "5m", "10m", "1h", "1d", etc.
368For example, `"keep_alive": "120s"` will allow the remote server to unload the model (freeing up GPU VRAM) after 120 seconds.
369
370The `supports_tools` option controls whether or not the model will use additional tools.
371If 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.
372If 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.
373
374### OpenAI {#openai}
375
376> ✅ Supports tool use
377
3781. Visit the OpenAI platform and [create an API key](https://platform.openai.com/account/api-keys)
3792. Make sure that your OpenAI account has credits
3803. Open the settings view (`agent: open configuration`) and go to the OpenAI section
3814. Enter your OpenAI API key
382
383The OpenAI API key will be saved in your keychain.
384
385Zed will also use the `OPENAI_API_KEY` environment variable if it's defined.
386
387#### Custom Models {#openai-custom-models}
388
389The 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).
390To 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`:
391
392```json
393{
394 "language_models": {
395 "openai": {
396 "available_models": [
397 {
398 "name": "gpt-4o-2024-08-06",
399 "display_name": "GPT 4o Summer 2024",
400 "max_tokens": 128000
401 },
402 {
403 "name": "o1-mini",
404 "display_name": "o1-mini",
405 "max_tokens": 128000,
406 "max_completion_tokens": 20000
407 }
408 ],
409 "version": "1"
410 }
411 }
412}
413```
414
415You 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).
416OpenAI `o1` models should set `max_completion_tokens` as well to avoid incurring high reasoning token costs.
417Custom models will be listed in the model dropdown in the Agent Panel.
418
419### OpenAI API Compatible {#openai-api-compatible}
420
421Zed supports using OpenAI compatible APIs by specifying a custom `endpoint` and `available_models` for the OpenAI provider.
422
423#### X.ai Grok
424
425Example configuration for using X.ai Grok with Zed:
426
427```json
428 "language_models": {
429 "openai": {
430 "api_url": "https://api.x.ai/v1",
431 "available_models": [
432 {
433 "name": "grok-beta",
434 "display_name": "X.ai Grok (Beta)",
435 "max_tokens": 131072
436 }
437 ],
438 "version": "1"
439 },
440 }
441```
442
443## Advanced Configuration {#advanced-configuration}
444
445### Custom Provider Endpoints {#custom-provider-endpoint}
446
447You can use a custom API endpoint for different providers, as long as it's compatible with the provider's API structure.
448To do so, add the following to your `settings.json`:
449
450```json
451{
452 "language_models": {
453 "some-provider": {
454 "api_url": "http://localhost:11434"
455 }
456 }
457}
458```
459
460Where `some-provider` can be any of the following values: `anthropic`, `google`, `ollama`, `openai`.
461
462### Default Model {#default-model}
463
464Zed's hosted LLM service sets `claude-sonnet-4` as the default model.
465However, 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:
466
467```json
468{
469 "agent": {
470 "version": "2",
471 "default_model": {
472 "provider": "zed.dev",
473 "model": "gpt-4o"
474 }
475 }
476}
477```
478
479### Feature-specific Models {#feature-specific-models}
480
481If 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.
482
483You can configure the following feature-specific models:
484
485- Thread summary model: Used for generating thread summaries
486- Inline assistant model: Used for the inline assistant feature
487- Commit message model: Used for generating Git commit messages
488
489Example configuration:
490
491```json
492{
493 "agent": {
494 "version": "2",
495 "default_model": {
496 "provider": "zed.dev",
497 "model": "claude-sonnet-4"
498 },
499 "inline_assistant_model": {
500 "provider": "anthropic",
501 "model": "claude-3-5-sonnet"
502 },
503 "commit_message_model": {
504 "provider": "openai",
505 "model": "gpt-4o-mini"
506 },
507 "thread_summary_model": {
508 "provider": "google",
509 "model": "gemini-2.0-flash"
510 }
511 }
512}
513```
514
515### Alternative Models for Inline Assists {#alternative-assists}
516
517You can configure additional models that will be used to perform inline assists in parallel.
518When you do this, the inline assist UI will surface controls to cycle between the alternatives generated by each model.
519
520The models you specify here are always used in _addition_ to your [default model](#default-model).
521For example, the following configuration will generate two outputs for every assist.
522One with Claude 3.7 Sonnet, and one with GPT-4o.
523
524```json
525{
526 "agent": {
527 "default_model": {
528 "provider": "zed.dev",
529 "model": "claude-sonnet-4"
530 },
531 "inline_alternatives": [
532 {
533 "provider": "zed.dev",
534 "model": "gpt-4o"
535 }
536 ],
537 "version": "2"
538 }
539}
540```
541
542## Default View
543
544Use the `default_view` setting to set change the default view of the Agent Panel.
545You can choose between `thread` (the default) and `text_thread`:
546
547```json
548{
549 "agent": {
550 "default_view": "text_thread".
551 }
552}
553```