Zed is a fast code editor with a built-in agent, the Zed Agent. It connects to Tokens through an OpenAI-compatible provider declared under language_models.openai_compatible, which sends Chat Completions requests to https://tokens.bd/v1. Zed can also use an Anthropic-compatible provider; that variant is covered near the end.
This guide was checked against Zed v1.22.0 (October 2026).
Keys never go in settings.json
Zed does not read API keys from settings.json. Enter the key in the Agent Panel settings, or set it as an environment variable. Anything you put in settings.json may end up in a dotfiles repo; keep the key out.
Add the provider from the Agent Panel#
The quickest route is the UI:
- Open Agent Settings. From the command palette, run
agent: open settings(actionagent::OpenSettings). - Under LLM Providers, click Add Provider.
- Enter the provider name
Tokens, the API URLhttps://tokens.bd/v1, the model IDdeepseek/deepseek-v4.1-flash, and the context window from the model catalog. - Enter your key,
tok_live_your_key, in the provider's key field.
If you don't have a key yet, create one in the dashboard. See API keys.
Declare Tokens in settings.json#
For a reproducible setup, declare the provider in your Zed settings.json (on macOS and Linux, ~/.config/zed/settings.json):
{
"language_models": {
"openai_compatible": {
"Tokens": {
"api_url": "https://tokens.bd/v1",
"available_models": [
{
"name": "deepseek/deepseek-v4.1-flash",
"display_name": "DeepSeek V4.1 Flash",
"max_tokens": 128000,
"max_output_tokens": 8192,
"capabilities": {
"tools": true,
"images": false,
"parallel_tool_calls": false,
"prompt_cache_key": false,
"chat_completions": true,
"interleaved_reasoning": false,
"max_tokens_parameter": true
}
}
]
}
}
}
}max_tokens here is the context window and max_output_tokens the output limit. The values shown are examples; use the numbers listed for the model in the catalog.
Provide the key#
Zed builds the environment variable name from the provider name: <PROVIDER_NAME>_API_KEY. For a provider called Tokens, that's TOKENS_API_KEY.
export TOKENS_API_KEY=tok_live_your_keyZed must be started from an environment that has this variable. If you launch Zed from a dock or start menu, it may not see variables exported in your shell profile. Entering the key in the Agent Panel avoids that problem.
Capability flags#
Zed's defaults are tools: true, images: false, parallel_tool_calls: false, prompt_cache_key: false, chat_completions: true, interleaved_reasoning: false and max_tokens_parameter: false. Three are worth thinking about:
max_tokens_parameter: truemakes Zed sendmax_tokensinstead ofmax_completion_tokens.max_tokensis the classic Chat Completions field and the safer choice for a gateway serving many providers, which is why the example turns it on.interleaved_reasoning: truesends earlier thinking back inreasoning_content, which DeepSeek-style reasoning models use. Leave it off unless the model you chose is a reasoning model that needs it.chat_completions: falseswitches Zed to the Responses API. Keep ittrue. Tokens serves/v1/responses, but support depends on the upstream for each model, while Chat Completions works for all of them.
Set images: true only for models the catalog lists with image input.
Switch models#
Add more objects to available_models, one per Tokens model, then pick between them in the Agent Panel model picker. Use exact IDs from the catalog or from:
curl -s https://tokens.bd/v1/models -H "Authorization: Bearer $TOKENS_API_KEY"Choosing a model explains the trade-offs for agent work.
Anthropic-compatible variant#
Zed also supports language_models.anthropic_compatible. Set api_url to https://tokens.bd (no /v1; the Anthropic protocol adds the path itself). The capability flags for that provider are tools, images and prompt_caching. Zed sends the key in an X-Api-Key header, which Tokens accepts. The OpenAI-compatible setup above is the simpler choice for most models; the Messages API is described in Messages.
Verify it works#
curl -s https://tokens.bd/v1/chat/completions \
-H "Authorization: Bearer $TOKENS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "deepseek/deepseek-v4.1-flash", "max_tokens": 16, "messages": [{"role": "user", "content": "Reply with OK"}]}'If that works, select "DeepSeek V4.1 Flash" in the Agent Panel model picker and send a prompt. Ask the agent to read a file to confirm tool calls work. The request appears in your dashboard usage analytics.
Troubleshooting#
The model is listed but every request fails with 401 missing_api_key. Zed has no key for the provider. Enter it in the Agent Panel, or check that TOKENS_API_KEY is set in the environment Zed started from. A key added to settings.json is ignored.
401 invalid_api_key. The key is wrong, revoked or rotated. Rotation stops the old secret immediately.
404 model_not_found. name must be the exact Tokens ID, including deepseek/. display_name is only a label.
400 invalid_request mentioning a token parameter. Try toggling max_tokens_parameter.
The agent never edits files. Make sure tools is true and the model supports tool calling.
429 errors. Read Retry-After. Troubleshooting explains each rate limit code.
Request details are in Chat Completions. For a terminal agent alongside Zed, see Crush or OpenCode.
Sources: Zed docs, use your own API access, Zed LLM providers, checked October 2026.