Zed with a custom OpenAI-compatible endpoint
Zed talks to any endpoint that speaks the OpenAI wire format, but it does it through two separate doors — the agent panel and edit prediction — and those two doors do not use the same route. Configure both, or you get chat working and autocomplete silently doing nothing.
/v1 and a key from that endpoint. The setting below is the only thing that changes — request and response handling stay identical. Rates checked 2026-09-20.The provider block
Everything lives under language_models.openai_compatible. You name the provider, give it the endpoint root, and enumerate the models you want — Zed does not query /v1/models and populate a list for you, so anything you omit simply does not appear in the picker.
{
"language_models": {
"openai_compatible": {
"my-gateway": {
"api_url": "https://aicomp.ai/v1",
"available_models": [
{
"name": "claude-sonnet-5",
"display_name": "Sonnet 5 (gateway)",
"max_tokens": 200000
},
{
"name": "deepseek-v4-pro",
"display_name": "DeepSeek V4 Pro (gateway)",
"max_tokens": 128000
}
]
}
}
}
}
Three things about that block are worth internalising. The api_url carries the version segment and no trailing slash. The name inside each model must match the identifier your endpoint expects — this is the string sent as model in the request body, so a mismatch is a model error rather than a connection error. And max_tokens is Zed's idea of the context window, which it uses to decide how much context to send; understating it truncates silently rather than complaining.
Keys do not belong in this file
Zed is explicit about it: enter the key in the provider settings UI, or export the environment variable it generates for the provider name you chose. A settings file is the single most likely artifact to end up in a public dotfiles repository, and the key in it is the one secret you cannot rotate per-project.
# provider id "my-gateway" -> the generated variable name
export MY_GATEWAY_API_KEY="sk-..."
Capabilities are off by default, and that surprises people
An OpenAI-compatible model in Zed inherits a conservative set: tools work, images do not, and requests go to chat completions. If your endpoint supports vision you have to say so, and if a model only works through the Responses API you have to turn chat completions off — otherwise Zed keeps posting to a route that model cannot serve.
| Capability | Default | When you change it |
|---|---|---|
tools | true | Leave alone unless the endpoint rejects tool schemas |
images | false | Set true only if the endpoint and model both do vision |
chat_completions | true | Set false for models that only serve the Responses API |
parallel_tool_calls | false | Set true only if the endpoint honours it |
max_tokens_parameter | false | Set true if the endpoint wants max_tokens rather than max_completion_tokens |
Defaults as documented in Zed's API access docs; they change between releases, so treat the table as a checklist rather than a reference.
Edit prediction is a different endpoint
This is the trap that costs people an afternoon. Edit predictions do not use chat completions at all — Zed posts to /v1/completions, the plain prompt-completion route, with a formatted code context and a short stop list. If your endpoint implements only /v1/chat/completions, the agent panel works perfectly and autocomplete never fires, with nothing in the log to explain why.
{
"edit_predictions": {
"provider": "open_ai_compatible_api",
"open_ai_compatible_api": {
"api_url": "https://aicomp.ai/v1/completions",
"model": "deepseek-v4-flash",
"prompt_format": "infer",
"max_output_tokens": 512
}
}
}
Note the URL ends in /v1/completions here, not /v1. And because the request is a raw completion rather than a chat turn, a small fast model is usually the right pick — the prediction is a few dozen tokens, so paying a flagship rate for it buys nothing.
What Zed actually costs
Zed is the only tool in this cluster with two workloads running at once, and they pull in opposite directions. Edit prediction is hundreds of requests a day at a couple of thousand tokens each — cheap per request, but the request count is what shows up on the bill. The agent panel is a dozen requests a day, each carrying a working context that can be tens of thousands of tokens.
| Model | Vendor | Rate in / out per 1M | Per day | Per month |
|---|---|---|---|---|
| gpt-5.6-luna | OpenAI | $0.1 / $0.6 | $0.20 | $4 |
| MiniMax-M3 | MiniMax | $0.15 / $0.6 | $0.28 | $6 |
| deepseek-v4-flash | DeepSeek | $0.22 / $0.66 | $0.39 | $8 |
| gemini-3.7-flash | $0.375 / $1.875 | $0.72 | $14 | |
| claude-haiku-4-5-20251001 | Anthropic | $0.5 / $2.5 | $0.96 | $19 |
| deepseek-v4-pro | DeepSeek | $0.66 / $1.98 | $1.16 | $23 |
| glm-5.3 | Zhipu | $0.7 / $2.2 | $1.23 | $25 |
| qwen3.8-max | Alibaba | $1 / $3 | $1.75 | $35 |
| claude-sonnet-5 | Anthropic | $1 / $5 | $1.92 | $38 |
| gpt-5.6-terra | OpenAI | $1 / $6 | $2.00 | $40 |
| kimi-k3 | Moonshot | $1.5 / $7.5 | $2.88 | $58 |
| claude-opus-5 | Anthropic | $2.5 / $12.5 | $4.80 | $96 |
How this fails in practice
| What you see | What it usually is | Fix |
|---|---|---|
| Provider appears but no models listed | available_models is empty or the IDs are wrong | Enumerate models explicitly; Zed does not discover them |
| Chat works, autocomplete never fires | Edit prediction posts to /v1/completions, which the endpoint may not serve | Point edit_predictions at /v1/completions or disable predictions |
| 404 on every request | Trailing slash on api_url, or missing /v1 | Root only, ending in /v1, no trailing slash |
| Model responds but never reasons | reasoning_effort is none, or chat_completions should be false | Set a non-none effort; disable chat_completions for Responses-only models |
| Vision input ignored | capabilities.images defaults to false | Set images true only if endpoint and model both support it |
| Context seems shorter than the model allows | max_tokens understates the real window | Set max_tokens to the endpoint's actual context limit |
https://aicomp.ai/v1).
Create one free →
Confirming it took effect
Send one message in the agent panel, then look at the gateway usage log. A request appearing there is the only proof that matters — a successful response can also come from a provider Zed still has configured, and the UI does not tell you which one answered. If nothing appears, the request never left Zed: check the provider name is selected, then the URL, then the model ID, in that order.
FAQ
Where does Zed read a custom endpoint from?
From language_models.openai_compatible in your settings file, keyed by a provider name you choose. Each entry takes an api_url and an available_models list. You can add the same thing through the Agent Settings UI, but the settings file is the form that survives an upgrade and the form you can commit alongside a project.
Why do my edit predictions fail when chat works?
Because edit prediction is a different endpoint. Zed's edit predictions post to /v1/completions — the older plain-completion route — not /v1/chat/completions. If your endpoint only implements the chat route, chat works and predictions silently do nothing. Check that the endpoint serves completions before enabling them.
Does api_url need a trailing slash?
No, and adding one breaks it. Zed concatenates the resource path onto the URL you give, so a trailing slash produces a double separator and a request that 404s. Give the root including the version segment — ending in /v1 — and nothing after it.
Why is my model not reasoning even though it supports it?
Two settings have to agree. Reasoning models need a non-none reasoning_effort, and if the model only carries reasoning state through the Responses API you must also set capabilities.chat_completions to false so Zed targets that route instead. Leaving either one at its default disables thinking in the agent panel.
Can I put the API key in settings.json?
You can, but you should not — the docs are explicit that keys belong in the provider settings UI or in the generated environment variable. A settings file gets copied into dotfile repos and shared in screenshots far more often than an environment variable does.
How much does Zed cost to run against a gateway?
It depends which half you use most. Edit predictions are tiny but fire hundreds of times a day, so their cost is driven by how often you type rather than by the rate; the agent panel is the opposite — few requests, each carrying a large context. The table above prices both together at realistic volumes, which is the only way the ranking means anything.