ANTHROPIC_BASE_URL without /v1, plus a Modellix API key.
This page covers LLM text only (
https://llm.modellix.ai).The Agent SDK targets Anthropic-compatible endpoints, not OpenAI Chat Completions. Do not set OPENAI_BASE_URL or https://llm.modellix.ai/v1 for this SDK. Use https://llm.modellix.ai and anthropic/... model IDs. See Models & Pricing.Set Up the Claude Agent SDK
1
Install the SDK
Python:TypeScript:Both packages typically bundle a Claude Code binary. If your install skips optional/native binaries, install Claude Code and ensure it is on
PATH (or set the SDK path option for your language).2
Set Credentials
Create a Modellix API key in the console, then export:
If the client expects Bearer auth, use
ANTHROPIC_AUTH_TOKEN instead of ANTHROPIC_API_KEY. Do not set both to different values.The SDK does not load .env files automatically. Export variables in the shell that runs your agent, or pass them through ClaudeAgentOptions.env (see next step).3
Run a Query Against Modellix
The Python/TypeScript SDK spawns Claude Code and forwards environment variables. Set Modellix credentials in the process environment, or merge them into Use an exact Modellix Model ID. Bare Anthropic Console names (for example
options.env so the subprocess always receives them.claude-sonnet-4-6) are not Modellix catalog IDs.4
Optional: Persist Like Claude Code
For interactive Claude Code and Agent SDK processes that inherit user settings, you can also persist the same values in Details match the Claude Code guide. Prefer
~/.claude/settings.json:options.env when you need the Agent SDK process to be self-contained.Troubleshooting
Related
- Claude Agent SDK overview — capabilities and when to use the SDK
- Claude Agent SDK quickstart — install, auth, first agent
- Claude Code — same
ANTHROPIC_BASE_URLpattern for the CLI - Anthropic SDK — Messages protocol without the agent harness
- OpenAI Agents SDK — Chat Completions agent path on
/v1 - Models & Pricing — Model IDs and rates
- Create message — OpenAPI reference