# Manual configuration for Claude Code

> Route Claude Code through ScaleMax's native Anthropic Messages endpoint without an installer.

> **This page is for Claude Code, not Codex.** Claude Code uses Anthropic Messages. For Codex's OpenAI Responses provider, use [Manual configuration for Codex](https://docs.scalemax.pro/docs/manual-configuration/codex).

This is the direct, no-`npx` setup for an existing Claude Code installation. Do not configure it as an OpenAI-compatible provider, and do not add `/v1` to `ANTHROPIC_BASE_URL`.

**Choose the URL that matches the key.** The two key types are intentionally not interchangeable.

| Your ScaleMax key | `ANTHROPIC_BASE_URL` |
| --- | --- |
| API-credit key | `https://api.scalemax.pro` |
| Claude token-pack key | `https://api.scalemax.pro/token` |

## Connection settings

- **Protocol:** Anthropic Messages
- **API-credit base URL:** `https://api.scalemax.pro`
- **Claude token API base URL:** `https://api.scalemax.pro/token`
- **Authentication:** `ANTHROPIC_AUTH_TOKEN`, which Claude Code sends as `Authorization: Bearer`. Not `ANTHROPIC_API_KEY`.
- **Default model:** `ANTHROPIC_MODEL`. Without it Claude Code asks for its own default model ID, which may not be on your key.
- **User settings:** `~/.claude/settings.json` (Windows: `%USERPROFILE%\.claude\settings.json`)

## Configure Claude Code

Set four environment variables, then start `claude` in the same terminal. Replace `YOUR_SCALEMAX_KEY` with your key.

**macOS / Linux**

```bash
export ANTHROPIC_BASE_URL="https://api.scalemax.pro"
export ANTHROPIC_AUTH_TOKEN="YOUR_SCALEMAX_KEY"
export ANTHROPIC_MODEL="claude-opus-5"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="claude-haiku-4-5-20251001"
claude
```

**Windows PowerShell**

```powershell
$env:ANTHROPIC_BASE_URL = "https://api.scalemax.pro"
$env:ANTHROPIC_AUTH_TOKEN = "YOUR_SCALEMAX_KEY"
$env:ANTHROPIC_MODEL = "claude-opus-5"
$env:ANTHROPIC_DEFAULT_HAIKU_MODEL = "claude-haiku-4-5-20251001"
claude
```

If the key came from a Claude token pack, change only `ANTHROPIC_BASE_URL` to `https://api.scalemax.pro/token`. Do not use the token URL with an API-credit key.

### Keep it for every new terminal

**macOS / Linux**

```bash
# macOS (zsh). On Linux with bash, use ~/.bashrc instead of ~/.zshrc.
cat >> ~/.zshrc <<'EOF'
export ANTHROPIC_BASE_URL="https://api.scalemax.pro"
export ANTHROPIC_AUTH_TOKEN="YOUR_SCALEMAX_KEY"
export ANTHROPIC_MODEL="claude-opus-5"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="claude-haiku-4-5-20251001"
EOF
# Open a new terminal, then run: claude
```

**Windows PowerShell**

```powershell
setx ANTHROPIC_BASE_URL "https://api.scalemax.pro"
setx ANTHROPIC_AUTH_TOKEN "YOUR_SCALEMAX_KEY"
setx ANTHROPIC_MODEL "claude-opus-5"
setx ANTHROPIC_DEFAULT_HAIKU_MODEL "claude-haiku-4-5-20251001"
# setx does not change this window. Open a new terminal, then run: claude
```

`setx` saves each value for terminals you open later, not the one you are in. Open a new terminal before you run `claude`.

Or put the same values in the `env` object of `~/.claude/settings.json` (Windows: `%USERPROFILE%\.claude\settings.json`), merging with any settings you already have. This version also adds the optional model-picker entries described below:

```json
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.scalemax.pro",
    "ANTHROPIC_AUTH_TOKEN": "YOUR_SCALEMAX_KEY",
    "ANTHROPIC_MODEL": "claude-opus-5",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-haiku-4-5-20251001",
    "CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY": "1",
    "ANTHROPIC_CUSTOM_MODEL_OPTION": "fable-5",
    "ANTHROPIC_CUSTOM_MODEL_OPTION_NAME": "Fable 5",
    "ANTHROPIC_CUSTOM_MODEL_OPTION_DESCRIPTION": "Fable 5 via ScaleMax"
  }
}
```

`CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY` queries `$ANTHROPIC_BASE_URL/v1/models` at startup and adds its Claude entries to the `/model` picker. With the Claude token origin, that becomes `https://api.scalemax.pro/token/v1/models`; do not replace the origin setting with `/token/v1`. Claude Code intentionally filters discovered IDs to names beginning with `claude` or `anthropic`, so the three `ANTHROPIC_CUSTOM_MODEL_OPTION*` entries in the example explicitly add ScaleMax's public `fable-5` ID to the picker. Claude Code refreshes its discovery cache at startup and falls back to the previous cache if a refresh fails. Gateway discovery requires Claude Code 2.1.129 or later.

Older versions of this page and of the web quick start set `CLAUDE_CODE_DISABLE_THINKING`, which is not a real Claude Code environment variable. Leave it out. (The actual flag is `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING`, and it has no effect on the Claude Opus, Claude Sonnet, and Fable models this guide configures.)

The main model is Opus 5. `ANTHROPIC_DEFAULT_HAIKU_MODEL` sends lightweight background work to Haiku, reducing wait time without changing the model used for the main coding turn. The custom Fable entry is only useful when your key's catalog includes Fable 5; it sends `fable-5` to the ScaleMax gateway and does not expose a provider or backend name. Claude Code streams normal responses and uses prompt caching automatically.

## Available Claude models

- `fable-5` (also accepted as `claude-fable-5`)
- `claude-haiku-4-5-20251001`
- `claude-haiku-5-5`
- `claude-opus-4-6`
- `claude-opus-4-7`
- `claude-opus-4-8`
- `claude-opus-5`
- `claude-opus-5-5`
- `claude-sonnet-5`
- `claude-sonnet-5-5`

Claude ids ending in \[1m\] are the same model with the full 1M-token context — use either id.

Use an exact model ID. You can change the default `ANTHROPIC_MODEL` value or switch models from Claude Code with `/model fable-5` (or another ID from the authenticated picker). ScaleMax keeps Fable 5’s public identity and handles compatibility automatically.

## Verify with a one-token request

Run this in the terminal where you set the variables. It checks the URL, key, and cheapest Claude route before Claude Code loads its agent prompt.

**macOS / Linux**

```bash
curl -sS "$ANTHROPIC_BASE_URL/v1/messages" \
  -H "Authorization: Bearer $ANTHROPIC_AUTH_TOKEN" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{
    "model": "claude-haiku-4-5-20251001",
    "max_tokens": 1,
    "messages": [{"role": "user", "content": "K"}]
  }'
```

**Windows PowerShell**

```powershell
@'
{
  "model": "claude-haiku-4-5-20251001",
  "max_tokens": 1,
  "messages": [{"role": "user", "content": "K"}]
}
'@ | Set-Content -Path body.json

curl.exe -sS "$env:ANTHROPIC_BASE_URL/v1/messages" `
  -H "Authorization: Bearer $env:ANTHROPIC_AUTH_TOKEN" `
  -H "anthropic-version: 2023-06-01" `
  -H "content-type: application/json" `
  --data-binary "@body.json"
```

A successful response contains a message ID and a `content` array. Then run one minimal, non-persistent Claude Code turn:

**macOS / Linux**

```bash
claude -p "Output the single uppercase letter K as your final answer." \
  --model claude-haiku-4-5-20251001 \
  --max-turns 1 \
  --no-session-persistence \
  --output-format json
```

**Windows PowerShell**

```powershell
claude -p "Output the single uppercase letter K as your final answer." `
  --model claude-haiku-4-5-20251001 `
  --max-turns 1 `
  --no-session-persistence `
  --output-format json
```

For an interactive check, start `claude` and run `/status`. The Anthropic base URL must match the purchased key type—`https://api.scalemax.pro` for API credit or `https://api.scalemax.pro/token` for a Claude token pack.

## Keep the key out of settings files (what the installer does)

