> ## Documentation Index
> Fetch the complete documentation index at: https://docs.modellix.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Use Modellix LLM with Claude Code

> Configure Claude Code to call Modellix with ANTHROPIC_BASE_URL (no /v1), a Modellix API key, and anthropic/... models.

Point Claude Code at the Modellix LLM gateway using the Anthropic-compatible Messages API. Auth and base URL match the [Anthropic SDK](/llm/anthropic-sdk) pattern.

## Configure with environment variables

```bash theme={null}
export ANTHROPIC_API_KEY="mdlx-xxxxxxxx"
export ANTHROPIC_BASE_URL="https://llm.modellix.ai"
```

| Setting  | Value                                                                                                                |
| -------- | -------------------------------------------------------------------------------------------------------------------- |
| Base URL | `https://llm.modellix.ai` (**without** `/v1`)                                                                        |
| API key  | Modellix API Key (`ANTHROPIC_API_KEY` → `x-api-key`)                                                                 |
| Model    | `anthropic/...` (for example `anthropic/claude-sonnet-5`). See [Models & Pricing](/llm/overview#models-and-pricing). |

<Warning>
  Do not append `/v1` to `ANTHROPIC_BASE_URL`. Claude Code / the Anthropic SDK append `/v1/messages` themselves.
</Warning>

If the tool expects Bearer auth, use `ANTHROPIC_AUTH_TOKEN` instead of `ANTHROPIC_API_KEY`. Do not set both to different values.

## Persist in settings

You can write the same values to `~/.claude/settings.json`:

```json theme={null}
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://llm.modellix.ai",
    "ANTHROPIC_API_KEY": "mdlx-xxxxxxxx"
  }
}
```

Replace `mdlx-xxxxxxxx` with a key from the [Modellix console](https://modellix.ai/console/api-key).

## Session headers

Claude Code may send its own session header (for example `X-Claude-Code-Session-Id`). Modellix also accepts `X-Mdlx-Session-Id`; if both are present, `X-Mdlx-Session-Id` wins. See [Session header](/llm/api#session-header).

## Related

* [Anthropic SDK](/llm/anthropic-sdk) — Messages examples in Python / TypeScript
* [Create message](/llm/messages) — OpenAPI reference
* [LLM API guide](/llm/api) — auth, errors, and rate limits
