Skip to main content
Use the Claude Agent SDK against the Modellix LLM gateway. The SDK drives the same Claude Code agent loop and speaks the Anthropic Messages API. Point it at Modellix the same way as Claude Code: 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:
Do not append /v1 to ANTHROPIC_BASE_URL. The Claude Code binary / Anthropic client appends /v1/messages itself. Missing this rule commonly causes wrong-path or 404 errors.
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 options.env so the subprocess always receives them.
Use an exact Modellix Model ID. Bare Anthropic Console names (for example claude-sonnet-4-6) are not Modellix catalog IDs.
You can omit env in code if ANTHROPIC_API_KEY and ANTHROPIC_BASE_URL are already exported in the parent process. For production agents, prefer explicit options.env (or a secrets manager) so the subprocess does not depend on ambient shell state.
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 ~/.claude/settings.json:
Details match the Claude Code guide. Prefer options.env when you need the Agent SDK process to be self-contained.

Troubleshooting