Coding agents

Claude Code

Run Claude Code on Kimi K3.1 Pro Abliterated or DeepSeek V4.1 Flash Abliterated through Abliterator's Anthropic-compatible API: env vars, settings.json and fixes.

Reviewed Claude CodeCoding agentsAnthropic

Quick answer

Set ANTHROPIC_BASE_URL to https://abliterator.ai, ANTHROPIC_AUTH_TOKEN to your Abliterator key, and pin ANTHROPIC_MODEL and the ANTHROPIC_DEFAULT_*_MODEL variables to Abliterator model IDs. Use deepseek-v4.1-flash-abliterated for the Haiku slot so background tasks stay cheap.

Before you start

Claude Code talks to the Anthropic Messages API, which Abliterator serves at https://abliterator.ai. You point Claude Code at Abliterator with environment variables and pin every model alias to an Abliterator model ID.

Know the limits of this setup:

  • Anthropic documents gateway support for Claude models only. Its LLM gateway page says Anthropic does not support routing Claude Code to non-Claude models. Abliterator works because it serves the same Messages format, but Anthropic support will not cover it.
  • Features that need a claude.ai login, such as Remote Control and voice dictation, are unavailable while a gateway credential is set.

You need an Abliterator key (get one) and Claude Code installed.

Configure with environment variables

export ANTHROPIC_BASE_URL="https://abliterator.ai"
export ANTHROPIC_AUTH_TOKEN="$ABL_API_KEY"
unset ANTHROPIC_API_KEY

export ANTHROPIC_MODEL="kimi-k3.1-pro-abliterated"
export ANTHROPIC_DEFAULT_OPUS_MODEL="kimi-k3.1-pro-abliterated"
export ANTHROPIC_DEFAULT_SONNET_MODEL="kimi-k3.1-pro-abliterated"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="deepseek-v4.1-flash-abliterated"
export CLAUDE_CODE_SUBAGENT_MODEL="kimi-k3.1-pro-abliterated"

claude

What each variable does, per Claude Code's model configuration docs:

Variable Value Why
ANTHROPIC_BASE_URL https://abliterator.ai Sends requests to Abliterator. No /v1: Claude Code appends /v1/messages
ANTHROPIC_AUTH_TOKEN Your Abliterator key Sent as Authorization: Bearer, which Abliterator accepts
ANTHROPIC_MODEL kimi-k3.1-pro-abliterated The model the session starts on
ANTHROPIC_DEFAULT_OPUS_MODEL, ANTHROPIC_DEFAULT_SONNET_MODEL kimi-k3.1-pro-abliterated What the opus and sonnet aliases resolve to, so /model and plan mode stay on Abliterator
ANTHROPIC_DEFAULT_HAIKU_MODEL deepseek-v4.1-flash-abliterated The haiku alias, which Claude Code also uses for background work
CLAUDE_CODE_SUBAGENT_MODEL kimi-k3.1-pro-abliterated Default model for subagents. Use deepseek-v4.1-flash-abliterated to make subagents cheaper

Unset ANTHROPIC_API_KEY. With both set, Claude Code shows an auth-conflict warning, and if a request reaches Abliterator with different keys in x-api-key and Authorization, Abliterator rejects it.

For a cheaper setup, set every model variable to deepseek-v4.1-flash-abliterated. Before you make kimi-k3.1-pro-abliterated your main coding model, test it on your own tasks: its Terminal-Bench 4.0 score fell from 68.8 to 56.3 after abliteration, a drop that is plausible but not statistically shown (benchmarks).

Configure with settings.json

Shell exports last for one terminal. To apply the setup everywhere Claude Code runs, including background agents, put the variables in the env block of ~/.claude/settings.json:

{
  "env": {
    "ANTHROPIC_BASE_URL": "https://abliterator.ai",
    "ANTHROPIC_AUTH_TOKEN": "sk-abl-v1-...",
    "ANTHROPIC_MODEL": "kimi-k3.1-pro-abliterated",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "kimi-k3.1-pro-abliterated",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "kimi-k3.1-pro-abliterated",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "deepseek-v4.1-flash-abliterated",
    "CLAUDE_CODE_SUBAGENT_MODEL": "kimi-k3.1-pro-abliterated",
    "ANTHROPIC_DEFAULT_OPUS_MODEL_NAME": "Kimi K3.1 Pro Abliterated",
    "ANTHROPIC_DEFAULT_SONNET_MODEL_NAME": "Kimi K3.1 Pro Abliterated",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL_NAME": "DeepSeek V4.1 Flash Abliterated"
  }
}

