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

# Use Claude Code with derestricted.ai

> Point Claude Code at derestricted.ai with two environment variables.

## Install

<CodeGroup>
  ```sh macOS / Linux theme={null}
  curl -fsSL https://claude.ai/install.sh | bash
  ```

  ```powershell Windows theme={null}
  irm https://claude.ai/install.ps1 | iex
  ```
</CodeGroup>

## Step 1 — Set the auth variables

| Variable               | Value                         |
| ---------------------- | ----------------------------- |
| `ANTHROPIC_BASE_URL`   | `https://api.derestricted.ai` |
| `ANTHROPIC_AUTH_TOKEN` | `glmk_YOUR_API_KEY`           |

`ANTHROPIC_API_KEY` also works in place of `ANTHROPIC_AUTH_TOKEN`.

## Step 2 — Choose the model

**Use it by default:**

```sh theme={null}
export ANTHROPIC_DEFAULT_OPUS_MODEL="derestricted-llm"
export ANTHROPIC_DEFAULT_SONNET_MODEL="derestricted-llm"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="derestricted-llm"
claude
```

**Or add it next to the Claude models:**

```sh theme={null}
export ANTHROPIC_CUSTOM_MODEL_OPTION="derestricted-llm"
export ANTHROPIC_CUSTOM_MODEL_OPTION_NAME="derestricted-llm"
claude --model derestricted-llm
```

Switch models in a session with `/model`.

## Step 3 — Save your config

Add to `~/.claude/settings.json`:

```json theme={null}
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.derestricted.ai",
    "ANTHROPIC_AUTH_TOKEN": "glmk_YOUR_API_KEY",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "derestricted-llm",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "derestricted-llm",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "derestricted-llm",
    "CLAUDE_CODE_AUTO_COMPACT_WINDOW": "90000"
  }
}
```

Or add the same values as `export` lines to `~/.zshrc` or `~/.bashrc`.

<Note>
  `CLAUDE_CODE_AUTO_COMPACT_WINDOW` makes Claude Code summarize long sessions before they hit the 400 kB request limit. If you get 413 errors, lower it or run `/compact`.
</Note>

## Headless mode

```sh theme={null}
claude --model derestricted-llm -p "summarize README.md"
```