The ScaleMax CLI sets the same base URL and models, but stores the key in its own file and points Claude Code's `apiKeyHelper` at it, so the raw key is in neither the settings JSON nor your environment. To do the same by hand, first store the key without echoing it:

**macOS / Linux**

```bash
umask 077
mkdir -p "$HOME/.claude"
printf "ScaleMax API key: "
IFS= read -r -s SCALEMAX_API_KEY
printf "\n"
printf "%s\n" "$SCALEMAX_API_KEY" > "$HOME/.claude/scalemax.key"
unset SCALEMAX_API_KEY
chmod 600 "$HOME/.claude/scalemax.key"
```

**Windows PowerShell**

```powershell
New-Item -ItemType Directory -Force -Path "$HOME\.claude" | Out-Null
$secret = Read-Host "ScaleMax API key" -AsSecureString
[IO.File]::WriteAllText("$HOME\.claude\scalemax.key", [System.Net.NetworkCredential]::new("", $secret).Password + "`n")
Remove-Variable secret
```

Then use `apiKeyHelper` instead of `ANTHROPIC_AUTH_TOKEN` in `settings.json`. Remove `ANTHROPIC_AUTH_TOKEN` from your environment and settings so the two do not compete. On Windows, replace `YOU` with your user name (the helper needs the full path; `echo $HOME` in PowerShell shows it):

**macOS / Linux**

```json
{
  "apiKeyHelper": "cat ~/.claude/scalemax.key",
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.scalemax.pro",
    "ANTHROPIC_MODEL": "claude-opus-5",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-haiku-4-5-20251001",
    "CLAUDE_CODE_API_KEY_HELPER_TTL_MS": "900000"
  }
}
```

**Windows PowerShell**

```json
{
  "apiKeyHelper": "powershell -NoProfile -Command \"Get-Content -Raw -LiteralPath 'C:\\Users\\YOU\\.claude\\scalemax.key'\"",
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.scalemax.pro",
    "ANTHROPIC_MODEL": "claude-opus-5",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-haiku-4-5-20251001",
    "CLAUDE_CODE_API_KEY_HELPER_TTL_MS": "900000"
  }
}
```

Claude Code caches the helper result for 15 minutes and refreshes it after an authentication failure.

## Keep the key private

> Keep `scalemax.key` readable only by your user. Never commit it, paste it into support messages, or put a credential in a project-level `.claude/settings.json` that is tracked by Git.

## Automatic configuration

Install the reusable ScaleMax CLI once, then run it directly—no `npx` is required:

**macOS / Linux**

```bash
npm install -g scalemax@latest
scalemax
```

**Windows PowerShell**

```powershell
npm.cmd install -g scalemax@latest
scalemax.cmd
```

Windows PowerShell blocks npm’s .ps1 launchers by default (“running scripts is disabled on this system”), so these commands use the .cmd launcher: npx.cmd, npm.cmd, scalemax.cmd. In Command Prompt you can leave out .cmd.

Select **Claude Code**. The CLI detects whether the key uses API credit or a Claude token pack, backs up the existing user settings, keeps the credential file user-only, and verifies the Anthropic Messages route. Run `scalemax doctor` (Windows PowerShell: `scalemax.cmd doctor`) afterward for a repeatable health check.

## Enable GitHub skills

Model routing and tool installation are separate. To install Anthropic's official skills marketplace and add bounded public-GitHub read permissions to Claude Code, run:

**macOS / Linux**

```bash
scalemax claude-tools
```

**Windows PowerShell**

```powershell
scalemax.cmd claude-tools
```

The command verifies that `example-skills@anthropic-agent-skills` is enabled. It does not grant unrestricted downloads or a blanket shell permission. Claude Code still asks before any operation outside the narrow public-GitHub permissions.

## Claude Desktop is separate

The Claude desktop app does not read Claude Code's `settings.json` or its environment variables. Configure the app through its third-party inference settings instead. See [Claude Desktop](https://docs.scalemax.pro/docs/manual-configuration/claude-desktop).

For the upstream gateway behavior and version requirements, see [Claude Code's gateway guide](https://code.claude.com/docs/en/llm-gateway).
