Zed integration
Use Claude in Zed with a Claude Pro or Max subscription
Zed has no direct LLM provider path for Claude Pro or Max plans. Plan2API adds one: an openai_compatible entry in settings.json puts any of 9 Claude models, with up to 1M tokens of context, in the agent panel's model selector, billed to the plan you already pay for.
- Provider type
- openai_
compatible - api_url
- https://
api.plan2api.com/ v1 - Key env var
- PLAN_
2_ API_ API_ KEY - Claude models
- 9, up to 1M context
Updated
Zed settings for Plan2API
Zed talks to Plan2API through a language_models.openai_compatible provider entry in settings.json. The table below lists the provider fields and per-model settings Zed reads for that entry.
| Setting | Value |
|---|---|
| Settings path | language_ |
| api_ | https:// |
| API key | Agent Settings (keychain) or PLAN_ |
| name | A Plan2API id, such as claude/ |
| max_ | Context window: 1000000 for Claude Sonnet 5 |
| max_ | Optional reply cap, up to 128K on Claude |
| capabilities.chat_ | true (the default) |
| Default model | agent.default_ |
Ways to use Claude in Zed
Zed's docs list "No direct Zed LLM provider path" for a Claude Pro or Max subscription, so on its own a subscription only reaches Claude Agent (an External Agent over ACP) or Claude Code in a Terminal Thread, which both run their own agent loop instead of Zed's. Zed's built-in Anthropic provider runs in the Zed Agent, but it takes an ANTHROPIC_API_KEY and bills as Anthropic API usage rather than using your Pro or Max plan. Plan2API turns your subscription into a Claude subscription API and exposes it as an OpenAI-compatible provider, so Claude models run inside the Zed Agent with its native tools, threads and model selector.
The table below compares all four options by how they're billed and whether the model runs inside the Zed Agent.
| Path | Billed to | Model in the Zed Agent |
|---|---|---|
| Anthropic provider with an API key | Anthropic API usage | Yes |
| Claude Agent (External Agent, ACP) | Claude Pro or Max | No, separate agent |
| Claude Code in a Terminal Thread | Claude Pro or Max | No, terminal CLI |
| Plan2API as openai_ | Claude Pro or Max | Yes |
Add Plan2API to Zed
- Sign up with a Google account, connect your Claude Pro or Max subscription by signing in with your Claude account, and copy your
p2a_API key. - Add the
language_models.openai_compatible.plan2apiblock from the example below to Zed'ssettings.json, or click Add Provider under LLM Providers in Agent Settings and enter the provider name, API URL (https://api.plan2api.com/v1), model ID and context window. - Run
agent: open settingsfrom the command palette and paste thep2a_key into theplan2apiprovider field (Zed saves it in your system keychain, not insettings.json), or exportPLAN_2_API_API_KEYin your shell before starting Zed (Zed splits the provider ID at digits, so the name is notPLAN2API_API_KEY). - Open the agent panel and pick a Claude model from the model selector.
Here's a complete settings.json snippet that registers the plan2api provider and sets agent.default_model to use it.
{
"language_models": {
"openai_compatible": {
"plan2api": {
"api_url": "https://api.plan2api.com/v1",
"available_models": [
{
"name": "claude/claude-sonnet-5",
"display_name": "Claude Sonnet 5 (Plan2API)",
"max_tokens": 1000000,
"max_output_tokens": 64000,
"reasoning_effort": "high",
"capabilities": {
"tools": true,
"images": true,
"parallel_tool_calls": false,
"prompt_cache_key": false,
"chat_completions": true,
"interleaved_reasoning": false,
"max_tokens_parameter": false
}
},
{
"name": "claude/claude-opus-5-5",
"display_name": "Claude Opus 5.5 (Plan2API)",
"max_tokens": 1000000,
"max_output_tokens": 64000
}
]
}
}
},
"agent": {
"default_model": {
"provider": "plan2api",
"model": "claude/claude-sonnet-5"
}
}
}Pick a model in the agent panel
Run agent: new thread from the command palette to open the agent panel, then switch models from the selector on the message editor or with cmd-alt-/ (ctrl-alt-/ on Linux and Windows). A provider logo sits to the left of each model name so you can tell which provider an entry comes from.
When you pick a model in a Zed Agent thread, Zed writes that choice to agent.default_model in your settings. You can pin models you switch between often with the star icon in the selector, or list them under agent.favorite_models in settings.json.
Zed sets capabilities.images to false by default for OpenAI-compatible models, so if you want to attach images in a thread, override capabilities and set images to true on your Claude, Gemini and Kimi entries (for example on claude/claude-sonnet-5).
The table below lists the model IDs you can add to available_models and the max_tokens context window to set on each one.
| name | max_tokens | Subscription |
|---|---|---|
| claude/ | 1000000 | Claude Pro or Max |
| claude/ | 1000000 | Claude Pro or Max |
| claude/ | 200000 | Claude Pro or Max |
| claude/ | 200000 | Claude Pro or Max |
| gemini/ | 1048576 | Google AI Pro or Ultra |
| kimi/ | 1048576 | Kimi Code |
What works in Zed and what doesn't
These Zed features work out of the box over the OpenAI-compatible provider:
- The Zed Agent with tool and function calls, since
capabilities.toolsdefaults totrue. - Image attachments in threads once
capabilities.imagesis set totrueon Claude, Gemini and Kimi models (plus Codex models that accept images). - Reasoning effort: set
reasoning_effort(none,minimal,low,medium,high,xhighormax) on a model entry and Zed sends it with each chat completions request. - Streaming responses over
POST /v1/chat/completions. - SSH, dev container and other remote projects, since Zed reads keys from the local keychain and local Zed process environment.
A couple of Zed settings won't work because of the endpoints they call:
- Zed's
anthropic_compatibleprovider type, because it calls the Anthropic Messages endpoint (/v1/messages), which isn't served. - Setting
capabilities.chat_completionstofalse, because that switches Zed to the/v1/responsesendpoint, which isn't served either.
Troubleshooting Zed with Plan2API
401 invalid_api_key: No key is saved for theplan2apiprovider in Agent Settings, or an oldPLAN_2_API_API_KEYin your environment is overriding the keychain key; paste a validp2a_key in Agent Settings or fix the exported variable.403 no_credentials: Your vault has no connected subscription for that model's provider prefix, so open the dashboard and connect a matching account.400 model_not_found: Thenamefield inavailable_modelsdoesn't match a known model ID; checkGET /v1/modelsand copy the exact ID with its provider prefix.400 unsupported_parameter: The request sent a non-textresponse_format(json_objectorjson_schema) to a Claude model, which only works on Codex, Gemini and Kimi models."No tools"label in the model selector: Your model entry overridescapabilitieswithtools: false; setcapabilities.toolsback totrue(and keep all seven capability keys in the block).429 subscription_quota_exhausted: Every connected account for that provider has hit its Claude subscription usage limits; wait for the number of seconds in theRetry-Afterheader or connect another account so requests fail over before output starts.429 daily_requests: You've hit the 50 chat requests per day cap on the Free plan (resets at00:00 UTC); wait for the reset or move to Pro or Scale on the pricing page to remove the daily request cap.
A non-empty PLAN_2_API_API_KEY in Zed's environment always beats the key saved in the system keychain, so unset it and restart Zed if a new key from Agent Settings isn't taking effect.
Use the AI subscriptions you already pay for as one OpenAI-compatible API key.
- Free: 1 subscription, 50 requests a day, no card
- Pro: $12 a month
FAQ
Can I use my Claude Pro or Max subscription in Zed?
Not as a built-in Zed LLM provider, since Zed's docs list no direct provider path for Claude Pro or Max. If you connect the subscription to Plan2API and add it under language_models.openai_compatible in settings.json, you can use your plan's Claude models directly in the Zed Agent.
What does max_tokens mean in Zed's available_models?
In Zed's available_models list, max_tokens is the model's total context window (for example 1000000 on claude/claude-sonnet-5 or 200000 on claude/claude-sonnet-4-6), and Zed requires it on every entry. To cap the length of each reply, set max_output_tokens on the entry as well.
Where does Zed store the Plan2API key?
When you paste the key in Agent Settings, Zed stores it in your operating system's keychain rather than in settings.json. Zed also checks the PLAN_2_API_API_KEY environment variable for the plan2api provider ID, and a non-empty variable wins over the keychain until you unset it and restart Zed.
Why not use Zed's Anthropic-compatible provider?
Zed's Anthropic-compatible provider requires an endpoint that serves the Anthropic Messages API at /v1/messages. Plan2API serves the OpenAI-compatible /v1/chat/completions endpoint, not Anthropic's /v1/messages, so Zed needs to connect through language_models.openai_compatible instead.
Can the same provider also serve Gemini, GPT and Kimi in Zed?
Yes, add more entries under the same available_models list using gemini/, openai/ (or codex/) and kimi/ model IDs, such as gemini/gemini-4-argon-high, openai/gpt-6.1-sol or kimi/k3. One p2a_ API key routes across every subscription connected to your account based on the model ID prefix.
Sources
- Zed docs: Use API accesszed.dev
- Zed docs: Use an existing subscriptionzed.dev
- Zed docs: Agent panelzed.dev
- Zed docs: Agent settingszed.dev
- Zed language model settings (GitHub)github.com
- convert_case 0.11.0 docsdocs.rs
- Claude models overviewplatform.claude.com