Claude Code

Claude Code is Anthropic's agentic coding tool for the terminal, VS Code, and JetBrains. It speaks the Anthropic Messages API, and SCX.ai serves that same API at https://api.scx.ai/v1/messages. So you can point Claude Code at SCX.ai with a base URL and an API key, and every chat model on your account can drive it.

Claude Code picks models by role (Opus for hard reasoning, Sonnet for everyday work, Haiku for quick background tasks). You map each role to a SCX.ai model ID. After that, the whole session runs on your stack, sub-agents included.

What you'll connect

Claude Code roleEnvironment variableSCX.ai model
Main sessionANTHROPIC_MODELcoder
Opus (planning, hard problems)ANTHROPIC_DEFAULT_OPUS_MODELcoder
Sonnet (default work)ANTHROPIC_DEFAULT_SONNET_MODELcoder
Haiku (background tasks)ANTHROPIC_DEFAULT_HAIKU_MODELMiniMax-M2.7
Sub-agentsCLAUDE_CODE_SUBAGENT_MODELMiniMax-M2.7

You can use any chat model on your account in place of these IDs. Browse the catalogue. Pick models that support tool calling, because Claude Code depends on it.

Prerequisites

  • A SCX.ai API key. Create one in the dashboard under API Keys.
  • macOS, Linux, or Windows (native, or WSL).
  • Node.js 18 or later, only if you install with npm.

Quick connect

Install Claude Code

curl -fsSL https://claude.ai/install.sh | bash

Check that it installed:

bash
claude --version

Skip the Anthropic sign-in

On first launch, Claude Code asks you to sign in to an Anthropic account. You don't need one to use SCX.ai. Mark onboarding as done in ~/.claude.json (create the file if it doesn't exist):

~/.claude.json
{
  "hasCompletedOnboarding": true
}

If the file already exists, add the key to it and keep everything else.

Point Claude Code at SCX.ai

Create ~/.claude/settings.json, or add an env block to the one you already have:

~/.claude/settings.json
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.scx.ai",
    "ANTHROPIC_AUTH_TOKEN": "your-scx-api-key",
    "ANTHROPIC_MODEL": "coder",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "coder",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "coder",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "MiniMax-M2.7",
    "CLAUDE_CODE_SUBAGENT_MODEL": "MiniMax-M2.7",
    "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
  }
}

Start a session

Open a new terminal, change into a project, and run:

bash
claude

Run /status in the session. It should show your SCX.ai base URL and the coder model.

Already have a Claude subscription?

If you already use Claude Code with a Claude subscription, you probably want to keep claude on that subscription and run SCX.ai only when you choose to. In that case, don't put the SCX.ai settings in ~/.claude/settings.json. That file applies to every session, including your IDE extension. Set the variables for one launch instead, with a shell function.

You don't need to edit ~/.claude.json either. Signing in already set hasCompletedOnboarding.

Add this to ~/.zshrc (or ~/.bashrc):

~/.zshrc
export SCX_API_KEY='your-scx-api-key'

claude-scx() {
  : "${SCX_API_KEY:?set SCX_API_KEY first}"
  ANTHROPIC_BASE_URL=https://api.scx.ai \
  ANTHROPIC_AUTH_TOKEN="$SCX_API_KEY" \
  ANTHROPIC_MODEL=coder \
  ANTHROPIC_DEFAULT_OPUS_MODEL=coder \
  ANTHROPIC_DEFAULT_SONNET_MODEL=coder \
  ANTHROPIC_DEFAULT_HAIKU_MODEL=MiniMax-M2.7 \
  CLAUDE_CODE_SUBAGENT_MODEL=MiniMax-M2.7 \
  claude "$@"
}

Open a new terminal. claude still uses your subscription, and claude-scx runs on SCX.ai. It takes the same flags, for example claude-scx --permission-mode plan.

What to expect:

  • /status shows ANTHROPIC_AUTH_TOKEN as the auth source. If it shows your Claude account instead, the key didn't reach Claude Code. Check that you launched claude-scx, not claude.
  • You may see an "auth conflict" warning. It means you're signed in to Claude and also passing a SCX.ai key. The key wins for this session, so you can ignore the warning. Don't run /logout: it signs you out of your subscription for every session, not just this one.
  • Never launch with an empty key. If SCX_API_KEY is empty, Claude Code can ignore the empty token and fall back to your Claude login. It sends that token to SCX.ai, which rejects it with "Invalid API key". The :? line in the function stops the launch before that can happen.

What each setting does

  • ANTHROPIC_BASE_URL: where Claude Code sends requests. Set it to SCX.ai instead of api.anthropic.com.
  • ANTHROPIC_AUTH_TOKEN: your SCX.ai API key. Claude Code sends it as Authorization: Bearer …, which SCX.ai accepts. ANTHROPIC_API_KEY works too (it goes out as x-api-key), but Claude Code asks you to approve it on first use.
  • ANTHROPIC_MODEL: the model the main session starts on.
  • ANTHROPIC_DEFAULT_{OPUS,SONNET,HAIKU}_MODEL: what the opus, sonnet, and haiku aliases in /model resolve to, and which models Claude Code picks for each role internally.
  • CLAUDE_CODE_SUBAGENT_MODEL: the model for sub-agents that Claude Code spawns with its Task tool. A fast model keeps parallel work cheap.
  • CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC: stops telemetry, error reporting, and the auto-updater from calling Anthropic. With this set, model traffic only goes to SCX.ai. Update by hand with claude update.

