1. Create a Claude Code identity
In the tenant portal, create an API key named for the employee and device—for example Steele-ClaudeCode-Mac. Add team and project tags for reporting and Duplicate Guard.
2. Export the tenant URL and key
On macOS or Linux:
export ANTHROPIC_BASE_URL='https://your-company.safetyrouter.io'
export ANTHROPIC_AUTH_TOKEN='sr_live_...'
export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1In PowerShell:
$env:ANTHROPIC_BASE_URL = 'https://your-company.safetyrouter.io'
$env:ANTHROPIC_AUTH_TOKEN = 'sr_live_...'
$env:CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC = '1'Do not add /v1. Claude Code appends /v1/messages?beta=true. SafetyRouter accepts the recommended bearer token and also supports ANTHROPIC_API_KEY through the x-api-key header.
3. Start with an allowed model
Use the exact model ID enabled in the tenant Policy and API-key settings. OpenRouter-style IDs are accepted as custom gateway model names.
claude --model 'anthropic/claude-sonnet-4.6'You can first verify the route without opening Claude Code:
curl -X POST "$ANTHROPIC_BASE_URL/v1/messages" \
-H "Authorization: Bearer $ANTHROPIC_AUTH_TOKEN" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{"model":"anthropic/claude-sonnet-4.6","max_tokens":8,"messages":[{"role":"user","content":"Say hello"}]}'4. Confirm the gateway
Run /status inside Claude Code. The Anthropic base URL should show your SafetyRouter tenant and the credential source should show ANTHROPIC_AUTH_TOKEN.
SafetyRouter converts Claude Code messages and local tool definitions into the governed model path, inspects the complete response and proposed tool calls, then emits Anthropic-compatible SSE events. This deliberately delays the first streamed content until inspection is complete.
Core text conversations and Claude Code's client-side tools are supported. Image/document inputs, Anthropic-hosted server tools, adaptive thinking pass-through, context management, and exact token counting are not included in this release. Claude Code falls back to an approximate context count when the optional count-tokens endpoint is absent.
Configuration and protocol behavior verified against Anthropic's official gateway connection guide and gateway compatibility guide. Client-tested with Claude Code 2.1.278.