Skip to main content
Beta Claude Code is Anthropic’s official CLI for agentic coding in the terminal. Set a few environment variables to route every model call it makes through the AI Gateway, giving each session unified tracing and cost tracking across the full model catalog.

Prerequisites

Setup

Set the following environment variables before launching Claude Code. Once set, every model call Claude Code makes is routed through the Orq.ai AI Gateway for the duration of that session.
export ANTHROPIC_BASE_URL="https://api.orq.ai/v3/anthropic"
export ANTHROPIC_AUTH_TOKEN="$ORQ_API_KEY"
export ANTHROPIC_API_KEY=""  # must be set to empty to prevent Claude Code from using the Anthropic API directly
export ANTHROPIC_MODEL="anthropic/claude-sonnet-4-5"  # the anthropic/ prefix is required
Claude Code requests routed through the AI Gateway appear in Traces.

Troubleshooting

The ANTHROPIC_MODEL value is missing the provider prefix. Use the provider/model_id format (e.g. anthropic/claude-sonnet-4-5, not claude-sonnet-4-5).
ANTHROPIC_API_KEY must be set to an empty string. When it holds a value, Claude Code uses the Anthropic API directly and requests bypass the AI Gateway.
Verify ANTHROPIC_BASE_URL is set to https://api.orq.ai/v3/anthropic. Requests sent to Anthropic’s own endpoint bypass the AI Gateway and produce no Traces.

Verification

Start a Claude Code session and send a prompt. The response appears in the terminal and the trace appears in Orq.ai Traces with the model identifier anthropic/claude-sonnet-4-5 (or whichever model ANTHROPIC_MODEL is set to).