Docs menu

Claude Code

Wire: Anthropic. Base URL: https://sator-api.princep.orgno /v1, Claude Code appends /v1/messages itself. State: verified by running Claude Code against Sator.

Install#

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

or the native installer from Anthropic's docs. Any current version works.

Configure#

The one thing that is not optional: name a model. Claude Code's /model picker only lists ids containing claude or anthropic, which no Sator id does, so with only a base URL and a key it sends claude-opus-5 and gets a 404. Set the model with env vars (or --model on each run).

Add an env block to ~/.claude/settings.json:

json
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://sator-api.princep.org",
    "ANTHROPIC_AUTH_TOKEN": "sk-sator-v1-...",
    "ANTHROPIC_MODEL": "deepseek-v4-flash",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "deepseek-v4-flash",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "deepseek-v4-flash",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "deepseek-v4-flash",
    "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
  }
}

Or export the same names in your shell profile. What each one does:

VariableWhat it does
ANTHROPIC_BASE_URLWhere requests go. The bare host.
ANTHROPIC_AUTH_TOKENYour key, sent as Authorization: Bearer. Takes effect immediately.
ANTHROPIC_API_KEYAlternative: the same key sent as x-api-key. Also works, but Claude Code asks you once, interactively, to approve it. Prefer ANTHROPIC_AUTH_TOKEN.
ANTHROPIC_MODELThe model claude starts with and --model defaults to. Any id from Models.
ANTHROPIC_DEFAULT_OPUS_MODEL, ANTHROPIC_DEFAULT_SONNET_MODELWhat the opus and sonnet aliases resolve to, so /model opus picks a Sator model instead of a Claude one.
ANTHROPIC_DEFAULT_HAIKU_MODELThe "small, fast" slot: session titles and summaries. Set it to the cheapest model you are happy with.
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFICOptional. Per Claude Code's docs, skips its non-essential startup traffic, none of which Sator needs.

Not needed: CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY (the discovered ids are filtered out of the picker anyway) and ANTHROPIC_DEFAULT_*_MODEL_SUPPORTED_CAPABILITIES (no effect behind ANTHROPIC_BASE_URL). ANTHROPIC_SMALL_FAST_MODEL is the deprecated name for the HAIKU slot.

Verify#

bash
claude -p "Reply with exactly: ok"

prints ok. Two lines on stderr are harmless: [claude-code:unrecognized_model] {"model":"deepseek-v4-flash",…} is Claude Code noting an id that is not in its built-in list, and a warning that an unknown model is assumed to have a 200k context window. To use the model's real window, set CLAUDE_CODE_MAX_CONTEXT_TOKENS to the context size listed on Models. The request appears in your dashboard within a minute.

Streaming, tool use, structured output and prompt-cache reads all work; usage on each response reports the cache reads.

Token counting#

Claude Code counts context — for /context, tool-definition sizing and large tool outputs — through POST /v1/messages/count_tokens, which Sator serves. The count is a free estimate: never billed, never sent to a model, and not counted against your request limit. Claude Code therefore never needs its fallback of counting through a max_tokens: 1 inference request. See Messages for how the estimate is made.

Cost display#

Claude Code's /cost and total_cost_usd are computed from its own built-in price table, which does not know Sator's models or rates. Ignore them; the dashboard shows what you were actually charged.

Troubleshooting#

  • There's an issue with the selected model (claude-opus-5…) / 404 — no model set. Add ANTHROPIC_MODEL (or the three ANTHROPIC_DEFAULT_*_MODEL vars), or run claude --model deepseek-v4-flash.
  • Still talking to AnthropicANTHROPIC_BASE_URL is not reaching Claude Code. Export the variables in the profile of the shell you launch from, or use the settings.json env block, which applies to every launch; a project .env file is not read by every install method.
  • Incorrect API key provided — the token expanded to empty. In a shell profile, export ANTHROPIC_AUTH_TOKEN="$SATOR_API_KEY" must come after the line that sets SATOR_API_KEY; put the literal key in settings.json to avoid the ordering problem.
  • The model is not in /model — expected: Sator ids never appear in the picker. Select with --model <id> or the env vars above.
  • Prompted to approve an API key — you used ANTHROPIC_API_KEY. Approve once, or switch to ANTHROPIC_AUTH_TOKEN.