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.

Need to configure Claude Code in VS Code with your own API key? When connecting through BetterToken, users in Russia do not need a persistent VPN or foreign card: enter the current Base URL and key fields from the documentation in ~/.claude/settings.json. The extension reads the shared Claude Code configuration and sends requests to the selected API endpoint.

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 includes the Claude Code CLI and makes it available from the integrated terminal. A separate system installation is needed only to use the CLI independently of the extension bundle.

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. On the verification date, the official documentation required VS Code 1.98.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

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://www.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. Edit ~/.claude/settings.json

On macOS and Linux, the configuration is stored at ~/.claude/settings.json. On Windows, it is %USERPROFILE%\.claude\settings.json.

Add an env block:

{ "env": { "ANTHROPIC_BASE_URL": "https://www.bettertoken.ai", "ANTHROPIC_AUTH_TOKEN": "your_api_key_here" } }

Replace your_api_key_here with the key from Step 1. If the file already contains other fields, add only the "env" section and leave everything else unchanged.

Both the VS Code extension and CLI read this file, so the settings are shared.

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 the env configuration.

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.

The minimum VS Code version on the verification date was 1.98.0. Check it under Help → About.

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:

Добавь однострочный комментарий перед первой функцией, кратко описывающий, что она делает.

Or:

Переименуй переменную `tmp` в `result` в этом файле.

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:

  1. Check the VS Code version: it must be 1.98.0 or later (Help → About).
  2. Run Developer: Reload Window from the Command Palette.
  3. 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

Check the settings.json path for your operating system and validate the JSON. An extra comma or missing bracket prevents the env section from loading. Then run Developer: Reload Window. If values are also set in the shell or extension settings, 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:

  1. Base URL — it must be https://www.bettertoken.ai without /v1. An extra /v1 suffix causes 404 on some methods.
  2. API key — ensure that the value has no spaces, line breaks, or extra quotation marks.
  3. Variable conflict — if the shell already defines ANTHROPIC_AUTH_TOKEN or ANTHROPIC_BASE_URL with another value, it may override the intended configuration. Remove conflicting variables from the shell profile or launch VS Code with code . 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

Ready to optimize your LLM workflow?

Join thousands of developers building faster, smarter, and more cost-effective AI applications with BetterToken.