Xcode (Claude Code)

Route Claude Code traffic through Axemere Gateway from Xcode's integrated terminal. There is no Claude Code Xcode extension; Claude Code runs as the claude CLI. The configuration is identical to the Claude CLI guide; this page covers Xcode-specific setup and attribution.

Prerequisites

  • Claude Code CLI installed: see Anthropic's install guide
  • 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

How It Works

Claude Code reads ANTHROPIC_BASE_URL from its settings files regardless of whether it is launched from Xcode's integrated terminal, VS Code, or a standalone terminal. 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.

api.anthropic.comAxemere GatewayXcode / Claude CLIapi.anthropic.comAxemere GatewayXcode / Claude CLIPOST /proxy/anthropic/k/mvgc_k_.../v1/messagesAuthenticate Axemere Gateway Key, apply policiesForward with org Anthropic keyResponseResponse + execution record written

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.


Setup

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.

This file is read by Claude Code in any terminal, including Xcode's integrated terminal; one change covers all surfaces.

Per-project

Create <project>/.claude/settings.local.json in your Xcode project root:

{
  "env": {
    "ANTHROPIC_BASE_URL": "https://us.gw.axemere.ai/proxy/anthropic/k/mvgc_k_your-key-here/w/xcode/p/my-project"
  }
}

This file is gitignored by default, so your gateway key stays out of version control. Settings here override anything set in ~/.claude/settings.json for that project only.

Tip — Workload and project attribution: The /w/xcode/p/my-project segments tag every request for attribution in the Records page. The w/xcode workload identifies traffic as coming from Xcode; p/ sets the project. See the Developer Integration Guide for the full URL schema and attribution options.

Settings File Precedence

Claude Code loads settings from four locations. Higher precedence overrides lower:

FileScopeCommitted to repo?Precedence
<project>/.claude/settings.local.jsonThis project, this machine onlyNo (gitignored)1 — highest
<project>/.claude/settings.jsonThis project, all usersYes2
~/.claude/settings.local.jsonAll projects, this machine onlyNo (lives in home)3
~/.claude/settings.jsonAll projects, all machinesNo (lives in home)4 — lowest

A useful pattern: set the gateway URL globally in ~/.claude/settings.json so every claude session on your machine routes through the gateway. For projects where you want finer attribution, add a .claude/settings.local.json with a more specific workload or project segment.


Verify Traffic Is Flowing

  1. Open Xcode's integrated terminal (or any terminal in your project directory) and run claude.

  2. 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.

  3. Send any message, then check the Records page; the request should appear within a few seconds.


Important: Do Not Set ANTHROPIC_API_KEY

This is a Claude CLI behavior: when ANTHROPIC_API_KEY is set in your shell environment, the CLI uses that key instead of the subscription OAuth token, regardless of what ANTHROPIC_BASE_URL is set to. The gateway then receives an API key rather than an OAuth token, which:

  • Is subject to API key billing (not subscription billing)
  • May be selected as a BYOK passthrough if that addon is enabled, or rejected if it is not
  • Will not match OAuth passthrough rules

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 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.


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 usage 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. Using /w/xcode lets you identify all traffic originating from Xcode sessions. 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.

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 a 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).


Troubleshooting

/status shows api.anthropic.com instead of the gateway URL

The settings file was not loaded. Check:

  1. The file is at .claude/settings.local.json relative to where you launched claude in Xcode's terminal, or at ~/.claude/settings.json for global config.
  2. 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"
      }
    }
    
  3. The env key is at the top level of the JSON object, not nested inside another key.
  4. You restarted Claude Code after saving the file; the env block is read at process start, not on hot reload.

401 Unauthorized

The gateway is rejecting the request. Check:

  1. The Axemere Gateway Key in the URL is correct and active: verify in Gateway Keys.
  2. 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.
  3. ANTHROPIC_API_KEY is 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

  1. Confirm /status shows the gateway URL (not api.anthropic.com).
  2. Check that the Axemere Gateway Key in your URL is active and non-expired: verify in Gateway Keys.
  3. Records appear within a few seconds of the request. Allow up to 30 seconds and refresh the Records page.

A Note on Xcode's ChatGPT Integration

Xcode also offers a built-in ChatGPT integration. Routing that through the gateway via OPENAI_BASE_URL has not been verified. If you test it, let us know at support@axemere.ai.


Next Steps

TaskWhere to look
Create and manage gateway keysGateway Keys — Console
View request records and attributionRecords — Console
Configure policies that apply to gateway trafficConfiguration Guide
Full settings file and CLI referenceClaude CLI (Claude Code)
Full URL schema and attribution optionsDeveloper Integration Guide
Understand all terms and fieldsGlossary