Use DeepSeek, GLM and Kimi in Zed
Updated 2026-10-18 · Zed's built-in agent on an OpenAI-compatible API: the settings.json block, where the key goes and what the editor needs to know about each model.
Connection details
- Base URL (OpenAI compatible)
- https://api.aifans.fan/v1
- API key
- Create one in the console; it starts with sk- (no account yet? sign up)
- Recommended models
- deepseek-v4.1-flash, deepseek-v4-pro (all models and prices)
Zed is a fast, open-source code editor with an agent panel built in. It accepts any OpenAI-compatible API, so the models here work in its agent and its inline assistant without an extension.
Add the provider
Open the command palette and run zed: open settings, then add:
{
"language_models": {
"openai_compatible": {
"aifans": {
"api_url": "https://api.aifans.fan/v1",
"available_models": [
{"name": "deepseek-v4.1-flash", "display_name": "DeepSeek V4.1 Flash", "max_tokens": 1000000, "capabilities": {"images": true, "tools": true}},
{"name": "deepseek-v4-pro", "display_name": "DeepSeek V4 Pro", "max_tokens": 1000000, "capabilities": {"images": false}}
]
}
}
}
}
max_tokens is the context window, which Zed requires for an OpenAI-compatible model; display_name is what you see in the model picker.
Give it the key
Keep the key out of settings.json. Either run agent: open settings, find the provider under LLM Providers and paste the key there (Zed keeps it in the system keychain), or set the environment variable Zed derives from the provider name — for aifans that is AIFANS_API_KEY:
# macOS / Linux export AIFANS_API_KEY="YOUR_API_KEY" # Windows PowerShell $env:AIFANS_API_KEY = "YOUR_API_KEY"
Restart Zed, open the agent panel, pick deepseek-v4.1-flash in the model picker and send a message to test. A single project can override all of this in .zed/settings.json.
Notes
- These settings apply to Zed's own agent and inline features; an external agent you run in Zed's terminal keeps its own configuration (see the Claude Code and OpenCode and Aider guides).
- The agent resends the conversation on every step; most of it comes back as a cache hit, billed at the cached-input price. Start a new thread when you change topic so the context does not grow for ever.
- Edit predictions need a completion (FIM) endpoint, which we do not offer: use these models for the agent and the inline assistant.
- Zed's setting names move between releases; its own documentation is authoritative.