1# LLM Providers
2
3To use AI in Zed, you need to have at least one large language model provider set up.
4
5You can do that by either subscribing to [one of Zed's plans](./plans-and-usage.md), or by using API keys you already have for the supported providers.
6
7## Use Your Own Keys {#use-your-own-keys}
8
9If you already have an API key for an existing LLM provider, like Anthropic or OpenAI, you can add them to Zed and use the full power of the Agent Panel **_for free_**.
10
11To add an existing API key to a given provider, go to the Agent Panel settings (`agent: open settings`), look for the desired provider, paste the key into the input, and hit enter.
12
13> Note: API keys are _not_ stored as plain text in your `settings.json`, but rather in your OS's secure credential storage.
14
15## Supported Providers
16
17Zed offers an extensive list of "use your own key" LLM providers
18
19- [Amazon Bedrock](#amazon-bedrock)
20- [Anthropic](#anthropic)
21- [DeepSeek](#deepseek)
22- [GitHub Copilot Chat](#github-copilot-chat)
23- [Google AI](#google-ai)
24- [LM Studio](#lmstudio)
25- [Mistral](#mistral)
26- [Ollama](#ollama)
27- [OpenAI](#openai)
28- [OpenAI API Compatible](#openai-api-compatible)
29- [OpenRouter](#openrouter)
30- [Vercel](#vercel-v0)
31- [xAI](#xai)
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
44Your IAM policy should look similar to:
45
46```json [settings]
47{
48 "Version": "2012-10-17",
49 "Statement": [
50 {
51 "Effect": "Allow",
52 "Action": [
53 "bedrock:InvokeModel",
54 "bedrock:InvokeModelWithResponseStream"
55 ],
56 "Resource": "*"
57 }
58 ]
59}
60```
61
62With that done, choose one of the two authentication methods:
63
64#### Authentication via Named Profile (Recommended)
65
661. Ensure you have the AWS CLI installed and configured with a named profile
672. Open your `settings.json` (`zed: open settings file`) and include the `bedrock` key under `language_models` with the following settings:
68 ```json [settings]
69 {
70 "language_models": {
71 "bedrock": {
72 "authentication_method": "named_profile",
73 "region": "your-aws-region",
74 "profile": "your-profile-name"
75 }
76 }
77 }
78 ```
79
80#### Authentication via Static Credentials
81
82While 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.
83To do this:
84
851. 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).
862. Create security credentials for that User, save them and keep them secure.
873. Open the Agent Configuration with (`agent: open settings`) and go to the Amazon Bedrock section
884. Copy the credentials from Step 2 into the respective **Access Key ID**, **Secret Access Key**, and **Region** fields.
89
90#### Cross-Region Inference
91
92The Zed implementation of Amazon Bedrock uses [Cross-Region inference](https://docs.aws.amazon.com/bedrock/latest/userguide/cross-region-inference.html) to improve availability and throughput.
93With Cross-Region inference, you can distribute traffic across multiple AWS Regions, enabling higher throughput.
94
95##### Regional vs Global Inference Profiles
96
97Bedrock supports two types of cross-region inference profiles:
98
99- **Regional profiles** (default): Route requests within a specific geography (US, EU, APAC). For example, `us-east-1` uses the `us.*` profile which routes across `us-east-1`, `us-east-2`, and `us-west-2`.
100- **Global profiles**: Route requests across all commercial AWS Regions for maximum availability and performance.
101
102By default, Zed uses **regional profiles** which keep your data within the same geography. You can opt into global profiles by adding `"allow_global": true` to your Bedrock configuration:
103
104```json [settings]
105{
106 "language_models": {
107 "bedrock": {
108 "authentication_method": "named_profile",
109 "region": "your-aws-region",
110 "profile": "your-profile-name",
111 "allow_global": true
112 }
113 }
114}
115```
116
117**Note:** Only select newer models support global inference profiles. See the [AWS Bedrock supported models documentation](https://docs.aws.amazon.com/bedrock/latest/userguide/inference-profiles-support.html#inference-profiles-support-system) for the current list of models that support global inference. If you encounter availability issues with a model in your region, enabling `allow_global` may resolve them.
118
119Although 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.
120All data will be transmitted encrypted across Amazon's secure network.
121
122We 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).
123
124For 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).
125
126### Anthropic {#anthropic}
127
128You can use Anthropic models by choosing them via the model dropdown in the Agent Panel.
129
1301. Sign up for Anthropic and [create an API key](https://console.anthropic.com/settings/keys)
1312. Make sure that your Anthropic account has credits
1323. Open the settings view (`agent: open settings`) and go to the Anthropic section
1334. Enter your Anthropic API key
134
135Even 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.
136
137Zed will also use the `ANTHROPIC_API_KEY` environment variable if it's defined.
138
139#### Custom Models {#anthropic-custom-models}
140
141You can add custom models to the Anthropic provider by adding the following to your Zed `settings.json`:
142
143```json [settings]
144{
145 "language_models": {
146 "anthropic": {
147 "available_models": [
148 {
149 "name": "claude-3-5-sonnet-20240620",
150 "display_name": "Sonnet 2024-June",
151 "max_tokens": 128000,
152 "max_output_tokens": 2560,
153 "cache_configuration": {
154 "max_cache_anchors": 10,
155 "min_total_token": 10000,
156 "should_speculate": false
157 },
158 "tool_override": "some-model-that-supports-toolcalling"
159 }
160 ]
161 }
162 }
163}
164```
165
166Custom models will be listed in the model dropdown in the Agent Panel.
167
168You 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:
169
170```json [settings]
171{
172 "name": "claude-sonnet-4-latest",
173 "display_name": "claude-sonnet-4-thinking",
174 "max_tokens": 200000,
175 "mode": {
176 "type": "thinking",
177 "budget_tokens": 4096
178 }
179}
180```
181
182### DeepSeek {#deepseek}
183
1841. Visit the DeepSeek platform and [create an API key](https://platform.deepseek.com/api_keys)
1852. Open the settings view (`agent: open settings`) and go to the DeepSeek section
1863. Enter your DeepSeek API key
187
188The DeepSeek API key will be saved in your keychain.
189
190Zed will also use the `DEEPSEEK_API_KEY` environment variable if it's defined.
191
192#### Custom Models {#deepseek-custom-models}
193
194The Zed agent comes pre-configured to use the latest version for common models (DeepSeek Chat, DeepSeek Reasoner).
195If you wish to use alternate models or customize the API endpoint, you can do so by adding the following to your Zed `settings.json`:
196
197```json [settings]
198{
199 "language_models": {
200 "deepseek": {
201 "api_url": "https://api.deepseek.com",
202 "available_models": [
203 {
204 "name": "deepseek-chat",
205 "display_name": "DeepSeek Chat",
206 "max_tokens": 64000
207 },
208 {
209 "name": "deepseek-reasoner",
210 "display_name": "DeepSeek Reasoner",
211 "max_tokens": 64000,
212 "max_output_tokens": 4096
213 }
214 ]
215 }
216 }
217}
218```
219
220Custom models will be listed in the model dropdown in the Agent Panel.
221You can also modify the `api_url` to use a custom endpoint if needed.
222
223### GitHub Copilot Chat {#github-copilot-chat}
224
225You can use GitHub Copilot Chat with the Zed agent by choosing it via the model dropdown in the Agent Panel.
226
2271. Open the settings view (`agent: open settings`) and go to the GitHub Copilot Chat section
2282. Click on `Sign in to use GitHub Copilot`, follow the steps shown in the modal.
229
230Alternatively, you can provide an OAuth token via the `GH_COPILOT_TOKEN` environment variable.
231
232> **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).
233
234To use Copilot Enterprise with Zed (for both agent and completions), you must configure your enterprise endpoint as described in [Configuring GitHub Copilot Enterprise](./edit-prediction.md#github-copilot-enterprise).
235
236### Google AI {#google-ai}
237
238You can use Gemini models with the Zed agent by choosing it via the model dropdown in the Agent Panel.
239
2401. Go to the Google AI Studio site and [create an API key](https://aistudio.google.com/app/apikey).
2412. Open the settings view (`agent: open settings`) and go to the Google AI section
2423. Enter your Google AI API key and press enter.
243
244The Google AI API key will be saved in your keychain.
245
246Zed will also use the `GEMINI_API_KEY` environment variable if it's defined. See [Using Gemini API keys](https://ai.google.dev/gemini-api/docs/api-key) in the Gemini docs for more.
247
248#### Custom Models {#google-ai-custom-models}
249
250By 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.
251
252Here is an example of a custom Google AI model you could add to your Zed `settings.json`:
253
254```json [settings]
255{
256 "language_models": {
257 "google": {
258 "available_models": [
259 {
260 "name": "gemini-2.5-flash-preview-05-20",
261 "display_name": "Gemini 2.5 Flash (Thinking)",
262 "max_tokens": 1000000,
263 "mode": {
264 "type": "thinking",
265 "budget_tokens": 24000
266 }
267 }
268 ]
269 }
270 }
271}
272```
273
274Custom models will be listed in the model dropdown in the Agent Panel.
275
276### LM Studio {#lmstudio}
277
2781. Download and install [the latest version of LM Studio](https://lmstudio.ai/download)
2792. 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:
280
281 ```sh
282 lms get qwen2.5-coder-7b
283 ```
284
2853. Make sure the LM Studio API server is running by executing:
286
287 ```sh
288 lms server start
289 ```
290
291Tip: 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.
292
293### Mistral {#mistral}
294
2951. Visit the Mistral platform and [create an API key](https://console.mistral.ai/api-keys/)
2962. Open the configuration view (`agent: open settings`) and navigate to the Mistral section
2973. Enter your Mistral API key
298
299The Mistral API key will be saved in your keychain.
300
301Zed will also use the `MISTRAL_API_KEY` environment variable if it's defined.
302
303#### Custom Models {#mistral-custom-models}
304
305The 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).
306All the default models support tool use.
307If you wish to use alternate models or customize their parameters, you can do so by adding the following to your Zed `settings.json`:
308
309```json [settings]
310{
311 "language_models": {
312 "mistral": {
313 "api_url": "https://api.mistral.ai/v1",
314 "available_models": [
315 {
316 "name": "mistral-tiny-latest",
317 "display_name": "Mistral Tiny",
318 "max_tokens": 32000,
319 "max_output_tokens": 4096,
320 "max_completion_tokens": 1024,
321 "supports_tools": true,
322 "supports_images": false
323 }
324 ]
325 }
326 }
327}
328```
329
330Custom models will be listed in the model dropdown in the Agent Panel.
331
332### Ollama {#ollama}
333
334Download and install Ollama from [ollama.com/download](https://ollama.com/download) (Linux or macOS) and ensure it's running with `ollama --version`.
335
3361. Download one of the [available models](https://ollama.com/models), for example, for `mistral`:
337
338 ```sh
339 ollama pull mistral
340 ```
341
3422. Make sure that the Ollama server is running. You can start it either via running Ollama.app (macOS) or launching:
343
344 ```sh
345 ollama serve
346 ```
347
3483. In the Agent Panel, select one of the Ollama models using the model dropdown.
349
350#### Ollama Autodiscovery
351
352Zed will automatically discover models that Ollama has pulled. You can turn this off by setting
353the `auto_discover` field in the Ollama settings. If you do this, you should manually specify which
354models are available.
355
356```json [settings]
357{
358 "language_models": {
359 "ollama": {
360 "api_url": "http://localhost:11434",
361 "auto_discover": false,
362 "available_models": [
363 {
364 "name": "qwen2.5-coder",
365 "display_name": "qwen 2.5 coder",
366 "max_tokens": 32768,
367 "supports_tools": true,
368 "supports_thinking": true,
369 "supports_images": true
370 }
371 ]
372 }
373 }
374}
375```
376
377#### Ollama Context Length {#ollama-context}
378
379Zed has pre-configured maximum context lengths (`max_tokens`) to match the capabilities of common models.
380Zed 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.
381
382See [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.
383
384> **Note**: Token counts displayed in the Agent Panel are only estimates and will differ from the model's native tokenizer.
385
386Depending on your hardware or use-case you may wish to limit or increase the context length for a specific model via settings.json:
387
388```json [settings]
389{
390 "language_models": {
391 "ollama": {
392 "api_url": "http://localhost:11434",
393 "available_models": [
394 {
395 "name": "qwen2.5-coder",
396 "display_name": "qwen 2.5 coder 32K",
397 "max_tokens": 32768,
398 "supports_tools": true,
399 "supports_thinking": true,
400 "supports_images": true
401 }
402 ]
403 }
404 }
405}
406```
407
408If you specify a context length that is too large for your hardware, Ollama will log an error.
409You can watch these logs by running: `tail -f ~/.ollama/logs/ollama.log` (macOS) or `journalctl -u ollama -f` (Linux).
410Depending on the memory available on your machine, you may need to adjust the context length to a smaller value.
411
412You may also optionally specify a value for `keep_alive` for each available model.
413This can be an integer (seconds) or alternatively a string duration like "5m", "10m", "1h", "1d", etc.
414For example, `"keep_alive": "120s"` will allow the remote server to unload the model (freeing up GPU VRAM) after 120 seconds.
415
416The `supports_tools` option controls whether the model will use additional tools.
417If 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.
418If 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.
419
420The `supports_thinking` option controls whether the model will perform an explicit "thinking" (reasoning) pass before producing its final answer.
421If the model is tagged with `thinking` in the Ollama catalog, set this option and you can use it in Zed.
422
423The `supports_images` option enables the model's vision capabilities, allowing it to process images included in the conversation context.
424If the model is tagged with `vision` in the Ollama catalog, set this option and you can use it in Zed.
425
426#### Ollama Authentication
427
428In addition to running Ollama on your own hardware, which generally does not require authentication, Zed also supports connecting to remote Ollama instances. API keys are required for authentication.
429
430One such service is [Ollama Turbo])(https://ollama.com/turbo). To configure Zed to use Ollama turbo:
431
4321. Sign in to your Ollama account and subscribe to Ollama Turbo
4332. Visit [ollama.com/settings/keys](https://ollama.com/settings/keys) and create an API key
4343. Open the settings view (`agent: open settings`) and go to the Ollama section
4354. Paste your API key and press enter.
4365. For the API URL enter `https://ollama.com`
437
438Zed will also use the `OLLAMA_API_KEY` environment variables if defined.
439
440### OpenAI {#openai}
441
4421. Visit the OpenAI platform and [create an API key](https://platform.openai.com/account/api-keys)
4432. Make sure that your OpenAI account has credits
4443. Open the settings view (`agent: open settings`) and go to the OpenAI section
4454. Enter your OpenAI API key
446
447The OpenAI API key will be saved in your keychain.
448
449Zed will also use the `OPENAI_API_KEY` environment variable if it's defined.
450
451#### Custom Models {#openai-custom-models}
452
453The Zed agent comes pre-configured to use the latest version for common models (GPT-5, GPT-5 mini, o4-mini, GPT-4.1, and others).
454To use alternate models, perhaps a preview release, or if you wish to control the request parameters, you can do so by adding the following to your Zed `settings.json`:
455
456```json [settings]
457{
458 "language_models": {
459 "openai": {
460 "available_models": [
461 {
462 "name": "gpt-5",
463 "display_name": "gpt-5 high",
464 "reasoning_effort": "high",
465 "max_tokens": 272000,
466 "max_completion_tokens": 20000
467 },
468 {
469 "name": "gpt-4o-2024-08-06",
470 "display_name": "GPT 4o Summer 2024",
471 "max_tokens": 128000
472 }
473 ]
474 }
475 }
476}
477```
478
479You 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).
480
481OpenAI `o1` models should set `max_completion_tokens` as well to avoid incurring high reasoning token costs.
482Custom models will be listed in the model dropdown in the Agent Panel.
483
484### OpenAI API Compatible {#openai-api-compatible}
485
486Zed supports using [OpenAI compatible APIs](https://platform.openai.com/docs/api-reference/chat) by specifying a custom `api_url` and `available_models` for the OpenAI provider.
487This is useful for connecting to other hosted services (like Together AI, Anyscale, etc.) or local models.
488
489You can add a custom, OpenAI-compatible model either via the UI or by editing your `settings.json`.
490
491To do it via the UI, go to the Agent Panel settings (`agent: open settings`) and look for the "Add Provider" button to the right of the "LLM Providers" section title.
492Then, fill up the input fields available in the modal.
493
494To do it via your `settings.json`, add the following snippet under `language_models`:
495
496```json [settings]
497{
498 "language_models": {
499 "openai_compatible": {
500 // Using Together AI as an example
501 "Together AI": {
502 "api_url": "https://api.together.xyz/v1",
503 "available_models": [
504 {
505 "name": "mistralai/Mixtral-8x7B-Instruct-v0.1",
506 "display_name": "Together Mixtral 8x7B",
507 "max_tokens": 32768,
508 "capabilities": {
509 "tools": true,
510 "images": false,
511 "parallel_tool_calls": false,
512 "prompt_cache_key": false
513 }
514 }
515 ]
516 }
517 }
518 }
519}
520```
521
522By default, OpenAI-compatible models inherit the following capabilities:
523
524- `tools`: true (supports tool/function calling)
525- `images`: false (does not support image inputs)
526- `parallel_tool_calls`: false (does not support `parallel_tool_calls` parameter)
527- `prompt_cache_key`: false (does not support `prompt_cache_key` parameter)
528
529Note that LLM API keys aren't stored in your settings file.
530So, ensure you have it set in your environment variables (`<PROVIDER_NAME>_API_KEY=<your api key>`) so your settings can pick it up. In the example above, it would be `TOGETHER_AI_API_KEY=<your api key>`.
531
532### OpenRouter {#openrouter}
533
534OpenRouter provides access to multiple AI models through a single API. It supports tool use for compatible models.
535
5361. Visit [OpenRouter](https://openrouter.ai) and create an account
5372. Generate an API key from your [OpenRouter keys page](https://openrouter.ai/keys)
5383. Open the settings view (`agent: open settings`) and go to the OpenRouter section
5394. Enter your OpenRouter API key
540
541The OpenRouter API key will be saved in your keychain.
542
543Zed will also use the `OPENROUTER_API_KEY` environment variable if it's defined.
544
545#### Custom Models {#openrouter-custom-models}
546
547You can add custom models to the OpenRouter provider by adding the following to your Zed `settings.json`:
548
549```json [settings]
550{
551 "language_models": {
552 "open_router": {
553 "api_url": "https://openrouter.ai/api/v1",
554 "available_models": [
555 {
556 "name": "google/gemini-2.0-flash-thinking-exp",
557 "display_name": "Gemini 2.0 Flash (Thinking)",
558 "max_tokens": 200000,
559 "max_output_tokens": 8192,
560 "supports_tools": true,
561 "supports_images": true,
562 "mode": {
563 "type": "thinking",
564 "budget_tokens": 8000
565 }
566 }
567 ]
568 }
569 }
570}
571```
572
573The available configuration options for each model are:
574
575- `name` (required): The model identifier used by OpenRouter
576- `display_name` (optional): A human-readable name shown in the UI
577- `max_tokens` (required): The model's context window size
578- `max_output_tokens` (optional): Maximum tokens the model can generate
579- `max_completion_tokens` (optional): Maximum completion tokens
580- `supports_tools` (optional): Whether the model supports tool/function calling
581- `supports_images` (optional): Whether the model supports image inputs
582- `mode` (optional): Special mode configuration for thinking models
583
584You can find available models and their specifications on the [OpenRouter models page](https://openrouter.ai/models).
585
586Custom models will be listed in the model dropdown in the Agent Panel.
587
588#### Provider Routing
589
590You can optionally control how OpenRouter routes a given custom model request among underlying upstream providers via the `provider` object on each model entry.
591
592Supported fields (all optional):
593
594- `order`: Array of provider slugs to try first, in order (e.g. `["anthropic", "openai"]`)
595- `allow_fallbacks` (default: `true`): Whether fallback providers may be used if preferred ones are unavailable
596- `require_parameters` (default: `false`): Only use providers that support every parameter you supplied
597- `data_collection` (default: `allow`): `"allow"` or `"disallow"` (controls use of providers that may store data)
598- `only`: Whitelist of provider slugs allowed for this request
599- `ignore`: Provider slugs to skip
600- `quantizations`: Restrict to specific quantization variants (e.g. `["int4","int8"]`)
601- `sort`: Sort strategy for candidate providers (e.g. `"price"` or `"throughput"`)
602
603Example adding routing preferences to a model:
604
605```json [settings]
606{
607 "language_models": {
608 "open_router": {
609 "api_url": "https://openrouter.ai/api/v1",
610 "available_models": [
611 {
612 "name": "openrouter/auto",
613 "display_name": "Auto Router (Tools Preferred)",
614 "max_tokens": 2000000,
615 "supports_tools": true,
616 "provider": {
617 "order": ["anthropic", "openai"],
618 "allow_fallbacks": true,
619 "require_parameters": true,
620 "only": ["anthropic", "openai", "google"],
621 "ignore": ["cohere"],
622 "quantizations": ["int8"],
623 "sort": "price",
624 "data_collection": "allow"
625 }
626 }
627 ]
628 }
629 }
630}
631```
632
633These routing controls let you fine‑tune cost, capability, and reliability trade‑offs without changing the model name you select in the UI.
634
635### Vercel v0 {#vercel-v0}
636
637[Vercel v0](https://v0.app/docs/api/model) is an expert model for generating full-stack apps, with framework-aware completions optimized for modern stacks like Next.js and Vercel.
638It supports text and image inputs and provides fast streaming responses.
639
640The v0 models are [OpenAI-compatible models](/#openai-api-compatible), but Vercel is listed as first-class provider in the panel's settings view.
641
642To start using it with Zed, ensure you have first created a [v0 API key](https://v0.dev/chat/settings/keys).
643Once you have it, paste it directly into the Vercel provider section in the panel's settings view.
644
645You should then find it as `v0-1.5-md` in the model dropdown in the Agent Panel.
646
647### xAI {#xai}
648
649Zed has first-class support for [xAI](https://x.ai/) models. You can use your own API key to access Grok models.
650
6511. [Create an API key in the xAI Console](https://console.x.ai/team/default/api-keys)
6522. Open the settings view (`agent: open settings`) and go to the **xAI** section
6533. Enter your xAI API key
654
655The xAI API key will be saved in your keychain. Zed will also use the `XAI_API_KEY` environment variable if it's defined.
656
657> **Note:** While the xAI API is OpenAI-compatible, Zed has first-class support for it as a dedicated provider. For the best experience, we recommend using the dedicated `x_ai` provider configuration instead of the [OpenAI API Compatible](#openai-api-compatible) method.
658
659#### Custom Models {#xai-custom-models}
660
661The Zed agent comes pre-configured with common Grok models. If you wish to use alternate models or customize their parameters, you can do so by adding the following to your Zed `settings.json`:
662
663```json [settings]
664{
665 "language_models": {
666 "x_ai": {
667 "api_url": "https://api.x.ai/v1",
668 "available_models": [
669 {
670 "name": "grok-1.5",
671 "display_name": "Grok 1.5",
672 "max_tokens": 131072,
673 "max_output_tokens": 8192
674 },
675 {
676 "name": "grok-1.5v",
677 "display_name": "Grok 1.5V (Vision)",
678 "max_tokens": 131072,
679 "max_output_tokens": 8192,
680 "supports_images": true
681 }
682 ]
683 }
684 }
685}
686```
687
688## Custom Provider Endpoints {#custom-provider-endpoint}
689
690You can use a custom API endpoint for different providers, as long as it's compatible with the provider's API structure.
691To do so, add the following to your `settings.json`:
692
693```json [settings]
694{
695 "language_models": {
696 "some-provider": {
697 "api_url": "http://localhost:11434"
698 }
699 }
700}
701```
702
703Currently, `some-provider` can be any of the following values: `anthropic`, `google`, `ollama`, `openai`.
704
705This is the same infrastructure that powers models that are, for example, [OpenAI-compatible](#openai-api-compatible).