Keep the key out of settings.json

settings.json stores values as plain text. If you'd rather not keep your key there, export it in your shell and have Claude Code read it at startup with an apiKeyHelper:

bash
export SCX_API_KEY=your-scx-api-key
~/.claude/settings.json
{
  "apiKeyHelper": "echo $SCX_API_KEY",
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.scx.ai",
    "ANTHROPIC_MODEL": "coder",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "coder",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "coder",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "MiniMax-M2.7",
    "CLAUDE_CODE_SUBAGENT_MODEL": "MiniMax-M2.7",
    "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
  }
}

You can also skip settings.json and export every variable in your shell profile (~/.zshrc, ~/.bashrc). Claude Code reads the same names from the environment:

bash
export ANTHROPIC_BASE_URL=https://api.scx.ai
export ANTHROPIC_AUTH_TOKEN=$SCX_API_KEY
export ANTHROPIC_MODEL=coder
export ANTHROPIC_DEFAULT_HAIKU_MODEL=MiniMax-M2.7

Per-project configuration

Claude Code merges settings from several places. The more specific file wins:

FileScopeCommit it?
~/.claude/settings.jsonEvery project on your machineNo
.claude/settings.jsonThis repository, for the whole teamYes
.claude/settings.local.jsonThis repository, only youNo (git-ignored)

A common setup: commit the base URL and model mapping in .claude/settings.json, and have each developer put their own key in .claude/settings.local.json or their shell. Everyone on the team then runs the same SCX.ai models without sharing a key.

Switching models

  • /model opens the model picker. The opus, sonnet, and haiku entries resolve to the SCX.ai models you mapped.
  • /model MiniMax-M2.7 switches the current session to any model ID on your account.
  • claude --model coder sets the model for one launch.

Permission modes

Claude Code asks before it edits files or runs commands. You can change how often it asks:

ModeBehavior
defaultAsks before each edit and command
acceptEditsApplies file edits without asking; still asks before commands
planRead-only. Claude Code researches and proposes a plan without changing anything
bypassPermissionsNever asks. Only use this in a sandbox or container
bash
claude --permission-mode plan

Press Shift+Tab in a session to cycle modes, or run /permissions to set allow/deny rules.

IDE extensions

The VS Code and JetBrains extensions run the same Claude Code and read the same ~/.claude/settings.json, so they connect to SCX.ai with no extra setup. Install Claude Code from the VS Code Marketplace or the JetBrains Marketplace, restart the IDE, and open the Claude Code panel.

Verify the connection

Before relying on Claude Code, check the key and endpoint directly against the Messages API:

bash
curl -sS "https://api.scx.ai/v1/messages" \
  -H "x-api-key: $SCX_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{"model":"coder","max_tokens":256,"messages":[{"role":"user","content":"Say hi."}]}' \
  | jq '.content[] | select(.type == "text") | .text'

If you get a normal reply, the same credentials Claude Code uses are reaching SCX.ai.

Tips

  • Run /status first whenever something looks off. It shows the base URL, auth source, and model Claude Code actually loaded.
  • Put a fast model on Haiku and sub-agents. Claude Code makes many small background calls (titles, summaries, file searches). Sending those to MiniMax-M2.7 keeps coder free for the main work.
  • Run /compact on long sessions. Claude Code budgets context for Claude's window, which may be larger than your model's. Compacting early helps you avoid context-length errors.
  • CLAUDE.md still works. Project memory, slash commands, hooks, and MCP servers all run on the client, so they work the same with any backend.

Common gotchas

  • 404 Not Found. ANTHROPIC_BASE_URL includes /v1. Use https://api.scx.ai, not https://api.scx.ai/v1.

  • 401 Invalid API key. SCX.ai received a key it doesn't recognize. Run the curl command in Verify the connection. If curl fails too, the problem is the key, not Claude Code:

    • Wrong format. Every SCX.ai key starts with sk-scx-. Check with [[ "$SCX_API_KEY" == sk-scx-* ]] && echo "prefix ok".
    • Wrong environment. A key only works against the environment that issued it. Create it in the dashboard for the API you're calling.
    • Revoked, or copied badly. Create a new key and export it in single quotes so no whitespace or quotes slip in.

    If curl works but Claude Code doesn't, Claude Code isn't sending the key. Usually the variable is empty in that terminal, so Claude Code fell back to your Claude login. See Already have a Claude subscription?.

  • Claude Code still asks you to sign in. ~/.claude.json is missing "hasCompletedOnboarding": true, or your settings live in a file Claude Code isn't reading. Open a new terminal after editing.

  • An "auth conflict" warning. You're signed in with a Claude account and also passing a SCX.ai key. If you want to keep your subscription, ignore the warning, because the key wins for that session. Run /logout only if you don't use a Claude subscription on this machine.

  • "Model not found" or "model does not support function calling". The model ID isn't on your account, or it can't call tools. Check the ID in the catalogue and pick a model with tool calling.

  • Changes don't take effect. Claude Code reads settings and environment variables when it starts. Exit and relaunch claude from a fresh shell.