Skip to content

Use Zed with the Gateway

Zed is a high-performance code editor with built-in AI features. You can add the Gateway as an OpenAI-compatible provider to route requests through your regional endpoint.

Prerequisites

Connect Zed to the Gateway

  1. Open your settings file: command palette → zed: open settings file (or ⌘⌥,). Plain ⌘, opens the graphical Settings editor instead.
  2. Add a Gateway provider under language_models.openai_compatible:
{
  "language_models": {
    "openai_compatible": {
      "amazee": {
        "api_url": "https://llm.[your-region].amazee.ai/v1",
        "available_models": [
          {
            "name": "claude-4-5-sonnet",
            "display_name": "Claude Sonnet 4.5 (Gateway)",
            "max_tokens": 200000,
            "max_output_tokens": 16384,
            "capabilities": { "tools": true, "images": true }
          }
        ]
      }
    }
  }
}

Replace [your-region] with your region code (e.g. ch103, us103). In Zed, max_tokens is the model's context window, not the reply length. Use max_output_tokens for the reply length.

  1. Add your LLM API key: open the agent settings (command palette → agent: open settings, or ⌘⌥C) and enter it under LLM Providers → amazee. Zed stores it in your system keychain. You can also set the AMAZEE_API_KEY environment variable and restart Zed. Zed builds the variable name from the provider name.

You can also add the provider from the UI with Add Provider under LLM Providers.

Don't put the Gateway under language_models.openai. That replaces Zed's built-in OpenAI provider and reads OPENAI_API_KEY.

Adding more models

Add entries to the available_models array for each model you want to use. See Available Models for model IDs. Set "images": true only for models with vision.

Verify

Open the Agent Panel (⌘?), select a Gateway model from the model menu, and ask a question. Check the My usage card on the AI keys page to confirm.

Troubleshooting

Model not appearing
Make sure the JSON is valid and the model name matches an available model on your endpoint.
Auth errors
Re-enter your key under LLM Providers → amazee in the agent settings. If AMAZEE_API_KEY is set in your environment, it wins over the saved key. Unset it and restart Zed.
Replies cut off or "context too long"
Check max_tokens is the model's full context window (e.g. 200000), not an output limit.
Connection refused
Verify the api_url includes /v1 and uses your correct region code.