Claude Code

Anthropic’s coding agent, in the terminal or in your IDE, on your MafiaLLM balance. Claude models or any other one.

Setup

Add an env block to ~/.claude/settings.json (create the file if needed). It applies to every project, in the terminal and in the IDE extensions:

~/.claude/settings.json:

{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.mafiallm.com/anthropic",
    "ANTHROPIC_AUTH_TOKEN": "sk-mf-…",
    "ANTHROPIC_MODEL": "claude-sonnet-5-5",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "claude-opus-5-5",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "claude-sonnet-5-5",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-haiku-5-5"
  }
}

shell:

export ANTHROPIC_BASE_URL="https://api.mafiallm.com/anthropic"
export ANTHROPIC_AUTH_TOKEN="$MAFIA_KEY"
export ANTHROPIC_MODEL="claude-sonnet-5-5"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="claude-haiku-5-5"
claude

Then start claude and run /status: it shows the Anthropic base URL and the auth token in use. If you were logged in with a claude.ai account, run /logout once so the key is used instead.

Warning: Never put the key in a project’s .claude/settings.json: it is committed with the code. Use ~/.claude/settings.json or .claude/settings.local.json (git-ignored).

The variables

Field Type Required Description
ANTHROPIC_BASE_URL url yes https://api.mafiallm.com/anthropic, without /v1.
ANTHROPIC_AUTH_TOKEN string yes Your key, sent as Authorization: Bearer. ANTHROPIC_API_KEY works too, but asks for approval once in interactive mode.
ANTHROPIC_MODEL string no The model to start with. /model switches during a session.
ANTHROPIC_DEFAULT_HAIKU_MODEL string no The small model for background work (titles, summaries). Set it: without it, that work runs on the main model and costs more.
ANTHROPIC_DEFAULT_SONNET_MODEL string no What /model sonnet picks. Same for ANTHROPIC_DEFAULT_OPUS_MODEL and /model opus.
CLAUDE_CODE_SUBAGENT_MODEL string no The model sub-agents use, when you want them cheaper than the main one.

Other models than Claude

Any model from the list works: Claude Code’s requests are translated for it, tools included. Give its ID as ANTHROPIC_MODEL, and tell Claude Code its context window, which it can’t know for a model it doesn’t recognize (it assumes 200,000 tokens):

export ANTHROPIC_MODEL="glm-5.3"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="deepseek-v4.1-flash"
export CLAUDE_CODE_MAX_CONTEXT_TOKENS=1000000   # the model's "context"

To add one to the /model menu without making it the default, set ANTHROPIC_CUSTOM_MODEL_OPTION to its ID.

VS Code and JetBrains

The JetBrains plugin runs the claude command, so the settings above apply as is. The VS Code extension reads them for the agent, but checks the login before starting it: add the same variables to VS Code’s own settings.json and skip the login prompt.

{
  "claudeCode.environmentVariables": [
    { "name": "ANTHROPIC_BASE_URL", "value": "https://api.mafiallm.com/anthropic" },
    { "name": "ANTHROPIC_AUTH_TOKEN", "value": "sk-mf-…" }
  ],
  "claudeCode.disableLoginPrompt": true
}

The Claude desktop app does not read these settings.

Checking the connection

curl https://api.mafiallm.com/anthropic/v1/messages \
  -H "Authorization: Bearer $MAFIA_KEY" \
  -H "content-type: application/json" \
  -d '{"model": "claude-haiku-5-5", "max_tokens": 16, "messages": [{"role": "user", "content": "Hi"}]}'