# Svarog installer for Windows 10/11. # irm https://svarog.ch/install.ps1 | iex $ErrorActionPreference = "Stop" function Say($m){ Write-Host "[svarog] $m" -ForegroundColor Magenta } $Home_ = $env:USERPROFILE $SVAROG = Join-Path $Home_ ".svarog" $RAW = "https://svarog.ch" # 1) python if (-not (Get-Command python -ErrorAction SilentlyContinue)) { Say "Python 3 is required. Install from https://python.org (check 'Add to PATH') and re-run." throw "python missing" } # 2) node + claude code if (-not (Get-Command claude -ErrorAction SilentlyContinue)) { if (Get-Command npm -ErrorAction SilentlyContinue) { Say "installing Claude Code CLI..."; npm install -g "@anthropic-ai/claude-code" } else { Say "Node.js/npm not found — install Node 18+ from https://nodejs.org then re-run." } } # 3) router venv Say "setting up router in $SVAROG" New-Item -ItemType Directory -Force -Path $SVAROG | Out-Null python -m venv "$SVAROG\venv" & "$SVAROG\venv\Scripts\pip.exe" install -q --upgrade pip & "$SVAROG\venv\Scripts\pip.exe" install -q fastapi uvicorn httpx g4f Invoke-WebRequest -Uri "$RAW/svarog_g4f_router.py" -OutFile "$SVAROG\svarog_g4f_router.py" # 4) svarog.cmd launcher on PATH $BIN = Join-Path $env:LOCALAPPDATA "svarog" New-Item -ItemType Directory -Force -Path $BIN | Out-Null @" @echo off set PORT=8117 curl -fsS --max-time 2 http://127.0.0.1:%PORT%/__health >nul 2>&1 if errorlevel 1 ( start "" /b "$SVAROG\venv\Scripts\python.exe" -m uvicorn svarog_g4f_router:app --host 127.0.0.1 --port %PORT% --app-dir "$SVAROG" timeout /t 6 >nul ) set ANTHROPIC_BASE_URL=http://127.0.0.1:%PORT% set ANTHROPIC_AUTH_TOKEN=svarog-local set ANTHROPIC_API_KEY=svarog-local set CLAUDE_CODE_ATTRIBUTION_HEADER=0 claude --dangerously-skip-permissions %* "@ | Set-Content -Encoding ASCII (Join-Path $BIN "svarog.cmd") # add to user PATH $userPath = [Environment]::GetEnvironmentVariable("Path","User") if ($userPath -notlike "*$BIN*") { [Environment]::SetEnvironmentVariable("Path", "$userPath;$BIN", "User") Say "added $BIN to your PATH (restart the terminal)" } Say "done. open a new terminal and run: svarog"