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 run claude. Same Claude Code binary, same workflow, routed through abliteration.
Setup is three short steps: set the auth variables, pick how Claude Code should surface abliterated-model, then persist your config so you don’t re-export it in every terminal.
Install
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 — Surface abliterated-model in Claude Code
Claude Code’s model picker is built around Claude model IDs. Two variable sets let it surface abliterated-model — pick whichever fits your workflow.
Replace the default Opus / Sonnet / Haiku models
Override the model ID Claude Code sends for each default tier so the existing picker just works. Plain claude launches into abliterated-model.
Add abliterated-model to the picker
Keep the default Claude tiers intact and add abliterated-model as an extra picker entry you switch to explicitly.
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.
Option B — Shell profile
Append the same values to your shell profile so they export on every terminal launch.
Context 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.
Set CLAUDE_CODE_AUTO_COMPACT_WINDOW from the model’s context length. abliterated-model has a 256K context window (context_length: 262144), so 240000 leaves room for Claude Code’s system prompt, tools, and the next response:
Use the context length of the model you select. For example, use a larger value only when your selected model actually advertises a larger context window.
Headless mode
For CI/CD or scripts:
Notes
- Policy rules attached to your API key apply to every Claude Code turn. See Policy Gateway.