Use your key in VS Code

Install the Claude Code extension, share ~/.claude/settings.json with the CLI, and skip the sign-in screen.

The Claude Code extension for VS Code (extension ID anthropic.claude-code) brings Claude Code into an editor panel. It shares the same ~/.claude/settings.json as the CLI, so you configure it once and both work.

Install

  1. Search “Claude Code” (publisher Anthropic) in the VS Code Extensions panel and install it.
  2. The command-line equivalent: code --install-extension anthropic.claude-code.
  3. Reload the window afterwards: run Developer: Reload Window from the command palette (⌘⇧P / Ctrl⇧P).

Configure

Identical to using Claude Code — write the env block in ~/.claude/settings.json:

{
  "env": {
    "ANTHROPIC_BASE_URL": "https://<your-base-url>",
    "ANTHROPIC_AUTH_TOKEN": "YOUR_API_KEY",
    "ANTHROPIC_MODEL": "claude-sonnet-5",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-sonnet-5"
  }
}

ANTHROPIC_BASE_URL is host only (no /v1) and ANTHROPIC_AUTH_TOKEN holds your OLETOKEN key. The Quick start dialog on the API keys page offers a download of a script with these values already filled in — pick the “VS Code extension” tab.

The panel still asks you to log in

You do not need a claude.ai account when using an OLETOKEN key:

  1. VS Code settings (⌘, / Ctrl+,) → search “Claude Code login” → tick Disable Login Prompt.
  2. If it still reports you as signed out, VS Code probably did not inherit your shell environment: launch it from a terminal with code .. Writing settings.json as above also works, since it does not depend on environment variables.

Unavailable behind a third-party gateway

Features that rely on a claude.ai account do not apply: usage stats, voice input and cloud sessions (the Web tab). Local capabilities — editing, diff review, the built-in IDE MCP — are unaffected.

Troubleshooting

SymptomCause and fix
401Wrong or disabled key; make sure it is in ANTHROPIC_AUTH_TOKEN
404ANTHROPIC_BASE_URL includes /v1 — drop the path
Extension installed but no Claude iconOpen a file first; the toolbar button appears with an active editor, or use the icon in the activity bar
Config change ignoredReload the window (Developer: Reload Window) and reopen the panel

The same extension installs in Cursor (which accepts the VS Code marketplace) and is configured the same way — see using Cursor.