WRAITHERIX
Home / Blog
Guide · tested 2026-11-24

Claude Code with a custom API endpoint: setup, settings.json and three errors we tested

WRAITHERIX team
A laptop with an open terminal, glowing circuit traces running from it to several nodes

Claude Code reads the address it sends requests to from an environment variable. Set that variable to WRAITHERIX, give it a WRAITHERIX key, and everything else in your workflow stays the same. You top up a balance by card or crypto and pay per request.

On November 24, 2026 we installed Claude Code on macOS 27.2 in a separate folder, connected a key, had it fix a bug in a file, and tested three setup mistakes on purpose. The commands and replies below come from the log of that run. Long replies are trimmed.

Diagram: Claude Code sends requests to api.wraitherix.com, which passes them to the model you chose
Claude Code talks to our endpoint, and the model is picked by name in your settings.

What you need

Install

npm install -g @anthropic-ai/claude-code
claude --version

The install took 6 seconds and claude --version printed 2.1.331 (Claude Code).

Point it at the endpoint

Three variables are enough for the current terminal window:

export ANTHROPIC_BASE_URL="https://api.wraitherix.com"
export ANTHROPIC_AUTH_TOKEN="sk-your-key"
export ANTHROPIC_MODEL="claude-sonnet-5-5"

A first check without the interactive mode. Here the question goes in through a pipe:

$ echo "What is 17*23? Reply with the number only." | claude -p
391

With --output-format json Claude Code also reports which model answered, and it said claude-sonnet-5-5.

Pick the model ID from the catalog; we tried claude-sonnet-5-5 and claude-opus-5-5. To use a different one for a single run, pass --model. That is how we asked claude-opus-5-5 for 19×21. It answered 399, and the report named that model.

Keep the settings between sessions

Claude Code reads ~/.claude/settings.json. Put an env block there and the key is picked up in every terminal:

{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.wraitherix.com",
    "ANTHROPIC_AUTH_TOKEN": "sk-your-key",
    "ANTHROPIC_MODEL": "claude-sonnet-5-5",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-haiku-4-5"
  }
}

We ran Claude Code with this file and with the variables removed from the shell. It answered the 17×23 question, asked in Russian this time, with 391 in 2 seconds.

A real task

We made a file where addition actually subtracts:

def add(a, b):
    return a - b

Then we asked Claude Code to fix it and allowed it only to read and edit files:

$ claude -p "add in calc.py is broken. Fix it and show the final file." --allowedTools Edit,Read
Fixed! The `add` function was returning `a - b` instead of `a + b`.

It took 16 seconds. Afterwards the file on disk really contained return a + b.

Three errors we tested

An old ANTHROPIC_API_KEY. If you once put it in .zshrc or .bashrc, Claude Code uses it instead of the new key and fails like this:

Failed to authenticate. API Error: 401 Invalid token

Run echo $ANTHROPIC_API_KEY. If it prints anything, delete that line from your shell profile and open a new terminal.

An extra /v1 in the address. It is easy to add out of habit if other tools you use want it. Claude Code then complains about the model, not the address, which is misleading:

There's an issue with the selected model (claude-sonnet-5-5). It may not exist or you may not have access to it.

The model is fine. Remove /v1: the address must be exactly https://api.wraitherix.com.

A trailing space in the key. We expected it to break authentication, but the key with a space worked. So if you get a 401, look at the first two points.

What it costs

You pay for the tokens of the model you pick. Input and output prices per million tokens are on each model page in the catalog, and the usage log in your dashboard shows what every request cost. For scale, our 17×23 question cost about 2.5 cents on claude-sonnet-5-5 and twice that on claude-opus-5-5.

Windows steps with PowerShell commands are in the docs.

How we tested

November 24, 2026, macOS 27.2.1, Node.js 24.16.0, npm 11.13.0, Claude Code 2.1.331. We installed the package into a separate npm folder and kept the Claude Code settings in a separate directory, so the existing setup on this machine could not affect the result. Models: claude-sonnet-5-5 and claude-opus-5-5. Commands and replies are taken from the run log, with long replies trimmed.

One key for 400+ models

Pay as you go, below list price.

Get a keyCatalog