Skip to main content
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.
VariableValueWhat it does
ANTHROPIC_BASE_URLhttps://api.abliteration.aiRoutes Claude Code to abliteration.ai instead of api.anthropic.com.
ANTHROPIC_AUTH_TOKENak_YOUR_API_KEYRecommended. 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.
LocationWhereUse when
Claude Code settings~/.claude/settings.jsonYou want the config scoped to Claude Code only.
Shell profile~/.zshrc or ~/.bashrcYou 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.
Last modified on June 24, 2026