Skip to content

Claude CLI

Claude Code (Claude CLI) speaks the Anthropic Messages API. Point it at LootVM’s Messages-compatible host and authenticate with a LootVM-issued key.

Variable Value
ANTHROPIC_BASE_URL https://api.lootvm.com (without /v1)
ANTHROPIC_AUTH_TOKEN LootVM API key (sent as Authorization: Bearer)
Model Id from GET /v1/models that your key can use

Claude Code posts to {ANTHROPIC_BASE_URL}/v1/messages. If you set the base URL to https://api.lootvm.com/v1, the path doubles and requests fail.

Prefer ANTHROPIC_AUTH_TOKEN for Bearer auth. LootVM also accepts x-api-key on /v1/messages; if your environment expects that header instead, set ANTHROPIC_API_KEY to the same LootVM key and unset the unused variable.

Terminal window
export ANTHROPIC_BASE_URL='https://api.lootvm.com'
export ANTHROPIC_AUTH_TOKEN='your-lootvm-api-key'
claude

In ~/.claude/settings.json (or managed settings your org provides):

{
"env": {
"ANTHROPIC_BASE_URL": "https://api.lootvm.com",
"ANTHROPIC_AUTH_TOKEN": "your-lootvm-api-key"
}
}

Do not commit secrets. Prefer injecting the token from a secret manager into the environment.

Terminal window
curl --fail-with-body -X POST "$ANTHROPIC_BASE_URL/v1/messages" \
-H "Authorization: Bearer ${ANTHROPIC_AUTH_TOKEN}" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "your-enabled-model",
"max_tokens": 64,
"messages": [{"role": "user", "content": "ping"}]
}'

A 401 means try the other credential variable (ANTHROPIC_API_KEY ↔ ANTHROPIC_AUTH_TOKEN). A successful Messages body means the gateway path works; then start the CLI.

Symptom Check
401 Wrong variable for the header the gateway expects; wrong or revoked LootVM key
404 / empty HTML ANTHROPIC_BASE_URL included /v1 or pointed at the wrong host
CLI asks to log in Credential not visible before first-run; export in the shell or user settings.json env block
Model rejected Model not enabled for the key; list with /v1/models
Features that call api.anthropic.com directly fail Expected behind a custom base URL (for example some status checks); inference through LootVM can still work

See Messages (Claude) and Authentication.