Skip to main content

AI Gateway

Beta

Overview

Route the Claude Agent SDK’s model calls through Orq.ai’s AI Gateway without changing any agent logic. The SDK drives the Claude CLI, which reads ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN from the environment, so pointing those variables at the gateway routes every turn through Orq.ai.
For the raw Claude Messages API without the agent runtime, see the Anthropic SDK integration.

Configuration

Set the following environment variables before running the agent:
export ANTHROPIC_BASE_URL="https://api.orq.ai/v3/anthropic"
export ANTHROPIC_AUTH_TOKEN="$ORQ_API_KEY"
export ANTHROPIC_API_KEY=""  # set empty so the SDK does not call the Anthropic API directly
export ANTHROPIC_MODEL="anthropic/claude-sonnet-4-6"  # the anthropic/ prefix is required

Basic Example

With the environment variables set, every agent run routes through the AI Gateway with no change to the calling code:
TypeScript
import { query } from '@anthropic-ai/claude-agent-sdk';

const prompt = 'What is the capital of France?';

for await (const message of query({ prompt })) {
  if ('result' in message && typeof message.result === 'string') {
    console.log(message.result);
  }
}

Model Selection

Change ANTHROPIC_MODEL to route the agent to any supported model. The anthropic/ prefix is required for Claude models. Browse every available model in Supported Models.