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.

In short: Zed takes an openai_compatible provider in settings.json with an api_url ending in /v1 and an explicit available_models list. Edit prediction is a separate setting that posts to /v1/completions rather than chat completions, so chat can work while autocomplete silently does nothing.
Before you start: you need an endpoint root ending in /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.

CapabilityDefaultWhen you change it
toolstrueLeave alone unless the endpoint rejects tool schemas
imagesfalseSet true only if the endpoint and model both do vision
chat_completionstrueSet false for models that only serve the Responses API
parallel_tool_callsfalseSet true only if the endpoint honours it
max_tokens_parameterfalseSet 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.

A realistic Zed day: 400 edit predictions at 1.5k in / 60 out, plus 15 agent turns at 60k in / 4k out, over 20 working days. Rates checked 2026-09-20.
ModelVendorRate
in / out per 1M
Per dayPer month
gpt-5.6-lunaOpenAI$0.1 / $0.6$0.20$4
MiniMax-M3MiniMax$0.15 / $0.6$0.28$6
deepseek-v4-flashDeepSeek$0.22 / $0.66$0.39$8
gemini-3.7-flashGoogle$0.375 / $1.875$0.72$14
claude-haiku-4-5-20251001Anthropic$0.5 / $2.5$0.96$19
deepseek-v4-proDeepSeek$0.66 / $1.98$1.16$23
glm-5.3Zhipu$0.7 / $2.2$1.23$25
qwen3.8-maxAlibaba$1 / $3$1.75$35
claude-sonnet-5Anthropic$1 / $5$1.92$38
gpt-5.6-terraOpenAI$1 / $6$2.00$40
kimi-k3Moonshot$1.5 / $7.5$2.88$58
claude-opus-5Anthropic$2.5 / $12.5$4.80$96
Cost note. Because the two halves have opposite shapes, no single rate tells you what Zed costs. If you mostly use chat, optimise for the input rate and context size. If you lean on autocomplete, the model's latency matters more than its price — a prediction that arrives after you have typed the line is worth nothing regardless of what it cost.

How this fails in practice

The failures that account for most setup problems, and what each one actually means.
What you seeWhat it usually isFix
Provider appears but no models listedavailable_models is empty or the IDs are wrongEnumerate models explicitly; Zed does not discover them
Chat works, autocomplete never firesEdit prediction posts to /v1/completions, which the endpoint may not servePoint edit_predictions at /v1/completions or disable predictions
404 on every requestTrailing slash on api_url, or missing /v1Root only, ending in /v1, no trailing slash
Model responds but never reasonsreasoning_effort is none, or chat_completions should be falseSet a non-none effort; disable chat_completions for Responses-only models
Vision input ignoredcapabilities.images defaults to falseSet images true only if endpoint and model both support it
Context seems shorter than the model allowsmax_tokens understates the real windowSet max_tokens to the endpoint's actual context limit
You need a key before the code below runs. Create an account, generate a key, and copy the base URL (https://aicomp.ai/v1). Create one free →
Check current rates → Free to sign up · $1 minimum top-up · No prepayment

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.

Related

Get API access