The _NAME variables only change the labels in the /model picker. Settings-file values win over shell exports.

Do not put your key in a project's .claude/settings.json: that file is committed with the repository. For one project only, use .claude/settings.local.json and make sure it is gitignored. See Claude Code's connect guide for the VS Code extension, which reads claudeCode.environmentVariables instead.

Verify

First check the key and base URL without Claude Code:

curl -sS https://abliterator.ai/v1/messages \
  -H "Authorization: Bearer $ABL_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{"model": "deepseek-v4.1-flash-abliterated", "max_tokens": 256, "messages": [{"role": "user", "content": "Reply with OK."}]}'

A JSON body with "type":"message" means the key and URL work. Then start claude, send a message and run /status. The Anthropic base URL line should show https://abliterator.ai, and the Auth token line should name ANTHROPIC_AUTH_TOKEN. Your requests appear in GET /api/v1/activity and on the account page.

Cost and caching

Claude Code resends the system prompt, tool definitions and conversation on every turn. Abliterator caches repeated prefixes automatically, so most of a long session's input bills at the cached price ($0.40 per 1M on kimi-k3.1-pro-abliterated, $0.10 on deepseek-v4.1-flash-abliterated). Since Claude Code v2.1.181 the attribution block at the start of the system prompt stays stable through a conversation, so it does not break caching. See prompt caching.

Both models have a 1,048,576-token context window. Recent Claude Code versions assume a 1M window for model IDs they do not recognize, which matches. Filling that window is expensive; to compact earlier, set CLAUDE_CODE_AUTO_COMPACT_WINDOW, for example to 200000.

Troubleshooting

Symptom Cause Fix
401 Invalid credentials: send one abliterator key as `Authorization: Bearer` or `x-api-key`. ANTHROPIC_API_KEY is also set, to a different key unset ANTHROPIC_API_KEY, or remove it from settings.json
401 Invalid or revoked API key. Wrong key, or a revoked one Check ANTHROPIC_AUTH_TOKEN; create a new key at /account
Claude Code asks you to log in although the curl test works The credential is in a project settings file that applies only after first-run setup Put ANTHROPIC_AUTH_TOKEN in a shell export or ~/.claude/settings.json
404 Model "claude-..." is not available on abliterator An alias is not pinned, so Claude Code sent a Claude model name Set all of ANTHROPIC_MODEL and ANTHROPIC_DEFAULT_OPUS/SONNET/HAIKU_MODEL
400 naming an unrecognized field or Extra inputs are not permitted Claude Code sent a pre-release field the model does not accept Set CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1
429 Too many requests in flight Subagents and background tasks run in parallel; the Free plan allows 2 at once Use fewer parallel subagents, or a plan with more concurrency
402 balance or credit errors mid-session Credit ran out Add credit or turn on auto-reload at /account
Abliterator models missing from /model Claude Code's gateway model discovery keeps only IDs containing claude or anthropic Pin the models with the variables above; the _NAME variables label them
/context token counts look approximate Abliterator does not serve /v1/messages/count_tokens Expected. Claude Code falls back to an estimate

If your network allows egress only to Abliterator, also set CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1 to stop update checks and telemetry calls that would otherwise fail. It also disables auto-updates.

Official references: Connect Claude Code to an LLM gateway, gateway compatibility guide, model configuration.

Frequently asked questions

Does Anthropic support using Claude Code with other models?

No. Claude Code's gateway documentation says Anthropic does not support routing Claude Code to non-Claude models through any gateway. It works through Abliterator's Messages API, but Anthropic will not help with issues in this setup.

Why use deepseek-v4.1-flash-abliterated for the Haiku slot?

Claude Code sends background requests, such as session titles, to the model behind the Haiku alias. Pinning it to deepseek-v4.1-flash-abliterated keeps those requests fast and cheap while kimi-k3.1-pro-abliterated does the main work.