1---
2title: LLM Providers - Use Your Own API Keys in Zed
3description: Bring your own API keys to Zed. Set up Anthropic, OpenAI, Google AI, Ollama, DeepSeek, Mistral, OpenRouter, and more.
4---
5
6# LLM Providers
7
8To use AI in Zed, you need to have at least one large language model provider set up. Once configured, providers are available in the [Agent Panel](./agent-panel.md), [Inline Assistant](./inline-assistant.md), and [Text Threads](./text-threads.md).
9
10You 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. For general AI setup, see [Configuration](./configuration.md).
11
12## Use Your Own Keys {#use-your-own-keys}
13
14If you already have an API key for a provider like Anthropic or OpenAI, you can add it to Zed. No Zed subscription required.
15
16To 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.
17
18> Note: API keys are _not_ stored as plain text in your `settings.json`, but rather in your OS's secure credential storage.
19
20## Supported Providers
21
22Zed supports these providers with your own API keys:
23
24- [Amazon Bedrock](#amazon-bedrock)
25- [Anthropic](#anthropic)
26- [DeepSeek](#deepseek)
27- [GitHub Copilot Chat](#github-copilot-chat)
28- [Google AI](#google-ai)
29- [LM Studio](#lmstudio)
30- [Mistral](#mistral)
31- [Ollama](#ollama)
32- [OpenAI](#openai)
33- [OpenAI API Compatible](#openai-api-compatible)
34- [OpenRouter](#openrouter)
35- [Vercel](#vercel-v0)
36- [xAI](#xai)
37
38### Amazon Bedrock {#amazon-bedrock}
39
40> Supports tool use with models that support streaming tool use.
41> 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).
42
43To use Amazon Bedrock's models, an AWS authentication is required.
44Ensure your credentials have the following permissions set up:
45
46- `bedrock:InvokeModelWithResponseStream`
47- `bedrock:InvokeModel`
48
49Your IAM policy should look similar to:
50
51```json [settings]
52{
53 "Version": "2012-10-17",
54 "Statement": [
55 {
56 "Effect": "Allow",
57 "Action": [
58 "bedrock:InvokeModel",
59 "bedrock:InvokeModelWithResponseStream"
60 ],
61 "Resource": "*"
62 }
63 ]
64}
65```
66
67With that done, choose one of the three authentication methods:
68
69#### Authentication via Named Profile (Recommended)
70
711. Ensure you have the AWS CLI installed and configured with a named profile
722. Open your `settings.json` (`zed: open settings file`) and include the `bedrock` key under `language_models` with the following settings:
73 ```json [settings]
74 {
75 "language_models": {
76 "bedrock": {
77 "authentication_method": "named_profile",
78 "region": "your-aws-region",
79 "profile": "your-profile-name"
80 }
81 }
82 }
83 ```
84
85#### Authentication via Static Credentials
86
87While 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.
88To do this:
89
901. 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).
912. Create security credentials for that User, save them and keep them secure.
923. Open the Agent Configuration with (`agent: open settings`) and go to the Amazon Bedrock section
934. Copy the credentials from Step 2 into the respective **Access Key ID**, **Secret Access Key**, and **Region** fields.
94
95#### Authentication via Bedrock API Key
96
97Amazon Bedrock also supports [API Keys](https://docs.aws.amazon.com/bedrock/latest/userguide/api-keys-use.html), which authenticate directly without requiring IAM users or named profiles.
98
991. Create an API Key in the [Amazon Bedrock Console](https://console.aws.amazon.com/bedrock/)
1002. Open the Agent Configuration with (`agent: open settings`) and go to the Amazon Bedrock section
1013. Enter your Bedrock API key in the **API Key** field and select your **Region**
102
103```json [settings]
104{
105 "language_models": {
106 "bedrock": {
107 "authentication_method": "api_key",
108 "region": "your-aws-region"
109 }
110 }
111}
112```
113
114The API key itself is stored securely in your OS keychain, not in your settings file.
115
116#### Cross-Region Inference
117
118The 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.
119With Cross-Region inference, you can distribute traffic across multiple AWS Regions, enabling higher throughput.
120
121##### Regional vs Global Inference Profiles
122
123Bedrock supports two types of cross-region inference profiles:
124
125- **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`.
126- **Global profiles**: Route requests across all commercial AWS Regions for maximum availability and performance.
127
128By 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:
129
130```json [settings]
131{
132 "language_models": {
133 "bedrock": {
134 "authentication_method": "named_profile",
135 "region": "your-aws-region",
136 "profile": "your-profile-name",
137 "allow_global": true
138 }
139 }
140}
141```
142
143**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.
144
145Although 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.
146All data will be transmitted encrypted across Amazon's secure network.
147
148We 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).
149
150For 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).
151
152#### Extended Context Window {#bedrock-extended-context}
153
154Anthropic models on Bedrock support a [1M token extended context window](https://docs.anthropic.com/en/docs/build-with-claude/extended-context) beta. To enable this feature, add `"allow_extended_context": true` to your Bedrock configuration:
155
156```json [settings]
157{
158 "language_models": {
159 "bedrock": {
160 "authentication_method": "named_profile",
161 "region": "your-aws-region",
162 "profile": "your-profile-name",
163 "allow_extended_context": true
164 }
165 }
166}
167```
168
169When enabled, Zed will include the `anthropic_beta` field in requests to Bedrock, enabling the 1M token context window for supported Anthropic models such as Claude Sonnet 4.5 and Claude Opus 4.6.
170
171> **Note**: Extended context usage may incur additional API costs. Refer to your AWS Bedrock pricing for details.
172
173### Anthropic {#anthropic}
174
175You can use Anthropic models by choosing them via the model dropdown in the Agent Panel.
176
1771. Sign up for Anthropic and [create an API key](https://console.anthropic.com/settings/keys)
1782. Make sure that your Anthropic account has credits
1793. Open the settings view (`agent: open settings`) and go to the Anthropic section
1804. Enter your Anthropic API key
181
182Even 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.
183
184Zed will also use the `ANTHROPIC_API_KEY` environment variable if it's defined.
185
186#### Custom Models {#anthropic-custom-models}
187
188You can add custom models to the Anthropic provider by adding the following to your Zed `settings.json`:
189
190```json [settings]
191{
192 "language_models": {
193 "anthropic": {
194 "available_models": [
195 {
196 "name": "claude-3-5-sonnet-20240620",
197 "display_name": "Sonnet 2024-June",
198 "max_tokens": 128000,
199 "max_output_tokens": 2560,
200 "cache_configuration": {
201 "max_cache_anchors": 10,
202 "min_total_token": 10000,
203 "should_speculate": false
204 },
205 "tool_override": "some-model-that-supports-toolcalling"
206 }
207 ]
208 }
209 }
210}
211```
212
213Custom models will be listed in the model dropdown in the Agent Panel.
214
215You 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:
216
217```json [settings]
218{
219 "name": "claude-sonnet-4-latest",
220 "display_name": "claude-sonnet-4-thinking",
221 "max_tokens": 200000,
222 "mode": {
223 "type": "thinking",
224 "budget_tokens": 4096
225 }
226}
227```
228
229### DeepSeek {#deepseek}
230
2311. Visit the DeepSeek platform and [create an API key](https://platform.deepseek.com/api_keys)
2322. Open the settings view (`agent: open settings`) and go to the DeepSeek section
2333. Enter your DeepSeek API key
234
235The DeepSeek API key will be saved in your keychain.
236
237Zed will also use the `DEEPSEEK_API_KEY` environment variable if it's defined.
238
239#### Custom Models {#deepseek-custom-models}
240
241The Zed agent comes pre-configured to use the latest version for common models (DeepSeek Chat, DeepSeek Reasoner).
242If you wish to use alternate models or customize the API endpoint, you can do so by adding the following to your Zed `settings.json`:
243
244```json [settings]
245{
246 "language_models": {
247 "deepseek": {
248 "api_url": "https://api.deepseek.com",
249 "available_models": [
250 {
251 "name": "deepseek-chat",
252 "display_name": "DeepSeek Chat",
253 "max_tokens": 64000
254 },
255 {
256 "name": "deepseek-reasoner",
257 "display_name": "DeepSeek Reasoner",
258 "max_tokens": 64000,
259 "max_output_tokens": 4096
260 }
261 ]
262 }
263 }
264}
265```
266
267Custom models will be listed in the model dropdown in the Agent Panel.
268You can also modify the `api_url` to use a custom endpoint if needed.
269
270### GitHub Copilot Chat {#github-copilot-chat}
271
272You can use GitHub Copilot Chat with the Zed agent by choosing it via the model dropdown in the Agent Panel.
273
2741. Open the settings view (`agent: open settings`) and go to the GitHub Copilot Chat section
2752. Click on `Sign in to use GitHub Copilot`, follow the steps shown in the modal.
276
277Alternatively, you can provide an OAuth token via the `GH_COPILOT_TOKEN` environment variable.
278
279> **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).
280
281To 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).
282
283### Google AI {#google-ai}
284
285You can use Gemini models with the Zed agent by choosing it via the model dropdown in the Agent Panel.
286
2871. Go to the Google AI Studio site and [create an API key](https://aistudio.google.com/app/apikey).
2882. Open the settings view (`agent: open settings`) and go to the Google AI section
2893. Enter your Google AI API key and press enter.
290
291The Google AI API key will be saved in your keychain.
292
293Zed 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.
294
295#### Custom Models {#google-ai-custom-models}
296
297By 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.
298
299Here is an example of a custom Google AI model you could add to your Zed `settings.json`:
300
301```json [settings]
302{
303 "language_models": {
304 "google": {
305 "available_models": [
306 {
307 "name": "gemini-2.5-flash-preview-05-20",
308 "display_name": "Gemini 2.5 Flash (Thinking)",
309 "max_tokens": 1000000,
310 "mode": {
311 "type": "thinking",
312 "budget_tokens": 24000
313 }
314 }
315 ]
316 }
317 }
318}
319```
320
321Custom models will be listed in the model dropdown in the Agent Panel.
322
323### LM Studio {#lmstudio}
324
3251. Download and install [the latest version of LM Studio](https://lmstudio.ai/download)
3262. 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:
327
328 ```sh
329 lms get qwen2.5-coder-7b
330 ```
331
3323. Make sure the LM Studio API server is running by executing:
333
334 ```sh
335 lms server start
336 ```
337
338Tip: 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.
339
340### Mistral {#mistral}
341
3421. Visit the Mistral platform and [create an API key](https://console.mistral.ai/api-keys/)
3432. Open the configuration view (`agent: open settings`) and navigate to the Mistral section
3443. Enter your Mistral API key
345
346The Mistral API key will be saved in your keychain.
347
348Zed will also use the `MISTRAL_API_KEY` environment variable if it's defined.
349
350#### Custom Models {#mistral-custom-models}
351
352The 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).
353All the default models support tool use.
354If you wish to use alternate models or customize their parameters, you can do so by adding the following to your Zed `settings.json`:
355
356```json [settings]
357{
358 "language_models": {
359 "mistral": {
360 "api_url": "https://api.mistral.ai/v1",
361 "available_models": [
362 {
363 "name": "mistral-tiny-latest",
364 "display_name": "Mistral Tiny",
365 "max_tokens": 32000,
366 "max_output_tokens": 4096,
367 "max_completion_tokens": 1024,
368 "supports_tools": true,
369 "supports_images": false
370 }
371 ]
372 }
373 }
374}
375```
376
377Custom models will be listed in the model dropdown in the Agent Panel.
378
379### Ollama {#ollama}
380
381Download and install Ollama from [ollama.com/download](https://ollama.com/download) (Linux or macOS) and ensure it's running with `ollama --version`.
382
3831. Download one of the [available models](https://ollama.com/models), for example, for `mistral`:
384
385 ```sh
386 ollama pull mistral
387 ```
388
3892. Make sure that the Ollama server is running. You can start it either via running Ollama.app (macOS) or launching:
390
391 ```sh
392 ollama serve
393 ```
394
3953. In the Agent Panel, select one of the Ollama models using the model dropdown.
396
397#### Ollama Autodiscovery
398
399Zed will automatically discover models that Ollama has pulled. You can turn this off by setting
400the `auto_discover` field in the Ollama settings. If you do this, you should manually specify which
401models are available.
402
403```json [settings]
404{
405 "language_models": {
406 "ollama": {
407 "api_url": "http://localhost:11434",
408 "auto_discover": false,
409 "available_models": [
410 {
411 "name": "qwen2.5-coder",
412 "display_name": "qwen 2.5 coder",
413 "max_tokens": 32768,
414 "supports_tools": true,
415 "supports_thinking": true,
416 "supports_images": true
417 }
418 ]
419 }
420 }
421}
422```
423
424#### Ollama Context Length {#ollama-context}
425
426Zed API requests to Ollama include the context length as the `num_ctx` parameter. By default, Zed uses a context length of `4096` tokens for all Ollama models.
427
428> **Note**: Token counts displayed in the Agent Panel are only estimates and will differ from the model's native tokenizer.
429
430You can set a context length for all Ollama models using the `context_window` setting. This can also be configured in the Ollama provider settings UI:
431
432```json [settings]
433{
434 "language_models": {
435 "ollama": {
436 "context_window": 8192
437 }
438 }
439}
440```
441
442Alternatively, you can configure the context length per-model using the `max_tokens` field in `available_models`:
443
444```json [settings]
445{
446 "language_models": {
447 "ollama": {
448 "api_url": "http://localhost:11434",
449 "available_models": [
450 {
451 "name": "qwen2.5-coder",
452 "display_name": "qwen 2.5 coder 32K",
453 "max_tokens": 32768,
454 "supports_tools": true,
455 "supports_thinking": true,
456 "supports_images": true
457 }
458 ]
459 }
460 }
461}
462```
463
464> **Note**: If `context_window` is set, it overrides any per-model `max_tokens` values.
465
466If you specify a context length that is too large for your hardware, Ollama will log an error.
467You can watch these logs by running: `tail -f ~/.ollama/logs/ollama.log` (macOS) or `journalctl -u ollama -f` (Linux).
468Depending on the memory available on your machine, you may need to adjust the context length to a smaller value.
469
470You may also optionally specify a value for `keep_alive` for each available model.
471This can be an integer (seconds) or alternatively a string duration like "5m", "10m", "1h", "1d", etc.
472For example, `"keep_alive": "120s"` will allow the remote server to unload the model (freeing up GPU VRAM) after 120 seconds.
473
474The `supports_tools` option controls whether the model will use additional tools.
475If 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.
476If 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.
477
478The `supports_thinking` option controls whether the model will perform an explicit "thinking" (reasoning) pass before producing its final answer.
479If the model is tagged with `thinking` in the Ollama catalog, set this option and you can use it in Zed.
480
481The `supports_images` option enables the model's vision capabilities, allowing it to process images included in the conversation context.
482If the model is tagged with `vision` in the Ollama catalog, set this option and you can use it in Zed.
483
484#### Ollama Authentication
485
486In 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.
487
488One such service is [Ollama Turbo](https://ollama.com/turbo). To configure Zed to use Ollama Turbo:
489
4901. Sign in to your Ollama account and subscribe to Ollama Turbo
4912. Visit [ollama.com/settings/keys](https://ollama.com/settings/keys) and create an API key
4923. Open the settings view (`agent: open settings`) and go to the Ollama section
4934. Paste your API key and press enter.
4945. For the API URL enter `https://ollama.com`
495
496Zed will also use the `OLLAMA_API_KEY` environment variables if defined.
497
498### OpenAI {#openai}
499
5001. Visit the OpenAI platform and [create an API key](https://platform.openai.com/account/api-keys)
5012. Make sure that your OpenAI account has credits
5023. Open the settings view (`agent: open settings`) and go to the OpenAI section
5034. Enter your OpenAI API key
504
505The OpenAI API key will be saved in your keychain.
506
507Zed will also use the `OPENAI_API_KEY` environment variable if it's defined.
508
509#### Custom Models {#openai-custom-models}
510
511The 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).
512To 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`:
513
514```json [settings]
515{
516 "language_models": {
517 "openai": {
518 "available_models": [
519 {
520 "name": "gpt-5",
521 "display_name": "gpt-5 high",
522 "reasoning_effort": "high",
523 "max_tokens": 272000,
524 "max_completion_tokens": 20000
525 },
526 {
527 "name": "gpt-4o-2024-08-06",
528 "display_name": "GPT 4o Summer 2024",
529 "max_tokens": 128000
530 },
531 {
532 "name": "gpt-5-codex",
533 "display_name": "GPT-5 Codex",
534 "max_tokens": 128000,
535 "capabilities": {
536 "chat_completions": false
537 }
538 }
539 ]
540 }
541 }
542}
543```
544
545You 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).
546
547OpenAI `o1` and `o`-class models should set `max_completion_tokens` as well to avoid incurring high reasoning token costs.
548
549If a model does not support the `/chat/completions` endpoint (for example `gpt-5-codex`), disable it by setting `capabilities.chat_completions` to `false`. Zed will use the Responses endpoint instead.
550
551Custom models will be listed in the model dropdown in the Agent Panel.
552
553### OpenAI API Compatible {#openai-api-compatible}
554
555Zed 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.
556This is useful for connecting to other hosted services (like Together AI, Anyscale, etc.) or local models.
557
558You can add a custom, OpenAI-compatible model either via the UI or by editing your `settings.json`.
559
560To 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.
561Then, fill up the input fields available in the modal.
562
563To do it via your `settings.json`, add the following snippet under `language_models`:
564
565```json [settings]
566{
567 "language_models": {
568 "openai_compatible": {
569 // Using Together AI as an example
570 "Together AI": {
571 "api_url": "https://api.together.xyz/v1",
572 "available_models": [
573 {
574 "name": "mistralai/Mixtral-8x7B-Instruct-v0.1",
575 "display_name": "Together Mixtral 8x7B",
576 "max_tokens": 32768,
577 "capabilities": {
578 "tools": true,
579 "images": false,
580 "parallel_tool_calls": false,
581 "prompt_cache_key": false
582 }
583 }
584 ]
585 }
586 }
587 }
588}
589```
590
591By default, OpenAI-compatible models inherit the following capabilities:
592
593- `tools`: true (supports tool/function calling)
594- `images`: false (does not support image inputs)
595- `parallel_tool_calls`: false (does not support `parallel_tool_calls` parameter)
596- `prompt_cache_key`: false (does not support `prompt_cache_key` parameter)
597- `chat_completions`: true (calls the `/chat/completions` endpoint)
598
599If a provider exposes models that only work with the Responses API, set `chat_completions` to `false` for those entries. Zed uses the Responses endpoint for these models.
600
601Note that LLM API keys aren't stored in your settings file.
602So, 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>`.
603
604### OpenRouter {#openrouter}
605
606OpenRouter provides access to multiple AI models through a single API. It supports tool use for compatible models.
607
6081. Visit [OpenRouter](https://openrouter.ai) and create an account
6092. Generate an API key from your [OpenRouter keys page](https://openrouter.ai/keys)
6103. Open the settings view (`agent: open settings`) and go to the OpenRouter section
6114. Enter your OpenRouter API key
612
613The OpenRouter API key will be saved in your keychain.
614
615Zed will also use the `OPENROUTER_API_KEY` environment variable if it's defined.
616
617#### Custom Models {#openrouter-custom-models}
618
619You can add custom models to the OpenRouter provider by adding the following to your Zed `settings.json`:
620
621```json [settings]
622{
623 "language_models": {
624 "open_router": {
625 "api_url": "https://openrouter.ai/api/v1",
626 "available_models": [
627 {
628 "name": "google/gemini-2.0-flash-thinking-exp",
629 "display_name": "Gemini 2.0 Flash (Thinking)",
630 "max_tokens": 200000,
631 "max_output_tokens": 8192,
632 "supports_tools": true,
633 "supports_images": true,
634 "mode": {
635 "type": "thinking",
636 "budget_tokens": 8000
637 }
638 }
639 ]
640 }
641 }
642}
643```
644
645The available configuration options for each model are:
646
647- `name` (required): The model identifier used by OpenRouter
648- `display_name` (optional): A human-readable name shown in the UI
649- `max_tokens` (required): The model's context window size
650- `max_output_tokens` (optional): Maximum tokens the model can generate
651- `max_completion_tokens` (optional): Maximum completion tokens
652- `supports_tools` (optional): Whether the model supports tool/function calling
653- `supports_images` (optional): Whether the model supports image inputs
654- `mode` (optional): Special mode configuration for thinking models
655
656You can find available models and their specifications on the [OpenRouter models page](https://openrouter.ai/models).
657
658Custom models will be listed in the model dropdown in the Agent Panel.
659
660#### Provider Routing
661
662You can optionally control how OpenRouter routes a given custom model request among underlying upstream providers via the `provider` object on each model entry.
663
664Supported fields (all optional):
665
666- `order`: Array of provider slugs to try first, in order (e.g. `["anthropic", "openai"]`)
667- `allow_fallbacks` (default: `true`): Whether fallback providers may be used if preferred ones are unavailable
668- `require_parameters` (default: `false`): Only use providers that support every parameter you supplied
669- `data_collection` (default: `allow`): `"allow"` or `"disallow"` (controls use of providers that may store data)
670- `only`: Whitelist of provider slugs allowed for this request
671- `ignore`: Provider slugs to skip
672- `quantizations`: Restrict to specific quantization variants (e.g. `["int4","int8"]`)
673- `sort`: Sort strategy for candidate providers (e.g. `"price"` or `"throughput"`)
674
675Example adding routing preferences to a model:
676
677```json [settings]
678{
679 "language_models": {
680 "open_router": {
681 "api_url": "https://openrouter.ai/api/v1",
682 "available_models": [
683 {
684 "name": "openrouter/auto",
685 "display_name": "Auto Router (Tools Preferred)",
686 "max_tokens": 2000000,
687 "supports_tools": true,
688 "provider": {
689 "order": ["anthropic", "openai"],
690 "allow_fallbacks": true,
691 "require_parameters": true,
692 "only": ["anthropic", "openai", "google"],
693 "ignore": ["cohere"],
694 "quantizations": ["int8"],
695 "sort": "price",
696 "data_collection": "allow"
697 }
698 }
699 ]
700 }
701 }
702}
703```
704
705These routing controls let you fine‑tune cost, capability, and reliability trade‑offs without changing the model name you select in the UI.
706
707### Vercel v0 {#vercel-v0}
708
709[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.
710It supports text and image inputs and provides fast streaming responses.
711
712The v0 models are [OpenAI-compatible models](/#openai-api-compatible), but Vercel is listed as first-class provider in the panel's settings view.
713
714To start using it with Zed, ensure you have first created a [v0 API key](https://v0.dev/chat/settings/keys).
715Once you have it, paste it directly into the Vercel provider section in the panel's settings view.
716
717You should then find it as `v0-1.5-md` in the model dropdown in the Agent Panel.
718
719### xAI {#xai}
720
721Zed has first-class support for [xAI](https://x.ai/) models. You can use your own API key to access Grok models.
722
7231. [Create an API key in the xAI Console](https://console.x.ai/team/default/api-keys)
7242. Open the settings view (`agent: open settings`) and go to the **xAI** section
7253. Enter your xAI API key
726
727The xAI API key will be saved in your keychain. Zed will also use the `XAI_API_KEY` environment variable if it's defined.
728
729> **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.
730
731#### Custom Models {#xai-custom-models}
732
733The 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`:
734
735```json [settings]
736{
737 "language_models": {
738 "x_ai": {
739 "api_url": "https://api.x.ai/v1",
740 "available_models": [
741 {
742 "name": "grok-1.5",
743 "display_name": "Grok 1.5",
744 "max_tokens": 131072,
745 "max_output_tokens": 8192
746 },
747 {
748 "name": "grok-1.5v",
749 "display_name": "Grok 1.5V (Vision)",
750 "max_tokens": 131072,
751 "max_output_tokens": 8192,
752 "supports_images": true
753 }
754 ]
755 }
756 }
757}
758```
759
760## Custom Provider Endpoints {#custom-provider-endpoint}
761
762You can use a custom API endpoint for different providers, as long as it's compatible with the provider's API structure.
763To do so, add the following to your `settings.json`:
764
765```json [settings]
766{
767 "language_models": {
768 "some-provider": {
769 "api_url": "http://localhost:11434"
770 }
771 }
772}
773```
774
775Currently, `some-provider` can be any of the following values: `anthropic`, `google`, `ollama`, `openai`.
776
777This is the same infrastructure that powers models that are, for example, [OpenAI-compatible](#openai-api-compatible).