Short answer
To use Zed with APIVAI, open Agent Settings (command agent: open settings), click Add Provider under LLM Providers and add an OpenAI-compatible provider with the API URL https://api.apivai.com/v1, your APIVAI key and a model ID such as claude-sonnet-4-6 or gpt-5.5; in settings.json this is a language_models.openai_compatible entry. For Claude in its native format you can instead add an Anthropic-compatible provider with https://api.apivai.com and no /v1, because Zed appends /v1/messages itself. As of 2026-10-10, Claude Sonnet 4.6 costs $1.15 / $5.74 per million input / output tokens through APIVAI, against the official $3.00 / $15.00. You pay per token from a prepaid balance, with no subscription.
What is Zed's Agent Panel, and why connect your own API?
Zed is a fast, open-source code editor with a built-in AI agent. The Zed Agent works in the Agent Panel: it reads your project, edits files, runs tools and shows each change so you can review or restore it. The same model settings also power the Inline Assistant, Git commit message generation and thread summaries.
Zed can use its own hosted models, but it also accepts any provider with an API key. That is where APIVAI fits: one key gives you Claude and GPT models, billed per token below official list prices for most models, from a balance you top up when you need to. The key works in both the OpenAI format and the Anthropic format, so you can use either of Zed's custom provider types.
Which provider type should you use in Zed?
Zed has two kinds of custom endpoints that work with APIVAI:
| OpenAI-compatible | Anthropic-compatible | |
|---|---|---|
| Settings key | openai_compatible | anthropic_compatible |
| API URL | https://api.apivai.com/v1 | https://api.apivai.com (no /v1) |
| Models | Claude and GPT | Claude only |
| What Zed calls | /chat/completions | /v1/messages |
| Best for | One provider for every model | Claude in its native Messages format, prompt caching |
Start with OpenAI-compatible: one provider covers Claude and GPT, and switching models is one click in the Agent Panel. Add Anthropic-compatible as well if you mainly use Claude and want Zed's native Claude request format, including prompt caching. Both can be configured at the same time with the same key.
How do you set up Zed with APIVAI step by step?
Step 1: Create an APIVAI key
- Sign up at apivai.com with your email.
- Top up your balance from $10 by card, crypto, Alipay or WeChat Pay. There is no free trial; you pay only for what you use.
- Open the Dashboard, create a key and copy it. You can give the key its own budget limit, so the agent can never spend more than you planned.
Step 2: Add the OpenAI-compatible provider
The quickest way is the settings UI:
- Run
agent: open settingsfrom the command palette (or go to Settings → AI → LLM Providers). - Click Add Provider and fill in the provider name, API URL, model ID and context window using the table below.
- Paste your APIVAI key into the provider's key field. Zed stores it in the system keychain, not in
settings.json.
| Field | Value |
|---|---|
| Provider name | apivai |
| API URL | https://api.apivai.com/v1 |
| API key | Your APIVAI key |
| Model ID | claude-sonnet-4-6 (or any ID from GET /v1/models) |
| Context window | 200000 |
If you prefer to edit settings.json, the same provider with two models looks like this:
{
"language_models": {
"openai_compatible": {
"apivai": {
"api_url": "https://api.apivai.com/v1",
"available_models": [
{
"name": "claude-sonnet-4-6",
"display_name": "Claude Sonnet 4.6 (APIVAI)",
"max_tokens": 200000,
"max_output_tokens": 16384
},
{
"name": "gpt-5.5",
"display_name": "GPT-5.5 (APIVAI)",
"max_tokens": 128000,
"max_output_tokens": 16384
}
]
}
}
}
}Three details matter. In Zed, max_tokens is the context window, not the reply length; the reply limit is max_output_tokens. The api_url must end in /v1 exactly once, because Zed adds /chat/completions to it. And the key never goes into settings.json: enter it in the UI, or set the environment variable Zed derives from the provider ID (upper case plus _API_KEY, so apivai becomes APIVAI_API_KEY) and restart Zed.
To see which model IDs your key can use, run:
curl https://api.apivai.com/v1/models \ -H "Authorization: Bearer YOUR_APIVAI_KEY"
The model list changes over time, so copy IDs from this response or from the pricing page rather than from old tutorials.
Step 3 (optional): Add an Anthropic-compatible provider for Claude
In Add Provider, choose Anthropic and enter https://api.apivai.com as the API URL, or add this next to the block above:
"anthropic_compatible": {
"apivai-claude": {
"api_url": "https://api.apivai.com",
"available_models": [
{
"name": "claude-sonnet-4-6",
"display_name": "Claude Sonnet 4.6 (APIVAI native)",
"max_tokens": 200000,
"max_output_tokens": 16384,
"capabilities": {
"tools": true,
"images": false,
"prompt_caching": true
}
}
]
}
}Do not add /v1 here. Zed's Anthropic client appends /v1/messages to the API URL, so https://api.apivai.com/v1 would become /v1/v1/messages and fail with 404. prompt_caching makes Zed send cache breakpoints, so repeated context is billed at the cache read price ($0.12 per 1M for Claude Sonnet 4.6). Enter the key in the provider's settings UI. More about this format is on the Claude API proxy page.
Step 4: Pick the model in the Agent Panel
Open the Agent Panel and click the model selector in the message editor. Your APIVAI models appear under the provider name you chose; make sure you pick the APIVAI entry and not a model with the same name from another provider. To make it the default, set agent.default_model in settings.json with your provider name and the model ID.
Which model should you choose in Zed?
The agent sends a request for every step, so the price per token matters. Prices per 1M input / output tokens as of 2026-10-10:
| Model ID | Price (in / out) | Use it for |
|---|---|---|
claude-sonnet-4-6 | $1.15 / $5.74 | Default for everyday coding |
claude-sonnet-5-5 | $0.77 / $3.82 | Everyday coding, newer Sonnet |
claude-opus-5-5 | $1.54 / $7.65 | Hard bugs, large refactors |
claude-haiku-4-5 | $0.38 / $1.92 | Inline Assistant, commit messages, small edits |
gpt-5.5 | $0.77 / $4.56 | GPT alternative, second opinion |
gpt-6-luna | $0.0144 / $0.0768 | Very cheap simple tasks |
A practical setup: Claude Sonnet 4.6 or Claude Sonnet 5.5 for the agent, Claude Opus 5.5 when a task keeps failing, and Claude Haiku 4.5 for quick inline edits. GPT models only work through the OpenAI-compatible provider.
How much does Zed cost with APIVAI?
Each agent step resends the thread and the files the agent has read, so input tokens dominate. Two realistic examples with Claude Sonnet 4.6:
- One medium task, such as fixing a bug across a few files: about 15 requests of 25,000 input and 1,500 output tokens each. Cost: $0.56 with APIVAI, $1.46 at official prices.
- A working month of two such tasks a day for 22 days (660 requests): $24.66 with APIVAI, $64.35 at official prices.
The same month on Claude Haiku 4.5 would cost $8.17. These estimates ignore prompt caching and count thinking tokens in the output figure, since thinking is billed as output. The Dashboard lists every request with its tokens and cost, so you can replace these assumptions with your own numbers after a day. For a wider comparison, see Claude API pricing in 2026.
How do you fix common Zed errors?
- 401 Unauthorized: the key is missing, incomplete, deleted or out of budget. Re-enter it in the provider settings. A non-empty environment variable overrides the keychain value, so check
APIVAI_API_KEYtoo. - 404 Not Found: almost always the
/v1part. OpenAI-compatible needshttps://api.apivai.com/v1(no/chat/completionsat the end); Anthropic-compatible needshttps://api.apivai.comwithout/v1. - Model not found:
namemust be an exact ID such asclaude-sonnet-4-6, not a display name. Check it againstGET /v1/models. - Empty or cut-off replies: thinking is on by default and uses output tokens. Raise
max_output_tokensto 8192 or more (at least 4096). - 429 Too Many Requests: the default limit is 60 requests per minute per key. Long agent runs can hit it; wait a moment or ask support to raise it.
The general format rules are on the OpenAI-compatible API page and in the docs.
FAQ
Can I use Claude and GPT in Zed with one key?
Yes. Add one OpenAI-compatible provider with both model IDs in available_models and switch between them in the model selector.
Which API URL do I enter in Zed?
https://api.apivai.com/v1 for an OpenAI-compatible provider and https://api.apivai.com for an Anthropic-compatible provider, because Zed adds /v1/messages itself.
Does this work with Zed's edit predictions?
No. Edit Prediction has its own provider setup; the providers on this page power the Zed Agent, the Inline Assistant, commit messages and thread summaries.
Does APIVAI store my code?
No. The content of requests and responses is not logged. Only usage data such as model, token counts and cost is kept for billing.
Can I use the same key in other editors?
Yes. The same key works in Cline, Continue and terminal agents such as OpenCode. A separate key per tool keeps the Dashboard easy to read.
Create an account, top up from $10 and paste your key into Zed.