Zed Integration
Zed is a high-performance, modern code editor built for speed and collaboration. It includes built-in AI features through its Agent Panel, supporting multiple LLM providers including OpenAI, Anthropic, Google, and any OpenAI-compatible endpoint.
Zed's settings file lets you register custom OpenAI-compatible providers, making it easy to connect LLM API for AI-assisted coding.
Prerequisites
- An LLM API account with an API key
- Zed installed or accessible
Setup
Get Your LLM API Key
- Log in to your LLM API dashboard
- Click Create Key to Start
- Copy your new API key immediately — it will only be shown once
- Store the key securely (e.g., in a password manager or
.env file)
INFO
LLM API is an OpenAI-compatible gateway that gives you access to dozens of AI models through a
single API key and endpoint.
(Recommended) Configure Zed automatically
The llm-setup configurator writes the whole configuration from the next step for you: it registers the llmapi provider, adds the models you pick, sets the Agent Panel default model, and stores your key once. It merges into an existing settings.json safely — even one with comments.
macOS / Linux
curl -fsSL https://llmapi.ai/install | bash
Windows
irm https://llmapi.ai/install.ps1 | iex
WARN
The script wires its env file into your shell startup file (~/.bashrc, ~/.zshrc, or fish
config) — but that only applies to new shells. In the terminal you ran the installer in, run
source ~/.bashrc first (or open a new terminal), then launch Zed from it with zed. Started
from a desktop icon, Zed won't see the env file.
If you ran it, jump ahead to Give Zed the API Key. To configure Zed by hand instead, continue with the next step.
Configure LLM API in Zed
You can do this entirely from the UI: run the command agent: open settings, find Add Provider in the LLM Providers section, and fill in the provider name (llmapi), the API URL (https://api.llmapi.ai/v1), a model ID, and its context window. Or edit the settings file directly:
- Open Zed and open your settings file (run the command:
zed: open settings).
- Add the following configuration — each entry under
"openai_compatible" becomes its own provider in the Agent Panel:
{
"language_models": {
"openai_compatible": {
"llmapi": {
"api_url": "https://api.llmapi.ai/v1",
"available_models": [
{
"name": "claude-sonnet-4-6",
"max_tokens": 128000
},
{
"name": "openai/gpt-4o",
"display_name": "GPT-4o via LLM API",
"max_tokens": 128000
}
]
}
}
}
}
- (Optional) Make an LLM API model the Agent Panel default:
{
"agent": {
"default_model": {
"provider": "llmapi",
"model": "claude-sonnet-4-6"
}
}
}
INFO
Zed's settings.json is JSONC — comments and trailing commas are fine, Zed writes them itself.
Never put your API key in settings.json — it goes in an environment variable or the Agent Panel
(next step). Model entries also support optional fields like reasoning_effort and capabilities
— see Zed's provider reference.
Give Zed the API Key
Zed derives the key's environment variable name from the provider entry name: llmapi → LLMAPI_API_KEY. Provide the key in one of two ways.
Option A — environment variable:
export LLMAPI_API_KEY="your-llm-api-key-here"
Zed only sees the variable if it's set in the environment Zed starts from — so launch Zed from a terminal (zed .), not from a desktop icon or app launcher, which don't inherit your shell environment. If you ran llm-setup, the variable is already in its env file and wired into your shell startup file: open a new terminal (or source ~/.bashrc in the current one) and launch zed from there. On Windows, llm-setup persists it as a User environment variable, so GUI-launched Zed picks it up.
Option B — Agent Panel: run the command agent: open settings, find the llmapi provider, and paste the key once. It's stored in the OS keychain and works no matter how Zed is launched.
WARN
A non-empty LLMAPI_API_KEY in Zed's environment takes precedence over a key pasted in the Agent
Panel.
Restart Zed --- your LLM API models will appear in the Agent Panel model dropdown under llmapi.
Test the Integration
Verify that Zed can successfully communicate with LLM API by sending a test request. All requests will now be routed through LLM API.
INFO
You can name the provider entry anything — the environment variable follows the name (uppercased,
non-alphanumeric characters become underscores, with _API_KEY appended). Keep the name llmapi
if you use llm-setup, so the script recognizes and manages the entry on re-runs and uninstall.