VS Code (Claude Code)
Route Claude Code traffic through Axemere Gateway in about 5 minutes. This gives your organization full governance, attribution, and audit logging over every AI request made from the VS Code extension and CLI, without changing how developers write code.
Where to Configure
Claude Code reads settings from a precedence chain. Pick the file that matches the scope
you want; the same precedence applies whether you're using the VS Code extension or the
claude CLI. The two surfaces share one config; there is no separate "VS Code" settings
path that overrides this.
| File | Scope | Committed to repo? | Precedence |
|---|---|---|---|
<project>/.claude/settings.local.json | This project, this machine only | No (gitignored) | 1 — highest |
<project>/.claude/settings.json | This project, all users | Yes | 2 |
~/.claude/settings.local.json | All projects, this machine only | No (lives in home) | 3 |
~/.claude/settings.json | All projects, all machines | No (lives in home) | 4 — lowest |
Do not use
claudeCode.environmentVariablesin VS Code'ssettings.json. That setting only injects env vars into the VS Code extension host process; they never reach the Claude Code backend that actually makes API calls. The official VS Code extension docs explicitly say: "Use Claude Code settings instead for shared config." See Why not VS Code settings.json? below for the full explanation.
Prerequisites
- Claude Code VS Code extension installed, or the
claudeCLI available. - An Axemere Gateway Key: created by your org admin in the console under
Gateway Keys. The key looks like
mvgc_k_.... - Your gateway endpoint:
- Managed Gateway:
https://us.gw.axemere.ai/proxy/anthropic - Self-Hosted Gateway: ask your operator for the base URL
- Managed Gateway:
How It Works
Claude Code communicates with Anthropic's API via the ANTHROPIC_BASE_URL environment
variable. Pointing it at Axemere Gateway routes all Claude traffic through the proxy,
where your organization's policies are applied before the request is forwarded to
Anthropic. Your Axemere Gateway Key, embedded in the URL path, identifies the request
to the gateway; developers do not need an Anthropic API key.
Your developers keep their normal Claude Code workflow. The gateway handles authentication to Anthropic; developers authenticate to the gateway with the Axemere Gateway Key only.
Privacy: Axemere never stores, logs, or accesses the content of AI prompts or responses. Only request metadata (model, token counts, latency, attribution) is recorded. See Execution Records for exactly what is and isn't kept.
Configure the Gateway URL
Add the gateway URL and Axemere Gateway Key to the env block of whichever settings file matches your
desired scope from the precedence table.
Global (all projects)
Edit ~/.claude/settings.json:
{ "env": { "ANTHROPIC_BASE_URL": "https://us.gw.axemere.ai/proxy/anthropic/k/mvgc_k_your-key-here" } }
Replace mvgc_k_your-key-here with your actual Axemere Gateway Key; create one in the
Gateway Keys section of the console.
Tip — Workload and project attribution: You can embed a workload and project directly in the URL to tag every request for attribution in the Records page:
https://us.gw.axemere.ai/proxy/anthropic/k/mvgc_k_your-key-here/w/my-team/p/my-project
w/sets the workload andp/sets the project. See the Developer Integration Guide for the full URL schema and attribution options.
If ~/.claude/settings.json doesn't exist yet, create it. This file is read by both the
claude CLI and the VS Code extension; one change covers every Claude Code surface.
Per-project
A useful pattern for attribution: set a single VS Code workload globally, then override just the project segment per-repo. Every request is tagged as coming from VS Code, and you also know exactly which project or customer it belongs to.
<project>/.claude/settings.local.json:
{ "env": { "ANTHROPIC_BASE_URL": "https://us.gw.axemere.ai/proxy/anthropic/k/mvgc_k_your-key-here/w/vscode/p/my-project" } }
.claude/settings.local.json is gitignored by default, so your Axemere Gateway Key stays out of
version control. Settings here override anything set in ~/.claude/settings.json for
that repo only. Claude Code in other directories continues to use the global config.
Caveat: MCP tool search
Claude Code disables MCP tool search by default when ANTHROPIC_BASE_URL points to a
non-first-party host, to prevent tool-discovery requests from being silently rerouted
through an untrusted proxy. If your organization requires MCP tool search, contact your
administrator to confirm it is supported with your gateway configuration before enabling it.
Verify Traffic Is Flowing
After saving the settings file, restart Claude Code (the env block is read at process
start). Then:
-
In Claude Code, run
/status. The Anthropic base URL line should show your gateway URL:/status output: Anthropic base URL: https://us.gw.axemere.ai/proxy/anthropic/k/mvgc_k_...If the line is missing or shows
https://api.anthropic.com, the settings file was not picked up: check the file path and JSON syntax. -
Send any message in a Claude Code session.
-
Check the Records page in the Axemere console; you should see the request appear within a few seconds, attributed to your Axemere Gateway Key.
Why not VS Code settings.json?
VS Code's Claude Code extension exposes a setting called claudeCode.environmentVariables.
It looks like the right place to set ANTHROPIC_BASE_URL, but it isn't:
- The setting only sets env vars on the VS Code extension host process, the JavaScript code that powers the extension UI inside VS Code.
- The actual Claude Code backend (which makes the HTTPS calls to Anthropic / your gateway) runs as a separate child process. It does not inherit those env vars.
- The official VS Code extension docs explicitly redirect users away from this setting: "Use Claude Code settings instead for shared config."
Symptom of getting this wrong: you put ANTHROPIC_BASE_URL in
claudeCode.environmentVariables, restart the extension, and traffic continues to go
straight to Anthropic instead of through the gateway. Records don't appear in the
console, and echo $ANTHROPIC_BASE_URL in a Claude Code terminal shows the variable is
empty.
Fix: move the configuration to one of the Claude Code settings files in the
precedence table above and remove the
claudeCode.environmentVariables block from VS Code's settings.json.
(Note: claudeCode.useTerminal: true is unrelated and safe to leave enabled; it only
changes whether Claude Code runs in a VS Code terminal vs. the extension's webview panel.
It has no effect on environment variable propagation.)
Do Not Set ANTHROPIC_API_KEY
If ANTHROPIC_API_KEY is set in your shell environment, Claude Code sends it as a bearer
token to the gateway alongside every request. Depending on your org's credential
configuration, the gateway may treat this as a BYOK passthrough and bill usage to your
personal Anthropic account rather than the org's managed credentials, bypassing org-level
cost attribution and spend controls.
To check:
echo $ANTHROPIC_API_KEY
If this prints a key, unset it before using Claude Code with the gateway:
unset ANTHROPIC_API_KEY
The Axemere Gateway Key embedded in ANTHROPIC_BASE_URL (/k/mvgc_k_.../) is the only credential
you need. Claude Code authenticates to the gateway via the URL path; no API key env var
is required.
Cost and Attribution
Requests routed through the gateway are recorded in the Axemere console with:
- Cost: estimated at market API rates using provider pricing data. These estimated costs count toward project budgets and alert thresholds the same way API key spend does. Your actual charges with Anthropic depend on your subscription or API agreement with them directly.
- Workload: the workload ID in your proxy URL (
/w/{workload_id}). Optional: if omitted, the gateway falls back to the org's default workload. Specify it when you have multiple workloads and want to attribute traffic to a specific one. Manage workloads in Customer Console → Workloads. - Optional attribution segments: add project, account, and customer dimensions to the URL for finer-grained tracking. See the Developer Integration Guide for the full URL syntax.
Troubleshooting
/status shows api.anthropic.com instead of the gateway URL
The settings file was not loaded. Check:
- The file is at
.claude/settings.local.json(or~/.claude/settings.jsonfor global) relative to where you launchedclaudeor opened VS Code. - The JSON is valid. It should look like:
{ "env": { "ANTHROPIC_BASE_URL": "https://us.gw.axemere.ai/proxy/anthropic/k/mvgc_k_your-key-here" } } - The
envkey is at the top level of the JSON object, not nested inside another key. - You restarted Claude Code after saving the file; the
envblock is read at process start, not on hot reload.
401 Unauthorized
The gateway is rejecting the request. Check:
- The Axemere Gateway Key in the URL is correct and active: verify in Gateway Keys.
- If
/w/{workload_id}is present in your URL, the workload exists and is active: verify in Customer Console → Workloads. Omitting/w/entirely is valid; a present but empty value (e.g./w//) returns 400. ANTHROPIC_API_KEYis not interfering: see Do Not Set ANTHROPIC_API_KEY.
Request reaches the gateway but is denied (403)
The org policy is blocking the request. Contact your administrator to check the active policy bundle in Customer Console → Policies.
Records not appearing in the console
- Confirm
/statusshows the gateway URL (notapi.anthropic.com). - Check that the Axemere Gateway Key in your URL is active and non-expired: verify in Gateway Keys.
- Records appear within a few seconds of the request. Allow up to 30 seconds and refresh the Records page.
Switching Between Gateway and Direct Anthropic Access
To temporarily bypass the gateway and use Anthropic directly, for example to isolate
whether an issue is gateway-related, remove ANTHROPIC_BASE_URL from your Claude Code
settings file and restart the session.
You can keep a parked copy by renaming the block:
{ "_env_axemere": { "ANTHROPIC_BASE_URL": "https://us.gw.axemere.ai/proxy/anthropic/k/mvgc_k_your-key-here" } }
Claude Code ignores keys it doesn't recognize, so renaming env to _env_axemere
disables the override without losing the values. Rename it back to env to re-enable.
If you used the per-project file (<project>/.claude/settings.local.json), you can also
just delete the file; Claude Code will fall back to ~/.claude/settings.json (or
direct Anthropic access if that's also unset).
Next Steps
| Task | Where to look |
|---|---|
| Create and manage gateway keys | Gateway Keys — Console |
| View request records and attribution | Records — Console |
| Configure policies that apply to gateway traffic | Configuration Guide |
| Understand workloads and attribution | Developer Integration Guide |
| Use the managed gateway for your team | Managed Gateway Guide |
| Understand all terms and fields | Glossary |