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.

Zed settings.json values for Plan2API
SettingValue
Settings pathlanguage_models.openai_compatible.plan2api
api_urlhttps://api.plan2api.com/v1
API keyAgent Settings (keychain) or PLAN_2_API_API_KEY
nameA Plan2API id, such as claude/claude-sonnet-5
max_tokensContext window: 1000000 for Claude Sonnet 5
max_output_tokensOptional reply cap, up to 128K on Claude
capabilities.chat_completionstrue (the default)
Default modelagent.default_model, provider plan2api

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.

Claude options in Zed
PathBilled toModel in the Zed Agent
Anthropic provider with an API keyAnthropic API usageYes
Claude Agent (External Agent, ACP)Claude Pro or MaxNo, separate agent
Claude Code in a Terminal ThreadClaude Pro or MaxNo, terminal CLI
Plan2API as openai_compatibleClaude Pro or MaxYes

Add Plan2API to Zed

  1. 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.
  2. Add the language_models.openai_compatible.plan2api block from the example below to Zed's settings.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.
  3. Run agent: open settings from the command palette and paste the p2a_ key into the plan2api provider field (Zed saves it in your system keychain, not in settings.json), or export PLAN_2_API_API_KEY in your shell before starting Zed (Zed splits the provider ID at digits, so the name is not PLAN2API_API_KEY).
  4. 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.

JSON
{
  "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.

available_models values for Plan2API in Zed
namemax_tokensSubscription
claude/claude-sonnet-51000000Claude Pro or Max
claude/claude-opus-5-51000000Claude Pro or Max
claude/claude-sonnet-4-6200000Claude Pro or Max
claude/claude-haiku-4-5200000Claude Pro or Max
gemini/gemini-3.8-flash-high1048576Google AI Pro or Ultra
kimi/k31048576Kimi 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.tools defaults to true.
  • Image attachments in threads once capabilities.images is set to true on Claude, Gemini and Kimi models (plus Codex models that accept images).
  • Reasoning effort: set reasoning_effort (none, minimal, low, medium, high, xhigh or max) 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_compatible provider type, because it calls the Anthropic Messages endpoint (/v1/messages), which isn't served.
  • Setting capabilities.chat_completions to false, because that switches Zed to the /v1/responses endpoint, which isn't served either.

Troubleshooting Zed with Plan2API

  • 401 invalid_api_key: No key is saved for the plan2api provider in Agent Settings, or an old PLAN_2_API_API_KEY in your environment is overriding the keychain key; paste a valid p2a_ 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: The name field in available_models doesn't match a known model ID; check GET /v1/models and copy the exact ID with its provider prefix.
  • 400 unsupported_parameter: The request sent a non-text response_format (json_object or json_schema) to a Claude model, which only works on Codex, Gemini and Kimi models.
  • "No tools" label in the model selector: Your model entry overrides capabilities with tools: false; set capabilities.tools back to true (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 the Retry-After header 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 at 00: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

  1. Zed docs: Use API accesszed.dev
  2. Zed docs: Use an existing subscriptionzed.dev
  3. Zed docs: Agent panelzed.dev
  4. Zed docs: Agent settingszed.dev
  5. Zed language model settings (GitHub)github.com
  6. convert_case 0.11.0 docsdocs.rs
  7. Claude models overviewplatform.claude.com