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 role | Environment variable | SCX.ai model |
|---|---|---|
| Main session | ANTHROPIC_MODEL | coder |
| Opus (planning, hard problems) | ANTHROPIC_DEFAULT_OPUS_MODEL | coder |
| Sonnet (default work) | ANTHROPIC_DEFAULT_SONNET_MODEL | coder |
| Haiku (background tasks) | ANTHROPIC_DEFAULT_HAIKU_MODEL | MiniMax-M2.7 |
| Sub-agents | CLAUDE_CODE_SUBAGENT_MODEL | MiniMax-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
Already signed in to Claude Code with a Claude Pro, Max, Team, or Enterprise plan? Skip these steps and follow Already have a Claude subscription? instead. Step 3 changes your global settings, which would send every Claude Code session to SCX.ai.
Install Claude Code
curl -fsSL https://claude.ai/install.sh | bash
curl -fsSL https://claude.ai/install.sh | bash
Check that it installed:
claude --version
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):
{
"hasCompletedOnboarding": true
}
{
"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:
{
"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"
}
}
{
"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:
claude
claude
Run /status in the session. It should show your SCX.ai base URL and the coder model.
ANTHROPIC_BASE_URL is the host without /v1 (https://api.scx.ai). Claude Code adds /v1/messages itself. If you paste the full https://api.scx.ai/v1, requests go to /v1/v1/messages and fail with a 404.
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):
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 "$@"
}
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:
/statusshowsANTHROPIC_AUTH_TOKENas the auth source. If it shows your Claude account instead, the key didn't reach Claude Code. Check that you launchedclaude-scx, notclaude.- 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_KEYis 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 ofapi.anthropic.com.ANTHROPIC_AUTH_TOKEN: your SCX.ai API key. Claude Code sends it asAuthorization: Bearer …, which SCX.ai accepts.ANTHROPIC_API_KEYworks too (it goes out asx-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 theopus,sonnet, andhaikualiases in/modelresolve 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 withclaude 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:
export SCX_API_KEY=your-scx-api-key
export SCX_API_KEY=your-scx-api-key
{
"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"
}
}
{
"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:
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
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:
| File | Scope | Commit it? |
|---|---|---|
~/.claude/settings.json | Every project on your machine | No |
.claude/settings.json | This repository, for the whole team | Yes |
.claude/settings.local.json | This repository, only you | No (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
/modelopens the model picker. Theopus,sonnet, andhaikuentries resolve to the SCX.ai models you mapped./model MiniMax-M2.7switches the current session to any model ID on your account.claude --model codersets the model for one launch.
Permission modes
Claude Code asks before it edits files or runs commands. You can change how often it asks:
| Mode | Behavior |
|---|---|
default | Asks before each edit and command |
acceptEdits | Applies file edits without asking; still asks before commands |
plan | Read-only. Claude Code researches and proposes a plan without changing anything |
bypassPermissions | Never asks. Only use this in a sandbox or container |
claude --permission-mode plan
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:
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'
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
/statusfirst 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.7keepscoderfree for the main work. - Run
/compacton 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.mdstill 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_URLincludes/v1. Usehttps://api.scx.ai, nothttps://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?.
- Wrong format. Every SCX.ai key starts with
-
Claude Code still asks you to sign in.
~/.claude.jsonis 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
/logoutonly 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
claudefrom a fresh shell.