Claude Code
Install and permanently configure Claude Code for Model Gate
Claude Code through Model Gate
This guide showsthe recommended installation and persistent configuration using settings.json, rather than temporary environment variables.
ANTHROPIC_BASE_URLmust not include/v1. Usehttps://api.model-gate.com.
Required values
ANTHROPIC_BASE_URL=https://api.model-gate.com
ANTHROPIC_API_KEY=mg_live_...
1. Install Claude Code
Windows PowerShell
irm https://claude.ai/install.ps1 | iex
Close and reopen PowerShell, then verify:
claude --version
Linux / macOS
Install Claude Code using the official method for your system, then verify:
claude --version
2. Configure persistent settings.json
Linux / macOS
mkdir -p ~/.claude
cd ~/.claude
nano settings.json
Windows PowerShell
New-Item -ItemType Directory -Force "$HOME\.claude" | Out-Null
Set-Location "$HOME\.claude"
notepad settings.json
3. Example settings.json
{
"$schema": "https://json.schemastore.org/claude-code-settings.json",
"env": {
"ANTHROPIC_BASE_URL": "https://api.model-gate.com",
"ANTHROPIC_API_KEY": "mg_live_...",
"CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1",
"CLAUDE_CODE_EFFORT_LEVEL": "high",
"ANTHROPIC_MODEL": "gpt-5.4",
"ANTHROPIC_SMALL_FAST_MODEL": "claude-haiku-4.5",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "claude-opus-4.7",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "claude-sonnet-4.6",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-haiku-4.5",
"CLAUDE_CODE_AUTO_COMPACT_WINDOW": "180000",
"CLAUDE_CODE_MAX_OUTPUT_TOKENS": "64000",
"CLAUDE_CODE_FILE_READ_MAX_OUTPUT_TOKENS": "100000",
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1",
"DISABLE_TELEMETRY": "1",
"DISABLE_ERROR_REPORTING": "1",
"DISABLE_AUTOUPDATER": "1",
"DISABLE_BUG_COMMAND": "1",
"DISABLE_COST_WARNINGS": "1",
"DISABLE_NON_ESSENTIAL_MODEL_CALLS": "1",
"CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY": "1",
"BASH_DEFAULT_TIMEOUT_MS": "120000",
"BASH_MAX_TIMEOUT_MS": "600000",
"BASH_MAX_OUTPUT_LENGTH": "100000",
"MAX_THINKING_TOKENS": "31999"
},
"permissions": {
"allow": ["Read", "Write", "MultiEdit", "WebFetch(domain:*)", "Bash", "WebSearch"],
"deny": [],
"defaultMode": "bypassPermissions",
"additionalDirectories": []
},
"skipDangerousModePermissionPrompt": true,
"effortLevel": "max",
"model": "gpt-5.4"
}
4. Configuration explained
Connection to Model Gate
ANTHROPIC_BASE_URL and ANTHROPIC_API_KEY route all requests through Model Gate.
Default model
ANTHROPIC_MODEL and the top-level model select the primary model. Use any enabled model ID.
Fast model
ANTHROPIC_SMALL_FAST_MODEL selects a faster model for lightweight background tasks.
Override GUI model buttons
ANTHROPIC_DEFAULT_OPUS_MODEL, ANTHROPIC_DEFAULT_SONNET_MODEL, and ANTHROPIC_DEFAULT_HAIKU_MODEL replace the three standard model slots shown in the GUI and /model menu.
5. Launch
claude
6. Temporary launch without settings.json
Linux / macOS
export ANTHROPIC_BASE_URL="https://api.model-gate.com"
export ANTHROPIC_API_KEY="mg_live_..."
claude
Windows PowerShell
$env:ANTHROPIC_BASE_URL = "https://api.model-gate.com"
$env:ANTHROPIC_API_KEY = "mg_live_..."
claude
7. Windows 11: claude command not found
What to do
Close and reopen PowerShell, then run claude --version. If it is still unavailable, run where.exe claude and reinstall with the official script if necessary.
Important
The most common fix is simply restarting PowerShell so the updated PATH is loaded.
8. If Claude Code requests authorization
Complete the Anthropic sign-in once, close Claude Code, and launch it again with the Model Gate configuration. Create your API key in the API Keys section and copy it immediately.