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

# Use Claude Code with abliteration.ai

> Route Anthropic's Claude Code CLI through abliteration.ai and configure the correct context window for each Abliteration model.

**To use Claude Code with abliteration.ai**, set `ANTHROPIC_BASE_URL` to `https://api.abliteration.ai` and `ANTHROPIC_AUTH_TOKEN` to your `ak_...` key, then map Claude Code to an Abliteration model. Large V2 is the recommended text-only model for coding and has a 1M-token context window.

Setup is three short steps: set the auth variables, choose a model, then persist your config so you don't re-export it in every terminal.

## Install

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

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

## Step 1 — Set the auth variables

These two variables route Claude Code to abliteration.ai and authenticate the session. Every setup below needs them.

| Variable | Value | What it does |
| - | - | - |
| `ANTHROPIC_BASE_URL` | `https://api.abliteration.ai` | Routes Claude Code to abliteration.ai instead of `api.anthropic.com`. |
| `ANTHROPIC_AUTH_TOKEN` | `ak_YOUR_API_KEY` | Recommended. Sends your abliteration.ai key as the bearer `Authorization` header. `ANTHROPIC_API_KEY=ak_...` also works (sent as `x-api-key`); pick whichever your environment already has wired. |

## Step 2 — Choose a model

Claude Code's model picker is built around Claude model IDs. Use the following Claude Code values for Abliteration models:

| Model | Claude Code value | Context | Input |
| - | - | -: | - |
| Large V2 | `abliterated-model-large-v2[1m]` | 1,000,000 | Text |
| Base | `abliterated-model` | 262,144 | Text and images |
| Previous large | `abliterated-model-large[1m]` | 1,000,000 | Text |

Claude Code 2.1.223 and later assumes that unrecognized third-party model IDs have a 200K context window. The `[1m]` suffix tells Claude Code to use a 1M window. Claude Code removes the suffix before the API request, so abliteration.ai receives the canonical model ID, such as `abliterated-model-large-v2`.

### Replace the default Opus / Sonnet / Haiku models

Override the model ID Claude Code sends for each default tier so the existing picker uses Large V2. Plain `claude` then launches into Large V2.

```sh theme={"system"}
export ANTHROPIC_DEFAULT_OPUS_MODEL="abliterated-model-large-v2[1m]"
export ANTHROPIC_DEFAULT_SONNET_MODEL="abliterated-model-large-v2[1m]"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="abliterated-model-large-v2[1m]"

claude
```

### Add Large V2 to the picker

Keep the default Claude tiers intact and add Large V2 as an extra picker entry you switch to explicitly.

```sh theme={"system"}
export ANTHROPIC_CUSTOM_MODEL_OPTION="abliterated-model-large-v2[1m]"
export ANTHROPIC_CUSTOM_MODEL_OPTION_NAME="Abliterated Large V2"

claude --model 'abliterated-model-large-v2[1m]'
```

You can also switch to it inside a session with `/model`.

## Step 3 — Persist your config

Exporting variables in every new terminal gets old. Pick one place to save them so Claude Code always picks them up.

| Location | Where | Use when |
| - | - | - |
| Claude Code settings | `~/.claude/settings.json` | You want the config scoped to Claude Code only. |
| Shell profile | `~/.zshrc` or `~/.bashrc` | You want the variables available to any Anthropic-compatible tool you run from the terminal. |

### Option A — `~/.claude/settings.json`

Claude Code reads an `env` block from its own settings file. Values here apply whenever you start `claude`.

```json theme={"system"}
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.abliteration.ai",
    "ANTHROPIC_AUTH_TOKEN": "ak_YOUR_API_KEY",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "abliterated-model-large-v2[1m]",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "abliterated-model-large-v2[1m]",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "abliterated-model-large-v2[1m]"
  }
}
```

### Option B — Shell profile

Append the same values to your shell profile so they export on every terminal launch.

```sh theme={"system"}
# Append to ~/.zshrc, ~/.bashrc, or ~/.profile
export ANTHROPIC_BASE_URL="https://api.abliteration.ai"
export ANTHROPIC_AUTH_TOKEN="ak_YOUR_API_KEY"
export ANTHROPIC_DEFAULT_OPUS_MODEL="abliterated-model-large-v2[1m]"
export ANTHROPIC_DEFAULT_SONNET_MODEL="abliterated-model-large-v2[1m]"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="abliterated-model-large-v2[1m]"

# Reload
source ~/.zshrc   # or source ~/.bashrc
```

## Context windows and compaction

Claude Code automatically compacts long sessions by summarizing earlier turns while keeping recent context. abliteration.ai does not expose a separate compaction endpoint; Claude Code sends the summarization request through the same `ANTHROPIC_BASE_URL` and model configuration.

For Large V2 and the previous large model, use the `[1m]` model values shown above. If you configure one model with its canonical ID instead, set its native context window explicitly. For example, this single-model configuration also enables the full Large V2 window:

```json theme={"system"}
{
  "env": {
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "abliterated-model-large-v2",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "abliterated-model-large-v2",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "abliterated-model-large-v2",
    "CLAUDE_CODE_MAX_CONTEXT_TOKENS": "1000000"
  }
}
```

<Note>
  `CLAUDE_CODE_MAX_CONTEXT_TOKENS` applies to the entire Claude Code process. Set it to `262144` when a configuration uses only `abliterated-model`. Prefer the model-specific `[1m]` suffix for the large models when you switch between models with different context windows.
</Note>

`CLAUDE_CODE_AUTO_COMPACT_WINDOW` sets an optional, smaller compaction threshold. It does not declare a model's native context length. Omit it unless you intentionally want Claude Code to compact before the native limit.

## Headless mode

For CI/CD or scripts:

```sh theme={"system"}
claude --model 'abliterated-model-large-v2[1m]' -p "summarize README.md"
```

## Notes

* Published policies scoped to the key's project apply to every Claude Code turn. See [Policies](/policy-gateway/overview).
* Large V2 and the previous large model are text-only. Use `abliterated-model` when a task includes images. See [Models](/models).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.