> ## 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/sdk/anthropic-sdk) pattern.

## Set Up Claude Code

<Steps>
  <Step title="Get a Modellix API Key">
    Create a key in the [Modellix console](https://modellix.ai/console/api-key). Claude Code maps `ANTHROPIC_API_KEY` to the Anthropic-style `x-api-key` header.
  </Step>

  <Step title="Set 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.
  </Step>

  <Step title="Persist in Settings">
    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 your Modellix API key.
  </Step>
</Steps>

## 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/api#session-header).

## Related

* [Anthropic SDK](/llm/sdk/anthropic-sdk) — Messages examples in Python / TypeScript
* [Claude Agent SDK](/llm/sdk/claude-agent-sdk) — same env vars for the programmable agent harness
* [Create message](/llm/messages) — OpenAPI reference
* [LLM API guide](/llm/api/api) — auth, errors, and rate limits
