Guides

VS Code / Cursor / Windsurf

LLMs Text

Using 4AICode in VS Code / Cursor / Windsurf

Anthropic’s official Claude Code extension (2.0+) supports configuring a relay URL directly in VS Code’s settings.json, without relying on system environment variables. Usage is exactly the same on Windows / macOS / Linux.

Cursor and Windsurf are both based on VS Code, so the configuration method is the same.

1. Install the Extension

Search for Claude Code in the Extensions panel and install the one published by Anthropic.

2. Open settings.json

Opening it through the Command Palette is the most reliable and fastest method.

  1. Open the Command Palette:
    • Windows / Linux: Ctrl + Shift + P
    • macOS: Cmd + Shift + P (⇧⌘P)
  2. Type Preferences: Open User Settings (JSON) and press Enter.

If Ctrl/Cmd + Shift + P does not work (commonly because it is intercepted by an input method or another tool), use Ctrl + P / Cmd + P to open the “Quick Open” panel. Type > (greater-than sign) as the first character in the input box to switch to the Command Palette, then search for the same command.

3. Add the Configuration

Add claudeCode.environmentVariables to the top-level object in settings.json:

{
  "claudeCode.environmentVariables": [
    { "name": "ANTHROPIC_BASE_URL", "value": "https://relay.4aicode.com" },
    { "name": "ANTHROPIC_AUTH_TOKEN", "value": "sk-4ai-xxxxxxxxxxxxxxxx" }
  ]
}

If you already have other settings, merge this into them. Do not nest it under another key.

To use ChatGPT gpt-5.6-sol with extra-high reasoning in the Claude Code panel, add the model and reasoning-effort variables as well:

{
  "claudeCode.environmentVariables": [
    { "name": "ANTHROPIC_BASE_URL", "value": "https://relay.4aicode.com" },
    { "name": "ANTHROPIC_AUTH_TOKEN", "value": "sk-4ai-xxxxxxxxxxxxxxxx" },
    { "name": "ANTHROPIC_DEFAULT_OPUS_MODEL", "value": "gpt-5.6-sol" },
    { "name": "ANTHROPIC_DEFAULT_OPUS_MODEL_NAME", "value": "4AICode GPT 5.6 Sol" },
    {
      "name": "ANTHROPIC_DEFAULT_OPUS_MODEL_SUPPORTED_CAPABILITIES",
      "value": "effort,xhigh_effort,thinking,adaptive_thinking,interleaved_thinking"
    },
    { "name": "ANTHROPIC_MODEL", "value": "opus" },
    { "name": "ANTHROPIC_DEFAULT_HAIKU_MODEL", "value": "gpt-5.4-mini" },
    { "name": "CLAUDE_CODE_EFFORT_LEVEL", "value": "xhigh" }
  ]
}

ANTHROPIC_DEFAULT_OPUS_MODEL maps Claude Code’s opus alias to gpt-5.6-sol, and CLAUDE_CODE_EFFORT_LEVEL=xhigh corresponds to extra-high reasoning.

To use GPT-6 Astra, set ANTHROPIC_DEFAULT_OPUS_MODEL to gpt-6-astra; you can also set the display name to 4AICode GPT 6 Astra.

The gateway selects the upstream service by the requested gpt-* or claude-* model name. Check the console for current availability.

4. Restart VS Code

Fully quit and reopen it (closing the window is not enough; variables are read once when the process starts and will not refresh afterward):

  • Windows: File → Exit / Alt + F4, then check that all Code.exe processes have exited in the system tray and Task Manager.
  • macOS: Cmd + Q
  • Linux: File → Exit

The same applies to Cursor / Windsurf.

5. Verify

Open the Claude Code panel on the left (an Anthropic icon appears after installing the extension) and send ping. If it responds, the connection is working.

Then go to Dashboard → Usage Records to confirm the corresponding requests.

FAQ

Q: It still shows the "Welcome to Claude Code" sign-in screen?

Do not click the three buttons (Claude.ai Subscription / Anthropic Console / Bedrock). Clicking them initiates OAuth with the official service. Afterward, you must run claude logout to clear the local login state before returning to 4AICode. Most likely causes:

  1. claudeCode.environmentVariables is misspelled or nested under another key — check settings.json.
  2. VS Code was not fully restarted — terminate all Code.exe processes in the system tray and Task Manager, then reopen it.
  3. You used ANTHROPIC_API_KEY instead of ANTHROPIC_AUTH_TOKEN — the 2.0 extension recognizes the latter more reliably.

Q: Will Cursor’s own Chat / Agent conflict with this?

No. Claude Code is a separate panel. Cursor’s built-in Chat / Agent / Tab use Cursor’s own backend, so they do not affect each other.

Q: Workspace settings or User settings?

We recommend configuring it at the User level (using Preferences: Open User Settings (JSON) above), so all projects share it. If you only want it to apply to one project, use Preferences: Open Workspace Settings (JSON), which writes to .vscode/settings.json under the project.

⚠️ Do not commit Workspace settings to git, or your token may be exposed.