Harvard Data Science Initiative Harvard Faculty of Arts and Sciences

Generative AI for Scholarship

Harvard Data Science Initiative (HDSI) & Faculty of Arts and Sciences (FAS)

Setting Up Claude Code in VS Code with Harvard's HUIT Bedrock Endpoint

This guide walks through installing and configuring the Claude Code extension for Visual Studio Code, routing all queries through Harvard's HUIT Bedrock proxy. This gives you an AI coding assistant directly inside your editor.

Prerequisite: You should already have a working HUIT API key. If you don't have one yet, see Setting Up Anthropic API Access for Harvard Users.

Step 1: Install VS Code

If you don't already have Visual Studio Code, download it from code.visualstudio.com. It's free and available for Mac, Windows, and Linux.

Step 2: Install the Claude Code Extension

  1. Open VS Code
  2. Press Command-Shift-X (Mac) or Ctrl-Shift-X (Windows) to open the Extensions panel
  3. Search for "Claude Code"
  4. Find the extension published by Anthropic and click Install
Note: VS Code may prompt you to install other extensions like ms-toolsai (Microsoft's Jupyter extension). This is not needed for Claude Code — you can safely skip or dismiss that prompt.

Step 3: Configure Environment Variables

This is the critical step. The Claude Code extension needs your HUIT API credentials. The most reliable way to provide them is through the shared Claude settings file at ~/.claude/settings.json, which is used by both the CLI and the VS Code extension.

Why not just use .zshrc? When VS Code is launched from the Dock, Spotlight, or Finder, macOS does not source your ~/.zshrc, so the extension won't see those environment variables. Putting them in ~/.claude/settings.json ensures they work regardless of how you launch VS Code.

Open a terminal and edit the settings file:

nano ~/.claude/settings.json

Add an "env" block to your settings file. If your file already has other settings, keep those and add the env block alongside them. For example:

{
  "env": {
    "ANTHROPIC_BEDROCK_BASE_URL": "https://apis.huit.harvard.edu/ais-bedrock-llm/v2",
    "ANTHROPIC_API_KEY": "YourKeyHere",
    "CLAUDE_CODE_SKIP_BEDROCK_AUTH": "1",
    "CLAUDE_CODE_USE_BEDROCK": "1",
    "ANTHROPIC_SMALL_FAST_MODEL": "us.anthropic.claude-opus-4-5-20251101-v1:0"
  }
}

Replace YourKeyHere with your actual HUIT API key. Save with Ctrl+O, press Enter, then exit with Ctrl+X.

Watch Out: JSON Comma Rules

JSON is very picky about commas. A misplaced or missing comma will cause a "malformed JSON" error. The rules are:

For example, note the comma after false on line 3 below — it's required because "env" follows it. But there is no comma after the closing } of the env block because it's the last item:

{
  "spinnerTipsEnabled": false,        ← comma here (more items follow)
  "env": {
    "ANTHROPIC_API_KEY": "YourKey",
    "CLAUDE_CODE_USE_BEDROCK": "1"     ← no comma (last item)
  }                                    ← no comma (last item)
}

What these variables do:

Note: All values in the env block must be strings (e.g., "1" not 1). You do not need to specify a model — Claude Code will automatically use the best available model.

Step 4: Disable the Login Prompt

Since you're using Harvard's HUIT proxy rather than Anthropic's direct authentication, you need to disable the default login prompt in VS Code:

  1. Open VS Code Settings: Command-comma (Mac) or Ctrl-comma (Windows)
  2. Search for "Claude Code login"
  3. Check the box for Disable Login Prompt
  4. Close the Settings tab by clicking any open file tab, or press Command-W (Mac) or Ctrl-W (Windows). Settings auto-save — there is no save button.

Step 5: Open Claude Code

You can open Claude Code in VS Code several ways:

Step 6: Verify It Works

Send a simple test message in the Claude Code chat panel:

Hello, what model are you?

You should receive a response from Claude through the HUIT proxy. If it works, you're all set.

This warning is expected and safe to ignore:
Auth conflict: Using ANTHROPIC_API_KEY
 instead of Anthropic Console key. Either
  unset ANTHROPIC_API_KEY, or run `claude
  /logout`.
This just means Claude Code is using your HUIT API key (from ANTHROPIC_API_KEY) instead of a personal Anthropic account. That's exactly what we want — no action needed.

Troubleshooting

Claude Code asks me to log in

You haven't disabled the login prompt. Go to VS Code Settings (Command-comma), search "Claude Code login", and check Disable Login Prompt.

No response or authentication errors

Check that ~/.claude/settings.json is valid JSON and contains the correct API key. You can verify by running in Terminal:

cat ~/.claude/settings.json

Also verify your API key works from the command line:

curl --location 'https://go.apis.huit.harvard.edu/ais-bedrock-llm/apigee/quota' \
  --header "Authorization: Bearer $ANTHROPIC_API_KEY"

VS Code prompts to install ms-toolsai or other extensions

These are unrelated to Claude Code. You can safely dismiss or skip them.

Settings not taking effect

After editing ~/.claude/settings.json, close and reopen VS Code to ensure the extension picks up the new configuration.

Using Claude Code in VS Code

Once configured, Claude Code in VS Code can:

The extension provides the same capabilities as the CLI, with the added convenience of inline diffs, file navigation, and visual integration with your editor.