Install the Claude Code extension by Anthropic from the Marketplace, open your VS Code user settings as JSON and add https://api.claudexia.tech (no /v1) and your sk_cdx_... key under claudeCode.environmentVariables. Reload the window and open the Claude Code panel: no sign-in screen should appear. The extension shares ~/.claude/settings.json and conversation history with the CLI, but it runs its login check before it starts the Claude process. That is why the key is safer in VS Code's own settings than in the Claude Code file alone.
This follows Anthropic's official documentation, which we opened on 10 November 2026, and our Claude Code guide. We did not walk through the combination on a clean Windows or macOS machine for this piece. Where the extension's behavior with a gateway is untested on our side, the text says so.
Extension or CLI: what differs
The extension puts a Claude Code panel inside the editor. It carries a private copy of the CLI, but it does not add claude to your PATH: to launch the agent from a terminal you install the CLI separately. The two share a lot. By the docs they use one ~/.claude/settings.json (variables, hooks, MCP servers), they share conversations, and a session started in the extension can continue in a terminal with claude --resume.
| CLI | VS Code extension | |
|---|---|---|
| Commands and skills | All | A subset, type / to see it |
| MCP server setup | Yes | Yes, the /mcp command in the panel |
| Checkpoints | Yes | Yes |
Shell shortcut with ! | Yes | No |
| Tab completion | Yes | No |
The extension has one thing a terminal lacks: a reference to a file with a line range, such as @app.ts#5-10, goes in with Option+K (Alt+K on Windows and Linux). Which one you pick is a matter of habit. Edits are easy to review in the editor, while ! and Tab matter to people who live in a terminal. A comparison with a separate AI editor is in Claude Code or Cursor in 2026.
Step 1. Install the extension
Open the Extensions panel: Ctrl+Shift+X on Windows and Linux, Cmd+Shift+X on Mac. Search for Claude Code, check that the publisher is Anthropic and click Install. The extension ID is anthropic.claude-code. VS Code must be 1.94.0 or newer, which you can see under Help, About. The extension's version number matches the Claude Code version it bundles.
The panel opens from the spark icon in the editor toolbar (visible while a file is open), from the icon in the activity bar, or from the Claude Code button in the status bar. If nothing shows up after the install, restart VS Code or run Developer: Reload Window.
Step 2. Get a key
There are two common cases, and the extension side is the same for both.
A personal key. Claudexia issues its own key, so you need no Anthropic account and no Claude subscription. Sign up, top up the balance and create a key in the API Keys section of the dashboard. The minimum top-up is $1, and cards and crypto (USDT, BTC, ETH) both work. The key looks like sk_cdx_....
A company key. If your employer runs a gateway, or a team lead owns a Claudexia account, you get the base URL and a credential from them and skip registration. The section on corporate proxies below covers what to ask for.
Step 3. Set the address and key
Press Ctrl+Shift+P (Cmd+Shift+P on Mac) and run Preferences: Open User Settings (JSON). Add this block:
{
"claudeCode.environmentVariables": [
{ "name": "ANTHROPIC_BASE_URL", "value": "https://api.claudexia.tech" },
{ "name": "ANTHROPIC_AUTH_TOKEN", "value": "sk_cdx_YOUR_KEY" },
{ "name": "ANTHROPIC_MODEL", "value": "claude-sonnet-5[1m]" },
{ "name": "ANTHROPIC_DEFAULT_OPUS_MODEL", "value": "claude-opus-5-5[1m]" },
{ "name": "ANTHROPIC_DEFAULT_SONNET_MODEL", "value": "claude-sonnet-5[1m]" },
{ "name": "ANTHROPIC_DEFAULT_HAIKU_MODEL", "value": "claude-sonnet-5" },
{ "name": "CLAUDE_CODE_SUBAGENT_MODEL", "value": "claude-sonnet-5" }
]
}
The address has no /v1, because this is Claude Code, not an OpenAI-compatible client. Anthropic's gateway docs name the first two lines, and the rest come from our Claude Code guide. Keep the ANTHROPIC_DEFAULT_* lines: without them Claude Code asks for its own default models and fails with "There's an issue with the selected model".
Why VS Code settings and not ~/.claude/settings.json, as our guide has it? Anthropic's gateway documentation explains that the extension checks credentials from claudeCode.environmentVariables before launch, while values in ~/.claude/settings.json reach the spawned process but not the extension's own login check. If you already put the key in settings.json and the sign-in screen did not go away, move the variables into VS Code settings. The env block in settings.json stays useful for the CLI, which takes the same set.
Two cautions about the key itself. Do not put it in a project's .claude/settings.json, because that file ends up in the repository. And if VS Code Settings Sync is on, user settings can travel to the cloud with the key inside; you can exclude a setting through settingsSync.ignoredSettings.
Step 4. Check the connection
Run Developer: Reload Window, open the Claude Code panel and type: "what files are in the project root". A reply should arrive with no Sign in screen. If it does not, test the key apart from the extension:
curl https://api.claudexia.tech/v1/messages \
-H "x-api-key: sk_cdx_your_key_here" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{"model":"claude-sonnet-5","max_tokens":100,"messages":[{"role":"user","content":"hello"}]}'
The address has /v1 here because this is a direct call to the Messages API, not a Claude Code setting. In the terminal version the /status command shows an Anthropic base URL line and an Auth token line, which tell you which address and credential are actually in use. Whether the command exists in the extension panel we have not checked: type / to see the commands you have.
Model and context
The [1m] suffix on a model name opens the full 1M context. By our guide, without it Claude Code treats the model as 200K and compacts history at about 190K. The suffix is for Claude Code only and only for models with a 1M context; in other programs, such as Cline and similar extensions, write the name without it. Switch models with /model claude-opus-5-5[1m]. Take names from the catalog, the Model ID column.
Anthropic states that it does not support pointing Claude Code at non-Claude models through a gateway. For that reason we stay on Claude models in the extension.
What switches off when you use a key
Running on a gateway key instead of a Claude account changes some features. Anthropic's docs list what a third-party provider loses: the plan usage bars, voice dictation and the Web tab for cloud sessions. With a token set, two more limits apply. Voice dictation does not work while the token is set. Remote Control is off while the token is set or while ANTHROPIC_BASE_URL points at a host other than Anthropic's. If you need either, leave gateway mode: remove the variables and sign in with claude.ai. The rest of the agent's work, meaning reading files, edits, commands, MCP and checkpoints, does not depend on it.
Extension settings worth knowing
Besides the variables, the extension has its own settings under Extensions, Claude Code. claudeCode.useTerminal switches the panel to terminal mode, which makes the extension look like the CLI inside the editor. initialPermissionMode sets the permission mode at start: default, plan, acceptEdits or bypassPermissions. The last one skips permission prompts. The allowDangerouslySkipPermissions setting adds it to the mode selector, and by the docs you should enable that only in sandboxes without internet access. Keep default until you know which commands the agent runs in your project.
A company key behind a corporate proxy
This is the case behind many searches for the extension with a custom endpoint: the code lives in a company network, the model traffic goes through a gateway the company runs, and a proxy sits in between. The extension side is the same two variables as above. The rest depends on what your administrators did.
Check whether it is already configured
Administrators can distribute the gateway address and credential through managed settings, so Claude Code picks them up at startup. To find out, run claude in a terminal. If it opens on a login screen, no gateway credential was distributed. If a session starts, run /status and look for two lines: Anthropic base URL, and an Auth token or API key line. A Login method line that names a claude.ai account means the credential did not arrive.
Which credential variable
Anthropic's docs split this by what the gateway team calls the credential:
| Set the credential in | Use when |
|---|---|
ANTHROPIC_AUTH_TOKEN | The gateway wants a bearer token, the Authorization header |
ANTHROPIC_API_KEY | The gateway wants an API key, the x-api-key header |
apiKeyHelper | The credential rotates or comes from a vault |
If nobody told you, start with ANTHROPIC_AUTH_TOKEN; a 401 is the sign to switch. A credential in the wrong variable reaches the gateway in a header it does not read. A Claudexia key goes into ANTHROPIC_AUTH_TOKEN, as in step 3.
Proxy and TLS inspection
Claude Code reads the standard HTTPS_PROXY, HTTP_PROXY and NO_PROXY. It does not support SOCKS proxies, and for advanced proxy authentication such as NTLM or Kerberos the docs suggest a gateway that supports it. If the proxy inspects TLS, the root certificate has to be trusted: the docs say the native installer reads the operating system store, and NODE_EXTRA_CA_CERTS covers the rest. The extension bundles its own copy of the CLI, and we have not checked which runtime it uses, so if certificate errors appear, set the variable explicitly. A block assembled from the documentation, which we did not run:
{
"claudeCode.environmentVariables": [
{ "name": "ANTHROPIC_BASE_URL", "value": "https://llm-gateway.example.com" },
{ "name": "ANTHROPIC_AUTH_TOKEN", "value": "sk-gateway-key" },
{ "name": "HTTPS_PROXY", "value": "http://proxy.example.com:8080" },
{ "name": "NODE_EXTRA_CA_CERTS", "value": "/etc/ssl/certs/corp-ca.pem" }
]
}
Allowlist and background traffic
The gateway host must be reachable through the proxy; for Claudexia that is api.claudexia.tech. Claude Code also sends background traffic outside the gateway path: version checks, telemetry, release notes. On a network that allows only the gateway these requests fail and show up as blocked connections. Setting CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1 alongside the gateway variables turns it off, at the cost of auto-updates. The WebFetch tool's domain safety check still calls api.anthropic.com unless you set skipWebFetchPreflight: true in settings.
A 403 from the firewall
If the gateway logs show no request but the client gets a 403 with an HTML body, a web application firewall in front of the gateway may be blocking it. The docs say Claude Code prompts contain XML-style tags and source code that match cross-site-scripting body rules, so a short curl test passes while real sessions fail. The fix sits on the firewall side: exempt the gateway's /v1/messages path from body inspection.
Two notes for administrators. Managed settings can pin the endpoint with allowedProviders set to ["customEndpoint"], which needs Claude Code v2.1.285 or later. And a gateway is a third party that sees your prompts and code, so the decision to send work code through it belongs to your security team. We do not make data-handling promises in this article.
Common errors
| What you see | Cause | What to do |
|---|---|---|
| Sign in screen or "Not logged in · Please run /login" | The extension did not find a key at startup | Set the variables in claudeCode.environmentVariables and run Developer: Reload Window. If that fails, enable claudeCode.disableLoginPrompt: Anthropic's docs describe it for third-party providers, and we have not tested it with a gateway |
| Variables set in your terminal, extension ignores them | VS Code was launched from the dock or Start menu and did not inherit your shell environment | Launch with code . from that terminal, or move the variables into VS Code settings |
| "There's an issue with the selected model" | The ANTHROPIC_DEFAULT_* lines are missing | Add them from the block in step 3 |
401 | Key has a stray space, is cut off, or does not start with sk_cdx_ | Copy it from the dashboard again and check that it is active |
SSL certificate verification failed | A proxy replaces certificates | Set NODE_EXTRA_CA_CERTS, see the proxy section |
"Could not locate the Claude CLI on PATH", or claude not found in the VS Code terminal | The extension does not put claude on your PATH | Install the CLI separately: Claude Code setup guide |
| No spark icon | No file open, VS Code older than 1.94.0, Restricted Mode, or a conflict with another AI extension | Open a file, update VS Code, trust the folder, reload the window |
Environment is read at startup, which matters for the dock-launch row above. After you change variables outside VS Code, quit the editor fully (Cmd+Q on macOS, closing the window does not count) and open it again. If you also want the CLI on Windows, native PowerShell versus WSL2 is covered in our Windows install guide.
Cursor and other VS Code forks
The same extension installs in Cursor: Anthropic's docs give a cursor:extension/anthropic.claude-code link, and other forks can take it from the Open VSX registry. Do not confuse it with Cursor's own models, which have a separate Models section and an address with /v1, covered in How to Use Claude Sonnet 5 in Cursor IDE via Claudexia.
FAQ
Does the Claude Code VS Code extension need a Claude subscription?
By Anthropic's docs, normal sign-in needs a paid Claude plan or a Console account. The gateway documentation adds that while a gateway credential variable is active, requests carry it in place of a claude.ai subscription login. We have not run this in the extension on a clean machine.
Can I use the extension with a custom base URL?
Yes, through claudeCode.environmentVariables: ANTHROPIC_BASE_URL for the address and ANTHROPIC_AUTH_TOKEN or ANTHROPIC_API_KEY for the credential. Anthropic's docs recommend this setting for the gateway credential because the extension checks it before launch.
Why does the extension ignore my environment variables?
Most often VS Code was started from the dock or Start menu and never saw your shell exports. Launch it with code . from the terminal where the variables are set, or put them in VS Code settings. Settings read at startup need a full restart.
What is the difference between the extension and the CLI?
Settings, MCP servers and history are shared. The extension has no ! shortcut and no Tab completion, and part of the commands and skills are missing, but it gives you a panel in the editor and file references with line ranges. It keeps its own copy of the CLI and does not add claude to PATH.
Does it work behind a corporate proxy?
Yes, through an HTTP or HTTPS proxy with HTTPS_PROXY, HTTP_PROXY and NO_PROXY. SOCKS is not supported. For a proxy that replaces certificates, set NODE_EXTRA_CA_CERTS.
Does it work in Cursor?
Yes, it installs in Cursor and in other VS Code forks through Open VSX. The address and key settings are the same.