Anthropic Agent SDK

Agent SDK runtime with TheRouter.ai as Anthropic endpoint

Anthropic Agent SDK inherits Claude Code runtime behavior. Environment overrides let those agent sessions use TheRouter.ai transparently.

Overview

Use the TheRouter API endpoint and a model ID from the current model catalog. Framework capabilities and configuration differ; test your integration before production.

Installation

Install the required SDKs and keep your TheRouter.ai key in environment variables.

install.sh
npm install @anthropic-ai/claude-agent-sdk && pip install claude-agent-sdk

Configuration

Configure the TheRouter API base URL and keep your API key on a trusted server.

TypeScript
process.env.ANTHROPIC_BASE_URL = "https://api.therouter.ai";
process.env.ANTHROPIC_AUTH_TOKEN = process.env.THEROUTER_API_KEY ?? "";
process.env.ANTHROPIC_API_KEY = "";

Caveats

Integration note
If variables are partially set, the SDK may attempt direct Anthropic auth. Always set all three variables explicitly.

For production rollouts, pin SDK versions and validate model compatibility in staging before broad rollout.

Help & contact