Skip to content
Open CastalyConsole

Coding agents

Claude Code setup

Connect Claude Code through Anthropic Messages with an explicit model alias for background tasks.

This guide connects Claude Code to Modelflare and sends the first successful request. Use Option A for automated setup. Use Option B to install Claude Code first, then create the user settings yourself.

Create a Modelflare API key whose non-default group can access claude-opus-4-8 and claude-sonnet-5. Keep the complete key ready; the installer asks for it once.

Not comfortable with the terminal yet? Start with the interactive first-run guide. It is only a visual rehearsal and does not change your computer.

Run this command as your normal user:

Terminal windowbash
curl -fsSL https://modelflare.dev/install/claude.sh | sh

When you are already logged in as root on a VPS or container, use:

Terminal windowbash
curl -fsSL https://modelflare.dev/install/claude.sh | MODELFLARE_ALLOW_ROOT=1 sh

Do not add sudo on a personal computer.

The installer asks you to choose Simplified Chinese, Japanese, or English, installs the official Claude Code CLI when needed, asks for the Modelflare API key once, backs up and merges the existing user settings, and verifies both configured models. It does not start Claude Code automatically.

Follow each step in order and run only the command for your operating system.

Terminal windowPowerShell
irm https://claude.ai/install.ps1 | iex
claude --version

Step 2: create and enter the user settings directory

Section titled “Step 2: create and enter the user settings directory”
Terminal windowPowerShell
New-Item -ItemType Directory -Force "$HOME\.claude" | Out-Null
Set-Location "$HOME\.claude"

Before running the command for your system, replace YOUR_MODELFLARE_API_KEY with your complete Modelflare API key.

Terminal windowPowerShell
$settings = @'
{
"env": {
"ANTHROPIC_BASE_URL": "https://modelflare.dev",
"ANTHROPIC_AUTH_TOKEN": "YOUR_MODELFLARE_API_KEY",
"ANTHROPIC_MODEL": "claude-opus-4-8",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "claude-opus-4-8",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "claude-sonnet-5",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-sonnet-5"
}
}
'@
$utf8NoBom = New-Object System.Text.UTF8Encoding -ArgumentList $false
[System.IO.File]::WriteAllText(
(Join-Path (Get-Location) "settings.json"),
$settings,
$utf8NoBom
)
Terminal windowPowerShell
Set-Location $HOME
New-Item -ItemType Directory -Force "my-claude-project" | Out-Null
Set-Location "my-claude-project"
claude

After Option A finishes, enter a project directory you trust and start Claude Code yourself:

Terminal windowbash
claude

With either method, send:

Text
Reply with one sentence confirming the active model.

A normal reply means setup is complete.