Models → Pricing → Docs → Blog → Changelog → Contact → Status →
Get started freeLog in

Zed Editor: Add a Custom OpenAI-Compatible Provider

Zed lets you register any OpenAI-compatible API as a language model provider. Here is the settings block for FreeModel, what each field means, and why the model list is yours to write.

Zed is a fast, native code editor with a built-in Agent Panel. It ships with integrations for several hosted providers, and it also accepts any API that speaks the OpenAI chat format. FreeModel is one of those: one base URL, one key, and every model on your plan.

Unlike tools that read the model list from the API, Zed asks you to declare the models you want. That is a little more typing, and it also means you decide exactly what Zed is told about each model.

How Zed sees a custom provider

A custom provider in Zed is three things:

  1. A name you choose. It shows up in the model selector.
  2. An API URL. For FreeModel that is https://freemodel.in/v1. Zed adds the endpoint path itself.
  3. A list of models, each with an id, a display name, a token limit and a few capability flags.

The key is the fourth piece, but it does not go into the settings file. More on that below.

The settings.json block

Open your Zed settings file (the zed: open settings action in the command palette opens it) and add a language_models section. In current Zed versions, custom OpenAI-compatible providers live under openai_compatible:

{
  "language_models": {
    "openai_compatible": {
      "FreeModel": {
        "api_url": "https://freemodel.in/v1",
        "available_models": [
          {
            "name": "gpt-6-luna",
            "display_name": "GPT-6 Luna (FreeModel)",
            "max_tokens": 1000000,
            "capabilities": {
              "tools": true,
              "images": true,
              "parallel_tool_calls": false,
              "prompt_cache_key": false
            }
          }
        ]
      }
    }
  }
}

If language_models already exists in your file, merge the openai_compatible part into it rather than adding a second key.

Field by field

FieldWhat to put
"FreeModel"Your provider name. Any label works.
api_urlhttps://freemodel.in/v1, ending at /v1
nameThe exact model id from GET /v1/models
display_nameWhat you want to see in the selector
max_tokensThe model's context size. Take it from the model's page; gpt-6-luna lists 1M.
toolstrue only if the model has the Tools capability
imagestrue only if the model has the Vision capability

Leave the other flags at false unless you have a reason. The capabilities of every model are listed on the models page, and each model has its own page, such as GPT-6 Luna.

When the context size is not published

Some models on the catalogue show no context size. For those, do not guess a huge number. Use a conservative value you are comfortable with; Zed uses it to decide how much of the conversation to keep, and a too-large value only means a request may be rejected for being too long.

Adding the API key

Zed keeps provider keys out of settings.json. Open the agent settings view from the Agent Panel, find the provider you just named, and paste your fm_ key there. Create a dedicated key for Zed at Dashboard → API Keys so you can revoke it on its own.

If you do not see your provider in the agent settings, the JSON probably did not parse. Zed shows settings errors when the file is saved; fix those first.

Older Zed versions

Before openai_compatible existed, the usual approach was to override the built-in OpenAI provider:

{
  "language_models": {
    "openai": {
      "api_url": "https://freemodel.in/v1",
      "available_models": [
        { "name": "gpt-6-luna", "display_name": "GPT-6 Luna (FreeModel)", "max_tokens": 1000000 }
      ]
    }
  }
}

This works with FreeModel too, because only the URL and key change. The downside is that it replaces your real OpenAI connection. If your Zed version supports openai_compatible, prefer it. Zed's own documentation for your version is the final word on field names.

Adding more models

Each entry in available_models becomes one choice in the selector. A practical pair is a free model for quick questions and, on a paid plan, a stronger model for agent work:

{
  "name": "claude-sonnet-5",
  "display_name": "Claude Sonnet 5 (FreeModel)",
  "max_tokens": 1000000,
  "capabilities": { "tools": true, "images": true, "parallel_tool_calls": false, "prompt_cache_key": false }
}

Claude models other than Claude Haiku 5.5 need a paid plan. Plans are prepaid for 30 days, start at $1.20, and every paid plan reaches every model. Each model uses plan tokens at its own rate (Claude Sonnet 5 at 3×); the table is on the pricing page.

What goes through FreeModel

With this setup, the Agent Panel and inline assist send requests to FreeModel when you pick one of these models. Zed's edit predictions are a separate feature with their own settings and are not changed by this provider.

Agent threads can get long, and both input and output tokens count. If a thread has grown large, starting a new one is usually cheaper than continuing it.

Common errors

  • 401 — key missing or wrong. Paste the full key again in the agent settings.
  • 403 upgrade_required — a free account picked a paid model. Pick a free one or upgrade.
  • 404 model_not_found — the name field does not match a listed id. Names like gpt-4o are not mapped to another model.
  • 402 — tokens used up (tokens_exhausted). Nothing is charged for the rejected request.
  • 429 — rate limit for your plan, per key. Wait and retry.
  • The agent talks but never edits — tools is false, or the model has no Tools capability.

To rule out Zed entirely, test the key in a terminal:

curl https://freemodel.in/v1/chat/completions \
  -H "Authorization: Bearer fm_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{"model": "gpt-6-luna", "messages": [{"role": "user", "content": "Say hi"}]}'

The request format is documented in Chat Completions.

FAQ

Does this change Zed edit predictions?

No. Edit predictions are a separate Zed feature with their own settings. The provider in this guide is used by the Agent Panel and inline assist.

Can I put the API key in settings.json?

Do not. Enter it in the agent settings view, where Zed keeps it outside your settings file, so the file can be shared or synced without the key.

Why does the agent answer but never edit files?

The model entry needs tools set to true, and the model itself must have the Tools capability. Check the capability on the FreeModel models page.

Which model can I use on the free plan?

Any of the free models, for example gpt-6-luna. Claude Haiku 5.5 and GPT-6.2 Astra are on the free plan; the other Claude models, GPT-6 Astra, Gemini and other premium models need a paid plan.

Ready to build?

Grab a free API key — 1M tokens on 8 free models after a one-time Telegram verification, no card. Every model from $1.20.