Claude Code in VS Code: How to Connect and Verify the Integration
Separate the Claude Code CLI, VS Code extension, and API endpoint layers to configure and verify the integration correctly.
Contents
Need to configure Claude Code in VS Code with your own API key? When connecting through BetterToken, put the current Base URL and key fields in the extension’s VS Code user settings. The extension then sends requests to the selected API endpoint through your own account and key.
The layers of the Claude Code and VS Code integration
The integration has three independent layers. A failure in any one can look the same—Claude Code “does not respond”—but each has a different cause and fix.
Layer 1 — CLI. The official extension bundles a private copy of Claude Code CLI for its chat panel. Installing the extension does not put claude on your shell PATH; install the standalone CLI from the current Anthropic setup guide to run it in VS Code’s integrated terminal.
Layer 2 — VS Code extension. Anthropic’s official Claude Code extension provides a graphical interface with side-by-side diffs, file @mentions, and session history. The current Anthropic VS Code guide requires VS Code 1.94.0 or later.
Layer 3 — API endpoint. Claude Code uses the Anthropic API by default. To use BetterToken, set ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN in the configuration; the extension passes them to Claude Code automatically.
This separation helps with diagnosis: a successful Dashboard record confirms that BetterToken accepted the request. Verify the IDE integration separately through current-file context and the resulting diff.
Connecting to the BetterToken API endpoint from Russia does not require a VPN or a foreign virtual card. Use your own BetterToken account, create an API key in the dashboard, and get the Base URL from the documentation.
Create your own API key and configure Claude Code using the BetterToken documentation: docs.bettertoken.ai/ai-tools/claude-code
How to create a BetterToken API key and connect the endpoint
Want to test Claude Code with your own API key? Create a BetterToken account
Step 1. Create an account and API key
Open bettertoken.ai, register, and go to the key-management section. Create a new API key and copy it; you will need it in the next step.
Step 2. Note the Base URL
Use this Anthropic-compatible Base URL for Claude Code:
https://bettertoken.ai
Do not append /v1. Claude Code adds the API method path automatically. The address containing /v1 is only for OpenAI-compatible tools such as Codex CLI.
Step 3. Set the extension environment variables
Open your VS Code user settings.json and add a separate claudeCode.environmentVariables array:
{
"claudeCode.environmentVariables": [
{ "name": "ANTHROPIC_BASE_URL", "value": "https://bettertoken.ai" },
{ "name": "ANTHROPIC_AUTH_TOKEN", "value": "your_api_key_here" },
{ "name": "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC", "value": "1" },
{ "name": "API_TIMEOUT_MS", "value": "3000000" }
]
}
Replace your_api_key_here with the key from Step 1. If the file already contains other fields, add only the array shown above and leave everything else unchanged. Then run Developer: Reload Window.
To run claude in the integrated terminal, install the standalone CLI first. The current Anthropic command for macOS, Linux, and WSL is curl -fsSL https://claude.ai/install.sh | bash; use the official setup guide for Windows and alternative methods. For the terminal CLI, put the same two fields in the env section of ~/.claude/settings.json (Windows: %USERPROFILE%\.claude\settings.json) as shown in the BetterToken guide.
Step 4. Disable the extension’s login screen
Open VS Code settings (Cmd+, on Mac or Ctrl+, on Windows/Linux), go to Extensions → Claude Code, and enable Disable Login Prompt. For a third-party API provider, this removes the Anthropic sign-in screen; it does not replace claudeCode.environmentVariables.
How to launch Claude Code from VS Code
Step 5. Install the extension
Press Cmd+Shift+X on Mac or Ctrl+Shift+X on Windows/Linux, find “Claude Code” by Anthropic, and click Install.
If the extension icon does not appear after installation, run Developer: Reload Window from the Command Palette.
Check the installed version under Help → About, update VS Code, and follow the current extension-page requirement instead of relying on a fixed version in this article.
Step 6. Open a file and launch the panel
Open any file in the editor. The Spark icon (✱) appears in the upper-right Editor Toolbar only while a file is open. Click it to open the chat panel.
Other ways to open the panel:
- Activity Bar — the Spark icon in the left sidebar, which is always visible.
- Command Palette (
Cmd+Shift+P/Ctrl+Shift+P) → “Claude Code: Open in New Tab”. - Status Bar → ✱ Claude Code in the lower-right corner, which works without an open file.
Step 7. Verify that Claude can see the current file
Select several lines of code. Claude Code displays the number of selected lines below the input field, confirming that the extension reads the current context. Press Option+K on Mac or Alt+K on Windows/Linux to insert an @reference such as @file.ts#5-10 into the request.
How to verify context, diff, and the Dashboard request
Step 8. Send a low-risk test request
Open a small file—a script or configuration—and ask Claude to make a simple, reversible change:
Add a one-line comment before the first function that briefly explains what it does.
Or:
Rename the variable `tmp` to `result` in this file.
The goal is a concrete proposed change that you can inspect visually.
Step 9. Review the side-by-side diff
When Claude proposes an edit, the extension shows a before-and-after comparison and asks for permission. Inspect the proposed changes, then click Accept or Reject.
A meaningful diff confirms that the extension received a model response and attached the edit to the current file. Verify the BetterToken route separately in the Dashboard.
Step 10. Check the request in the BetterToken Dashboard
Open bettertoken.ai and go to the Dashboard or request history. Find a record whose timestamp matches the test request. You can compare the time, model, status, input, output, and cache tokens, plus the corresponding charge.
If VS Code shows the correct diff and the Dashboard shows a successful record at the same time, all three layers work: the extension passed the context, BetterToken processed the request, and the response returned to the IDE.
If there is no result, compare the signals:
- no response and no Dashboard record — check extension launch,
env, Base URL, and the network connection; - a Dashboard request with an error status — open it and check the key, model, and error text;
- a response or diff in VS Code but no matching record — recheck the endpoint, request time, and Dashboard filters; the BetterToken route is not confirmed yet.
What to check when the integration is not detected
The Spark icon does not appear
The Spark icon in the Editor Toolbar appears only while a file is open. If a file is open and the icon is missing:
- Update VS Code and check the extension’s current requirements in Help → About and the Marketplace.
- Run Developer: Reload Window from the Command Palette.
- Temporarily disable other AI extensions such as Cline, Continue, or GitHub Copilot; they can occasionally conflict with Editor Toolbar icons.
As an alternative, use ✱ Claude Code in the Status Bar. That button works without an open file.
VS Code does not inherit environment variables from the terminal
If ANTHROPIC_BASE_URL is set in the shell but the extension still asks you to sign in, VS Code launched from Spotlight or the application menu did not inherit the shell environment.
Launch VS Code from the terminal:
code .
This passes the current environment to VS Code. If that launch method is inconvenient, duplicate the variables in VS Code under Extensions → Claude Code → environmentVariables.
The extension asks you to sign in again
Confirm that Disable Login Prompt is enabled under Extensions → Claude Code. For a third-party provider, it disables the Anthropic sign-in screen, but connection variables still need to be configured separately.
The extension does not read the changed configuration
Validate the VS Code user settings.json. An extra comma or missing bracket prevents claudeCode.environmentVariables from loading. Then run Developer: Reload Window. If values are also set in the shell or CLI config, confirm that neither contains an old Base URL or key. When in doubt, use the current BetterToken documentation, not an old Blog fragment, for field names.
Authentication error: 401 or no response
Check in this order:
- Base URL — it must be
https://bettertoken.aiwithout/v1; adding/v1sends Claude Code to the wrong protocol route. - API key — ensure that the value has no spaces, line breaks, or extra quotation marks.
- Variable conflict — if the shell already defines
ANTHROPIC_AUTH_TOKENorANTHROPIC_BASE_URLwith another value, it may override the intended configuration. Remove conflicting variables from the shell profile or launch VS Code withcode .so it sees the current session’s environment.
The Dashboard helps separate causes: no record means checking request dispatch, endpoint, and network first; a 401 record points to the key or its format.
Full Claude Code setup documentation for BetterToken: docs.bettertoken.ai/ai-tools/claude-code