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 and configuration
To connect Claude Code to Myra AI Workspace, you need:
- A Myra AI Workspace account
- A tenant and gateway configured with an Anthropic BYOK key
- A gateway auth token for that gateway: create one yourself under Account → Devices & sessions → Tokens → + New Token
(select the gateway; the
myra_…value is shown once), see Profile; if your role cannot create one, ask your workspace administrator
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_TOKENinstead ofANTHROPIC_API_KEY. Claude Code sendsANTHROPIC_AUTH_TOKENas anAuthorization: Bearerheader, which the gateway also accepts, and it avoids the one-time custom-API-key approval prompt thatANTHROPIC_API_KEYtriggers.
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:
What you get
Every Claude Code session is now visible in the gateway:
| Benefit | Where to see it |
|---|---|
| Request logs with prompt and response | Organisation → Governance & security → Request logs |
| Token counts and cost per session | Overview → Cost Analytics |
| Guardrail enforcement (PII, jailbreak, etc.) | Configured per gateway under Organisation › AI setup › Gateways, tab Guardrails & residency (no standalone page) |
| Rate limiting and budget caps | Configured per gateway under Organisation › AI setup › Gateways |
| Fallback to another provider on failure | The gateway's routing rules, under Organisation › AI setup › Gateways, tab Models & routing |
See also
- Registering Claude Code as an external agent (governed access to your connectors through the MCP endpoint)
- Authentication
- BYOK — provider key setup
- Providers — Anthropic