Claude Code
Claude Code works with any endpoint that speaks the Anthropic Messages API. Set three things: the base URL (https://api.abliteratedllm.dev), your API key, and which of our models each Claude Code alias should use.
Placeholders:
$API_BASEishttps://api.abliteratedllm.dev/v1,$API_ORIGINishttps://api.abliteratedllm.dev, and$YOUR_KEYis your API key.
Set the variables in your shell
Bash or Zsh:
export ANTHROPIC_BASE_URL="$API_ORIGIN"
export ANTHROPIC_AUTH_TOKEN="$YOUR_KEY"
export ANTHROPIC_DEFAULT_OPUS_MODEL="glm-5.3-flash-abliterated"
export ANTHROPIC_DEFAULT_SONNET_MODEL="glm-5.3-flash-abliterated"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="glm-5.3-flash-abliterated"
claude
PowerShell:
$env:ANTHROPIC_BASE_URL = "$API_ORIGIN"
$env:ANTHROPIC_AUTH_TOKEN = "$YOUR_KEY"
$env:ANTHROPIC_DEFAULT_OPUS_MODEL = "glm-5.3-flash-abliterated"
$env:ANTHROPIC_DEFAULT_SONNET_MODEL = "glm-5.3-flash-abliterated"
$env:ANTHROPIC_DEFAULT_HAIKU_MODEL = "glm-5.3-flash-abliterated"
claude
Shell variables last for that terminal session only.
Or set them in a settings file
To apply them everywhere Claude Code runs, put them in the env block of ~/.claude/settings.json (on Windows, %USERPROFILE%\.claude\settings.json):
{
"env": {
"ANTHROPIC_BASE_URL": "$API_ORIGIN",
"ANTHROPIC_AUTH_TOKEN": "$YOUR_KEY",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "glm-5.3-flash-abliterated",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "glm-5.3-flash-abliterated",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "glm-5.3-flash-abliterated"
}
}
Don't put your key in a project's .claude/settings.json: that file is usually committed to the repository.
What each variable does
| Variable | Value |
|---|---|
ANTHROPIC_BASE_URL | Our origin, without /v1. Claude Code appends /v1/messages itself. |
ANTHROPIC_AUTH_TOKEN | Your API key, sent as Authorization: Bearer. ANTHROPIC_API_KEY works too; it is sent as x-api-key, and Claude Code asks you once to approve it. |
ANTHROPIC_DEFAULT_OPUS_MODEL | The model behind the opus alias. |
ANTHROPIC_DEFAULT_SONNET_MODEL | The model behind the sonnet alias. |
ANTHROPIC_DEFAULT_HAIKU_MODEL | The model behind the haiku alias. Claude Code also uses it for background tasks such as session titles. |
The example puts glm-5.3-flash-abliterated behind all three aliases. Any enabled model works behind any alias, so when GET /v1/models lists several, you can put a cheaper one behind haiku for the frequent background calls.
Check the connection
Before starting Claude Code, send one request with the same variables:
curl "$ANTHROPIC_BASE_URL/v1/messages" \
-H "Authorization: Bearer $ANTHROPIC_AUTH_TOKEN" \
-H "content-type: application/json" \
-d '{"model": "glm-5.3-flash-abliterated", "max_tokens": 16, "messages": [{"role": "user", "content": "Say hi"}]}'
Then start claude from the same shell and run /status. The Anthropic base URL line should show our origin, and the auth line should name ANTHROPIC_AUTH_TOKEN. A 401 means the key is wrong or revoked.
Good to know
- Text only. Pasted screenshots and images fail with 400
unsupported_content. - Trial accounts allow 1 concurrent request and 4096 output tokens. Claude Code sends requests in parallel (background tasks, subagents), so on a trial account expect 429
rate_limit_exceeded. Paid accounts allow 64 concurrent requests. See Rate limits and trial. - Thinking. Claude Code's thinking settings reach the model through the
thinkingparameter, described on POST /v1/messages. - Unrecognized fields. If requests fail with 400 errors that name
context_managementor other unknown fields, setCLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1. - Other traffic. Claude Code also sends version checks and telemetry directly to Anthropic.
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1turns that off (it also disables auto-updates). - Support. Anthropic doesn't support Claude Code with non-Claude models. Features that depend on Anthropic-only APIs, such as Remote Control and voice dictation, are unavailable while a gateway credential is set.
Verified against Claude Code docs on 2026-11-03: Connect Claude Code to an LLM gateway and Environment variables.