Zed & OpenCode Setup for Claude Opus 5.5 and GPT-6.2 Sol: /api vs /openai/v1 Rules and Single-Key Routing
As of November 24, 2026, running Claude Opus 5.5 (Anthropic official API list rate $4/$20 per 1M tokens) and GPT-6.2 Sol (OpenAI official Standard rate $2.00/$10.00) in Zed and OpenCode through a third-party gateway comes down to two strict rules: set Zed anthropic_compatible to https://api.qcode.cc/api (no /v1), set Zed openai_compatible and OpenCode to https://api.qcode.cc/openai/v1 (with /v1, and no trailing slash on either); Zed also ignores the ANTHROPIC_BASE_URL environment variable so custom endpoints must be written to api_url in settings.json, and upgrading to Zed v1.29.3 (released 2026-11-20) enables the GPT-6.2 prompt caching fix.
Updated 2026-11-24
Four key points to check before configuring Zed and OpenCode
Anthropic drops /v1; OpenAI requires /v1
Set Zed anthropic_compatible to https://api.qcode.cc/api (the client appends /v1/messages automatically), and set Zed openai_compatible plus OpenCode to https://api.qcode.cc/openai/v1; omit trailing slashes on both, as reversing the /v1 suffix triggers an immediate 404.
Zed ignores the ANTHROPIC_BASE_URL env var
Zed's official documentation only reads API-key environment variables (such as ANTHROPIC_API_KEY, OPENAI_API_KEY, and upper-snake-case _API_KEY variables generated from OpenAI-compatible provider IDs), with non-empty env vars taking precedence over the system keychain; custom gateway URLs must be explicitly set via api_url in settings.json.
Zed v1.29.3 specifically fixed GPT-6.2 prompt caching
Zed stable v1.29.3 (2026-11-20, #67252) fixed prompt caching for reusable OpenAI system instructions on GPT-6.2 and later; on OpenAI's official Standard table, gpt-6.2-sol cached input is $0.10 per 1M tokens compared to $2.00 for uncached input, cutting repeated context costs.
Official input list rates for three flagship coding models
Official per-1M-token rates: Anthropic claude-opus-5-5 at $4 input / $20 output / $0.20 cache read; OpenAI Standard gpt-6.2-sol at $2.00 input / $10.00 output / $0.10 cached input; DeepSeek official deepseek-flash (DeepSeek-V4.1-Flash-1017) off-peak cache miss $0.15 / hit $0.003 / output $0.6 (peak $0.3 / $0.006 / $1.2).
Why Custom Endpoints in Zed and OpenCode Commonly Fail or Return 404
As of 2026-11-24, checked against Zed's official Use API Access documentation and multi-model protocol specs, custom gateway setup failures almost always stem from three details. First is the strict /v1 suffix split: clients implementing the Anthropic Messages API (/v1/messages) append /v1/messages automatically to the base URL, so Zed's language_models.anthropic_compatible must use https://api.qcode.cc/api (without /v1), because adding /v1 duplicates the path and triggers a 404; meanwhile, OpenAI-compatible clients (Zed's language_models.openai_compatible and OpenCode custom providers) expect the version segment in the base URL, so they require https://api.qcode.cc/openai/v1 (with /v1, and no trailing slash on either), and dropping /v1 also returns 404.
Second, Zed ignores the ANTHROPIC_BASE_URL environment variable: Zed's official env-var table reads only API-key variables (such as ANTHROPIC_API_KEY, OPENAI_API_KEY, DEEPSEEK_API_KEY, OPENCODE_API_KEY, and upper-snake-case _API_KEY variables derived from OpenAI-compatible provider IDs, like MY_GATEWAY_API_KEY for my-gateway), and any non-empty env var overrides the system keychain; exporting ANTHROPIC_BASE_URL without explicitly setting api_url in settings.json still routes requests to the default official host.
Third, scopes differ: Zed's API access config powers built-in features like Zed Agent, Inline Assistant, Git commit message generation, and thread summaries, reading the local keychain and local Zed process env vars even inside SSH or dev-container remote projects; external agents and terminal sessions (such as standalone OpenCode CLI or OpenCode connected via ACP) read their own client config files, such as ~/.config/opencode/opencode.json.
2026-11-24 Status: Zed v1.29.3 Fixes GPT-6.2 Caching for Low-Friction Multi-Model Coding
Zed stable v1.29.3 (released 2026-11-20, #67252) specifically resolved OpenAI reusable system instruction caching, stated in the release notes as "Fixed prompt caching for reusable OpenAI system instructions on GPT-6.2 and later." (the same release also shipped #67189 to stop Text Finder from showing prior matches when a query finds no results).
This fix directly improves multi-model coding workflows. For architecture and long-horizon reasoning, Anthropic's official models overview and pricing page list claude-opus-5-5 (1M context, 128K max output, adaptive thinking always on, default effort medium) at $4 input / $20 output / $5 for 5-minute cache writes / $8 for 1-hour cache writes / $0.20 cache reads per million tokens, claude-fable-5-2 (default effort high) at $8 input / $40 output / $0.20 cache reads, and claude-sonnet-5-5 at $2 input / $10 output / $0.10 cache reads.
For high-speed execution, OpenAI's official Standard table lists gpt-6.2-sol at $2.00 input / $10.00 output / $0.10 cached input / $2.50 for 30-minute cache writes / $5.00 for 12-hour cache writes, while DeepSeek's DeepSeek-V4.1-Flash-1017 offers a 1M context window and 384K max output, and starting 2026-11-18 12:00 Beijing time, model-invoked server-side web search and webpage fetch stopped incurring per-request charges and are billed only by tokens added to context.
Also note that Anthropic explicitly states manual thinking.type enabled with budget_tokens was deprecated in 4.6 and is no longer accepted on newer models, so do not copy legacy Claude 4 budget_tokens snippets when configuring Claude 5.5 or Fable 5.2 in Zed.
Three Key Milestones: DeepSeek Billing Update, Zed v1.29.3 Caching Fix, and Current Single-Key Setup
-
2026-11-18
Starting 2026-11-18 12:00 Beijing time, DeepSeek stopped charging per request for model-invoked server-side search and webpage fetch, billing only for tokens added to context; around the same time, DeepSeek's API docs listed OpenCode, Claude Code, and Codex under Agent integrations and published peak and off-peak rates for DeepSeek-V4.1-Flash-1017 (1M context, 384K max output).
-
2026-11-20
Zed shipped stable v1.29.3 (2026-11-20) with fix #67252 for prompt caching on reusable OpenAI system instructions in GPT-6.2 and later, allowing Zed's built-in Agent calling
gpt-6.2-solto reliably hit the official $0.10 per million tokens cached input tier. -
2026-11-24
Checked 2026-11-24: configure both anthropic_compatible (
https://api.qcode.cc/api, no /v1) and openai_compatible (https://api.qcode.cc/openai/v1, with /v1) in Zedsettings.jsonusing one cr_ API key, and point OpenCode's~/.config/opencode/opencode.jsontohttps://api.qcode.cc/openai/v1to routeclaude-opus-5-5,claude-fable-5-2,claude-sonnet-5-5,gpt-6.2-sol,deepseek-v4.1-flash, andglm-5.3from a single key.
Checked Official Documentation Details vs Common Setup Pitfalls
Checked (Zed Official Docs & v1.29.3 Notes; Anthropic / OpenAI / DeepSeek Pricing Pages)
Checked item by item as of 2026-11-24
- 1Zed credentials & remote scope: API keys saved via agent: open settings live in the system keychain rather than
settings.json; non-empty env vars take precedence over the keychain and must be unset followed by a Zed restart to deactivate; in SSH and dev-container remote projects, Zed still reads the local keychain and local Zed process environment variables. - 2Zed compatible endpoints & headers: language_models.anthropic_compatible targets services implementing /v1/messages and requires api_url in
settings.json; openai_compatible derives its env var name by upper-casing the provider ID with underscores plus _API_KEY (e.g., my-gateway maps to MY_GATEWAY_API_KEY) and supports custom_headers, while attempts to override Zed-managed headers such as Authorization, Content-Type, or Accept are ignored with a warning. - 3Zed v1.29.3 fix: stable release 2026-11-20 (#67252) fixed prompt caching for reusable OpenAI system instructions on GPT-6.2 and later.
- 4Anthropic official specs & list rates:
claude-opus-5-5($4/$20; cache read $0.20; default effort medium),claude-fable-5-2($8/$40; cache read $0.20; default effort high), andclaude-sonnet-5-5($2/$10; cache read $0.10; default effort high) each provide a 1M context window, 128K max output, and adaptive thinking;claude-haiku-5-5is $0.10/$0.50 up to 100,000 tokens and $0.50/$2.50 above; earliest retirement dates are 2027-09-22, 2027-11-09, 2027-09-28, and 2027-10-07 respectively. - 5OpenAI & DeepSeek official list rates: on OpenAI Standard,
gpt-6.2-solis $2.00/$10.00 ($0.10 cached input, $2.50 for 30-minute write, $5.00 for 12-hour write) andgpt-6.2-astrais $8.00/$40.00 ($0.40 cached input); DeepSeek official deepseek-flash (DeepSeek-V4.1-Flash-1017, 1M context, 384K max output, concurrency cap 2500) is $0.15 off-peak cache miss / $0.003 hit / $0.6 output and $0.3 / $0.006 / $1.2 during peak hours (Monday to Friday 01:00 - 04:00 and 06:00 - 10:00 UTC, excluding Chinese statutory holidays).
Common Setup Misconceptions (Frequent Failure Points)
Five common mistakes directly trigger 404, authentication failures, or 400 errors.
- 1Exporting
ANTHROPIC_BASE_URLin~/.zshrcexpecting Zed to switch gateways — Zed ignoresANTHROPIC_BASE_URLand reads only API-key env vars; custom endpoints must be set via api_url under anthropic_compatible or openai_compatible insettings.json. - 2Habitually appending /v1 to the Anthropic URL (
https://api.qcode.cc/api/v1) or dropping /v1 from the OpenAI-compatible URL (https://api.qcode.cc/openai) — both return immediate 404 errors; keep /api and /openai/v1 distinct with no trailing slashes. - 3Copying a legacy Claude 4 mode budget_tokens block for
claude-opus-5-5orclaude-fable-5-2— Anthropic's official models overview notes manual budget_tokens was deprecated in 4.6 and is no longer accepted on later models, as the 5.5 and 5.2 series use adaptive thinking. - 4Exporting API keys inside a remote SSH server's shell for Zed's built-in Agent — Zed initializes language model providers in the local process, so remote SSH shell variables are not read by the built-in Agent.
- 5Trying to pass the gateway key by manually setting Authorization in Zed custom_headers — Zed's docs note that client-managed auth headers such as Authorization are ignored with a warning; store keys in the keychain via agent: open settings or set the matching _API_KEY env var.
Zed Built-in Agent (settings.json) vs OpenCode Terminal Agent (opencode.json)
Path A: Zed Built-in Agent & Inline Assistant (Dual Compatible Blocks)
Best for developers who stay inside the editor for code navigation, inline edits, Git commit message generation, and thread summaries. Configuring both language_models.anthropic_compatible (https://api.qcode.cc/api) and language_models.openai_compatible (https://api.qcode.cc/openai/v1) in settings.json surfaces claude-opus-5-5, claude-fable-5-2, claude-sonnet-5-5, gpt-6.2-sol, deepseek-v4.1-flash, and glm-5.3 in one Agent panel picker; credentials stay in the local keychain or local env vars, and upgrading to Zed v1.29.3 unlocks the GPT-6.2 reusable system instruction caching fix.
Path B: OpenCode Terminal Workflow & External Agent (opencode.json)
Best for terminal-driven cross-file refactors, automated test-fix loops, and remote SSH workflows, and also usable inside Zed as an external agent over ACP. Custom endpoints and keys live in ~/.config/opencode/opencode.json: set baseURL (https://api.qcode.cc/openai/v1) and apiKey, run /connect to activate the provider, and use /models to switch between an architecture model (claude-opus-5-5, Anthropic official API list rate $4/$20 per million tokens) and a fast execution model (gpt-6.2-sol, OpenAI official Standard rate $2.00/$10.00; or deepseek-v4.1-flash).
Note that when using OpenCode as a built-in Zed provider (language_models.opencode), Zed reads only the keychain key or OPENCODE_API_KEY (no OAuth) and exposes paid Zen and Go tiers only; zero-cost tier models remain available only inside OpenCode directly or via an ACP external agent.
Step-by-Step Setup: Running Three Core Models in Zed and OpenCode with One cr_ Key
- 1Configure both compatible blocks in Zed
settings.json(upgrade first to stable v1.29.3 released 2026-11-20 or newer to pick up fix #67252 for GPT-6.2 prompt caching): open Zedsettings.jsonand add both anthropic_compatible and openai_compatible under language_models. Under anthropic_compatible, create a provider (for example QCode Anthropic) with api_url set tohttps://api.qcode.cc/api(never add /v1, no trailing slash), and listclaude-opus-5-5,claude-fable-5-2, andclaude-sonnet-5-5in available_models with max_tokens 1000000 and max_output_tokens 128000 (omit legacy Claude 4 budget_tokens fields). Under openai_compatible, create a provider (for example qcode-openai) with api_url set tohttps://api.qcode.cc/openai/v1(must include /v1, no trailing slash), and declaregpt-6.2-sol,deepseek-v4.1-flash(max_tokens 1000000, max_output_tokens 384000), andglm-5.3in available_models. Then run agent: open settings in Zed to save your cr_ API key (stored in the local system keychain, notsettings.json), or export the matching upper-snake-case local env var such asQCODE_OPENAI_API_KEY. - 2Configure OpenCode at
~/.config/opencode/opencode.json: add a custom OpenAI-compatible provider with baseURL set tohttps://api.qcode.cc/openai/v1(must include /v1, no trailing slash) and apiKey set to the same cr_ API key, registeringclaude-opus-5-5,claude-fable-5-2,gpt-6.2-sol,deepseek-v4.1-flash, andglm-5.3in its model list; launch OpenCode, run /connect to bind the provider, and use /models to toggle between your architecture model (claude-opus-5-5, Anthropic official API list rate $4/$20 per million tokens) and fast execution model (gpt-6.2-sol, OpenAI official Standard rate $2.00/$10.00; ordeepseek-v4.1-flash). - 3Swap regional hostnames and test connectivity: from mainland China networks, replace the host with asia.qcode.cc (
https://asia.qcode.cc/apiandhttps://asia.qcode.cc/openai/v1); from North America or Europe, use us.qcode.cc (https://us.qcode.cc/apiandhttps://us.qcode.cc/openai/v1). Send a short test prompt in both the Zed Agent panel and OpenCode: on a 404 check the /v1 suffix first, and on a 401 check whether an old env var is overriding the local keychain or Authorization was mistakenly added to custom_headers.
Unify Zed and OpenCode Access with One QCode cr_ API Key
When mixing models across vendors in Zed and OpenCode, the real operational friction is not JSON syntax — it is opening accounts across multiple provider consoles, binding foreign cards, and maintaining separate prepaid balances. With QCode, one cr_ API key connects Zed anthropic_compatible (https://api.qcode.cc/api, no /v1) alongside Zed openai_compatible and OpenCode (https://api.qcode.cc/openai/v1, with /v1), using asia.qcode.cc from mainland China and us.qcode.cc from North America or Europe without splitting top-ups across consoles.
QCode is rolling out unified API integration for the Gemini 4 family, with live rollout status and per-token pricing published on /models. Register on QCode today to call claude-opus-5-5, claude-fable-5-2, gpt-6.2-sol, and deepseek-v4.1-flash per token with a single cr_ API key, ready to switch as new channels go live.
The same key also routes claude-sonnet-5-5, claude-haiku-5-5, and glm-5.3 on demand, with live rates and catalog availability listed on /models. Not ready for a monthly plan? Pay-as-you-go Packs start at $4 for a one-time quota you use within 7 days; if you already have a Personal Plan, add a booster pack when you need more quota.
Payment options include international cards (Visa / Mastercard), Apple Pay, Google Pay, Alipay, WeChat Pay, Russian local bank cards and SBP, plus multi-network crypto (USDT and more, typically credited within minutes and up to 12 hours).
Frequently Asked Questions
Why does exporting ANTHROPIC_BASE_URL in my shell fail to take effect or return 404 in Zed?
Zed's official documentation reads only provider API-key environment variables (such as ANTHROPIC_API_KEY, OPENAI_API_KEY, DEEPSEEK_API_KEY, and OPENCODE_API_KEY) and ignores ANTHROPIC_BASE_URL. To route Zed through a custom gateway, you must explicitly configure api_url under language_models.anthropic_compatible or language_models.openai_compatible in settings.json. Also follow the suffix rule strictly: set anthropic_compatible to https://api.qcode.cc/api (no /v1, since the client appends /v1/messages automatically) and set openai_compatible and OpenCode to https://api.qcode.cc/openai/v1 (with /v1), with no trailing slash on either, or requests will return 404.
How do Zed's keychain keys, environment variables, and SSH remote projects interact?
Per Zed's official Use API Access docs, API keys entered through agent: open settings are saved in the system keychain rather than settings.json. Non-empty environment variables override the keychain, so if an old key was exported, you must unset that variable and restart Zed before the new keychain value takes effect. For openai_compatible providers, Zed converts the provider ID to upper-snake-case and appends _API_KEY (for example, my-gateway becomes MY_GATEWAY_API_KEY). In SSH or dev-container remote projects, Zed's built-in AI features still initialize inside the local process, reading the local keychain and local Zed process environment variables rather than remote server shell variables.
Why should I upgrade to Zed v1.29.3 for GPT-6.2 Sol, and how do official cache rates compare?
Zed stable v1.29.3 (released 2026-11-20) shipped fix #67252 for prompt caching of reusable OpenAI system instructions on GPT-6.2 and later, preventing long sessions from repeatedly paying full input rates. For reference across official vendor per-million-token tables: on OpenAI Standard, gpt-6.2-sol is $2.00 input, $10.00 output, and $0.10 cached input ($2.50 for 30-minute write, $5.00 for 12-hour write); Anthropic lists claude-opus-5-5 at $4 input, $20 output, $5 for 5-minute cache write, $8 for 1-hour write, and $0.20 cache read (claude-sonnet-5-5 at $2/$10/$0.10, claude-fable-5-2 at $8/$40/$0.20); DeepSeek lists deepseek-flash (DeepSeek-V4.1-Flash-1017) off-peak at $0.15 cache miss, $0.003 cache hit, and $0.6 output (peak $0.3 / $0.006 / $1.2). Check /models for live QCode per-token pricing.
How do I fix 400 errors from budget_tokens on claude-opus-5-5 in Zed, and what limits apply to custom_headers?
Anthropic's official models overview notes that manual extended thinking with thinking.type enabled plus budget_tokens was deprecated in Claude Opus 4.6 and Claude Sonnet 4.6 and is no longer accepted by newer models. When configuring claude-opus-5-5 (default effort medium) or claude-fable-5-2 (default effort high), remove the legacy Claude 4 mode.budget_tokens block and keep max_tokens (1000000) and max_output_tokens (128000). Separately, while Zed supports custom_headers across Anthropic, OpenAI-compatible providers, DeepSeek, and OpenCode, Zed manages Authorization, Content-Type, Accept, and provider authentication headers; trying to override them is ignored with a warning.
What is the difference between using OpenCode as a built-in Zed provider versus running OpenCode CLI (opencode.json) directly?
According to Zed's official documentation, language_models.opencode exposes OpenCode as a model source for Zed's built-in Agent using a keychain key or OPENCODE_API_KEY (not OAuth), shows paid Zen and Go models by default (controlled via show_zen_models and show_go_models), and lets you override per-model endpoints in available_models via protocol (anthropic, openai_responses, openai_chat, or google) and custom_model_api_url. Zero-cost tier OpenCode models do not appear in Zed's built-in Agent and must be used inside OpenCode directly or through an ACP external agent. Running OpenCode CLI standalone reads ~/.config/opencode/opencode.json: set your custom provider baseURL to https://api.qcode.cc/openai/v1 with your cr_ API key, then switch multi-vendor models directly via /connect and /models.
How do mainland China or overseas developers switch regions with one key, and will Gemini 4 require a new account setup?
A single QCode cr_ API key works across all regional entry points: use https://api.qcode.cc/api and https://api.qcode.cc/openai/v1 by default, swap the domain to asia.qcode.cc from mainland China, or switch to us.qcode.cc from North America and Europe without regenerating your key. Top-ups support Visa / Mastercard, Apple Pay, Google Pay, Alipay, WeChat Pay, Russian local bank cards and SBP, and multi-network USDT crypto (typically credited within minutes and up to 12 hours). QCode is rolling out unified API integration for the Gemini 4 family, with live rollout status and per-token pricing published on /models. Register on QCode today to call claude-opus-5-5, claude-fable-5-2, gpt-6.2-sol, and deepseek-v4.1-flash per token with a single cr_ API key, ready to switch as new channels go live.
Sources
Zed Official Docs — Use API Access (zed.dev/docs/ai/use-api-access.md, checked 2026-11-24); Zed Stable v1.29.3 Release Notes (zed.dev/releases/stable/1.29.3, released 2026-11-20, including #67252 and #67189, checked 2026-11-24); Anthropic Official Models Overview and API Pricing (platform.claude.com/docs/en/models/overview and about-claude/pricing, checked 2026-11-24); OpenAI Official API Pricing (developers.openai.com/api/docs/pricing, checked 2026-11-24); DeepSeek Official Models & Pricing Docs (api-docs.deepseek.com/quick_start/pricing/, including the 2026-11-18 billing update, checked 2026-11-24). All sources checked 2026-11-24.