Skip to content

Claude Code

Claude Code reads two environment variables to locate the Anthropic API. Point them at your Myra AI Workspace tenant and gateway to route all Claude Code traffic through Myra AI Workspace — giving you audit logs, cost tracking, guardrails, and rate limiting without any changes to how you use Claude Code.

Prerequisites

  • A running Myra AI Workspace instance
  • A tenant and gateway configured with an Anthropic BYOK key
  • A gateway auth token

Configuration

Set the two variables before running claude:

export ANTHROPIC_BASE_URL="https://ai-api.myra.eu/v1/{tenant}/{gateway}/anthropic"
export ANTHROPIC_API_KEY="<your-gateway-token>"
claude

Replace {tenant} and {gateway} with your tenant and gateway slugs. ANTHROPIC_API_KEY is the gateway token, not an Anthropic API key — the gateway uses it for authentication and injects your stored Anthropic key from its vault.

💡 Note: You can set ANTHROPIC_AUTH_TOKEN instead of ANTHROPIC_API_KEY. Claude Code sends ANTHROPIC_AUTH_TOKEN as an Authorization: Bearer header, which the gateway also accepts, and it avoids the one-time custom-API-key approval prompt that ANTHROPIC_API_KEY triggers.

Persistent setup

Add the exports to your shell profile so every Claude Code session is routed automatically:

# ~/.bashrc or ~/.zshrc
export ANTHROPIC_BASE_URL="https://ai-api.myra.eu/v1/{tenant}/{gateway}/anthropic"
export ANTHROPIC_API_KEY="<your-gateway-token>"

Then reload your shell:

source ~/.bashrc   # or source ~/.zshrc

What you get

Every Claude Code session is now visible in the gateway:

Benefit Where to see it
Request logs with prompt and response Settings → Request Logs
Token counts and cost per session Overview → Cost Analytics
Guardrail enforcement (PII, jailbreak, etc.) Configured per gateway under Settings → Gateways (no standalone page)
Rate limiting and budget caps Configured per gateway under Settings → Gateways
Fallback to another provider on failure The gateway's routing rules, under Settings → Gateways

See also