HomeClaude Code › VS Code
OverviewInstallCLI referencePricing & limitsAgent SDKSkills & pluginsGitHubWeb, desktop & IDEModelsErrorsOpen source?TutorialFor studentsQA automationvs Cursorvs Codex & OpenCodeSubagentsHooksMCPEcosystemVS CodeOpenRouterRate limits中文指南
Last updated: September 23, 2026

Claude Code in VS Code: the extension, the terminal route, and the errors

There are two ways to use Claude Code inside VS Code, and most problems people search for come from mixing them up: the official extension, which adds a panel and inline diffs, and the plain CLI in VS Code's integrated terminal, which is the same agent with no extension involved. This page covers both, plus the account check and the error messages.

TLDR

  • Extension: install anthropic.claude-code from the Marketplace (or open vscode:extension/anthropic.claude-code); it installs the CLI for you on first launch.
  • Terminal: open VS Code's terminal and run claude — works in every VS Code build, Cursor included, with no extension.
  • Which account: /status in a session shows the endpoint, key and login in use; the extension and the terminal read the same environment.
  • command 'claude-vscode.editor.openlast' not found = the extension is installed but not activated or the CLI it wraps is missing — reload the window, then check claude --version.

Install the Claude Code VS Code extension

Search for Claude Code by Anthropic in the Extensions view, or paste vscode:extension/anthropic.claude-code into your browser to open it directly. The extension is a front-end for the CLI: on first launch it checks for the claude binary and installs it if it is missing (Node.js 18+ is required for the npm route; the native installer needs nothing). After that, the Claude icon in the activity bar opens a panel where you chat, and every change the agent makes shows as an inline diff you accept or reject — the same loop as the terminal, with the editor as the review surface.

# check the CLI the extension will use
claude --version
# if it is missing, install it yourself and reload VS Code
npm install -g @anthropic-ai/claude-code     # or: curl -fsSL https://claude.ai/install.sh | bash

Or skip the extension: Claude Code in the integrated terminal

Open VS Code's terminal and run claude. This is the full agent — plan mode, subagents, hooks, MCP, /compact — and it works in any VS Code fork, including Cursor and VSCodium, without the extension. Edits land in the open files immediately and VS Code's own diff view shows them. For long autonomous tasks most people prefer this route; for small interactive edits the extension panel is more convenient. They can run at the same time.

Check which account Claude Code is using in VS Code

Both the extension and the terminal read the same configuration, so the answer is the same in either: run /status inside a session. It prints the endpoint (ANTHROPIC_BASE_URL), whether an API key or a /login subscription is active, the model, and the version. If an API key is set in the environment it wins over the login, which is the usual reason "I logged in with Max but it bills my API balance" happens. To switch, either unset ANTHROPIC_API_KEY for subscription use, or set it (with ANTHROPIC_BASE_URL for a gateway) for metered use.

# use this gateway from VS Code: put these in your shell profile, restart VS Code
export ANTHROPIC_BASE_URL=https://aiprimetech.io
export ANTHROPIC_API_KEY=your_gateway_key

VS Code inherits environment variables from the shell that launched it. If /status still shows the old endpoint after you changed your profile, quit VS Code completely and start it from a fresh terminal — reloading the window is not enough.

Error: command 'claude-vscode.editor.openlast' not found

This appears when a keybinding or the command palette calls the extension before it has activated, or when the extension activated but could not find the CLI it wraps.

In order: 1) Reload the window (Developer: Reload Window) — most cases end here. 2) Run claude --version in the terminal; if it is not found, install the CLI (above) and reload again. 3) Check the extension is enabled for this workspace, not just installed. 4) If you use a VS Code fork, confirm the extension version supports it — otherwise the terminal route works regardless. 5) As a last resort uninstall the extension, delete ~/.claude/ caches only if you accept losing local session history, and reinstall.

Other extension problems

  • Panel opens but stays empty → the CLI is starting; check the Output panel (Claude Code) for the real error, usually an old Node.js.
  • Inline diffs never appear → the workspace is not trusted; VS Code blocks extensions in Restricted Mode.
  • Works in the terminal, not in the panel → a proxy or ANTHROPIC_BASE_URL set only in your shell profile, not in the environment VS Code was launched from.
  • 401 / invalid key → the key does not match the endpoint; a gateway URL needs a gateway key, the Anthropic URL needs a console key.

Cost inside VS Code

The extension bills exactly like the CLI — per token through whatever is behind it. On this gateway that is credits at 7.69× face value ($13 buys $100 of usage, 87% off) or a flat-rate unlimited plan from $1; the pricing guide has the details, and the models guide lists what /model can select.

PlanDurationPrice
Unlimited 1 Hour1 hour$1
Unlimited 24 Hours24 hours$10
Unlimited 1 Week1 week$49
Unlimited 15 Days15 days$89

All unlimited plans →

Frequently asked questions

Is there a Claude Code extension for VS Code?

Yes — Anthropic's official `anthropic.claude-code` extension on the Marketplace. It wraps the CLI with a panel and inline diffs; the CLI also runs on its own in VS Code's terminal.

How do I check which account Claude Code uses in VS Code?

Run /status in a session. It shows the endpoint, whether an API key or a subscription login is active, and the model. An API key in the environment takes precedence over /login.

How do I fix 'claude-vscode.editor.openlast' not found?

Reload the VS Code window; if it persists, make sure `claude --version` works in the terminal (install the CLI if not) and that the extension is enabled for the workspace.

Does Claude Code work in Cursor or VSCodium?

In the integrated terminal, always. The extension works where the fork's marketplace carries it.

Run Claude Code on the gateway

Same models, two environment variables, credits at 7.69× face value — or a flat-rate unlimited plan.

Get an API key See unlimited plans

AI Prime Tech is an independent API gateway and is not affiliated with, endorsed by, or sponsored by Anthropic. “Claude” and “Claude Code” are trademarks of Anthropic. Claude Code features described here follow Anthropic’s public documentation at the time of writing and change frequently; prices and model lists on this page are read from this gateway’s live settings.

More Claude Code guides

Claude Code: the complete guideHow to install Claude CodeClaude Code CLI documentation: commands and flagsClaude Code pricing and limits, explainedThe Claude Code SDK, now the Claude Agent SDKClaude Code skills and pluginsClaude Code in GitHub: the App, the Action and @claudeDoes Claude Code have a web interface? Web, desktop and IDE explainedWhich model Claude Code uses, and how to change itClaude Code errors and how to fix themIs Claude Code open source?Claude Code tutorial: your first real sessionClaude for students: Claude Code, the API and what education actually gets youHow to use Claude Code for QA automationClaude Code vs Cursor: which one, when — and how to run bothClaude Code vs Codex vs OpenCode: the terminal agents comparedClaude Code subagents: how they work, how to define them, and agent teamsClaude Code hooks: deterministic control over what the agent doesClaude Code MCP: connecting servers, scopes, remote MCP and real examplesThe Claude Code ecosystem: routers, frameworks, plugins and the lists that track themHow to use OpenRouter in Claude Code (and when not to)Claude rate limit error: what "API error: rate limit reached" means and how to fix itClaude Code 怎么用:从安装到日常使用