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.
1. Create an API key
Section titled “1. Create an API key”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.
2. Choose a setup method
Section titled “2. Choose a setup method”Option A: run the installer
Section titled “Option A: run the installer”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:
curl -fsSL https://modelflare.dev/install/claude.sh | shWhen you are already logged in as root on a VPS or container, use:
curl -fsSL https://modelflare.dev/install/claude.sh | MODELFLARE_ALLOW_ROOT=1 shDo not add sudo on a personal computer.
Open PowerShell as your normal Windows user and run:
irm https://modelflare.dev/install/claude.ps1 | iexThe 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.
Option B: configure Claude Code manually
Section titled “Option B: configure Claude Code manually”Follow each step in order and run only the command for your operating system.
Step 1: install Claude Code
Section titled “Step 1: install Claude Code”irm https://claude.ai/install.ps1 | iexclaude --versioncurl -fsSL https://claude.ai/install.sh | bashclaude --versioncurl -fsSL https://claude.ai/install.sh | bashclaude --versionStep 2: create and enter the user settings directory
Section titled “Step 2: create and enter the user settings directory”New-Item -ItemType Directory -Force "$HOME\.claude" | Out-NullSet-Location "$HOME\.claude"mkdir -p ~/.claudecd ~/.claudemkdir -p ~/.claudecd ~/.claudeStep 3: create settings.json
Section titled “Step 3: create settings.json”Before running the command for your system, replace YOUR_MODELFLARE_API_KEY with your complete Modelflare API key.
$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)cat > settings.json << 'EOF'{ "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" }}EOFchmod 600 settings.jsoncat > settings.json << 'EOF'{ "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" }}EOFchmod 600 settings.jsonStep 4: start Claude Code
Section titled “Step 4: start Claude Code”Set-Location $HOMENew-Item -ItemType Directory -Force "my-claude-project" | Out-NullSet-Location "my-claude-project"claudecd ~mkdir -p my-claude-projectcd my-claude-projectclaudecd ~mkdir -p my-claude-projectcd my-claude-projectclaude3. Send the first request
Section titled “3. Send the first request”After Option A finishes, enter a project directory you trust and start Claude Code yourself:
claudeWith either method, send:
Reply with one sentence confirming the active model.A normal reply means setup is complete.