Skip to content

Instantly share code, notes, and snippets.

@julianromli
Last active December 8, 2025 05:19
Show Gist options
  • Select an option

  • Save julianromli/a767ba9cd4aa61e6ea66ae7fc215a74e to your computer and use it in GitHub Desktop.

Select an option

Save julianromli/a767ba9cd4aa61e6ea66ae7fc215a74e to your computer and use it in GitHub Desktop.
# CLIProxy Installer for Droid CLI
# Run: irm https://raw.githubusercontent.com/YOUR_REPO/install-cliproxy.ps1 | iex
# Or: powershell -ExecutionPolicy Bypass -File install-cliproxy.ps1
$ErrorActionPreference = "Stop"
Write-Host "========================================" -ForegroundColor Cyan
Write-Host " CLIProxy Installer for Droid CLI" -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
Write-Host ""
# Check Go
Write-Host "[1/5] Checking Go installation..." -ForegroundColor Yellow
$goPath = $null
$possibleGoPaths = @(
"C:\Program Files\Go\bin\go.exe",
"D:\Program Files\Go\bin\go.exe",
"$env:LOCALAPPDATA\Programs\Go\bin\go.exe"
)
foreach ($path in $possibleGoPaths) {
if (Test-Path $path) {
$goPath = $path
break
}
}
# Also check PATH
if (-not $goPath) {
$goPath = Get-Command go -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Source
}
if (-not $goPath) {
Write-Host "[X] Go not found!" -ForegroundColor Red
Write-Host " Please install Go from: https://go.dev/dl/" -ForegroundColor Yellow
Write-Host " Then run this script again." -ForegroundColor Yellow
exit 1
}
Write-Host "[OK] Go found: $goPath" -ForegroundColor Green
# Create directories
Write-Host ""
Write-Host "[2/5] Creating directories..." -ForegroundColor Yellow
$binDir = "$env:USERPROFILE\bin"
$configDir = "$env:USERPROFILE\.cli-proxy-api"
$scriptsDir = "$configDir\scripts"
New-Item -ItemType Directory -Force -Path $binDir | Out-Null
New-Item -ItemType Directory -Force -Path $configDir | Out-Null
New-Item -ItemType Directory -Force -Path $scriptsDir | Out-Null
Write-Host "[OK] Directories created" -ForegroundColor Green
# Clone and build
Write-Host ""
Write-Host "[3/5] Cloning and building CLIProxyAPIPlus..." -ForegroundColor Yellow
$tempDir = "$env:TEMP\CLIProxyAPIPlus"
if (Test-Path $tempDir) {
Remove-Item -Recurse -Force $tempDir
}
git clone --depth 1 https://github.com/router-for-me/CLIProxyAPIPlus.git $tempDir
if ($LASTEXITCODE -ne 0) {
Write-Host "[X] Failed to clone repository!" -ForegroundColor Red
exit 1
}
Push-Location $tempDir
& $goPath build -o cliproxyapi-plus.exe ./cmd/server
if ($LASTEXITCODE -ne 0) {
Pop-Location
Write-Host "[X] Failed to build!" -ForegroundColor Red
exit 1
}
Pop-Location
Move-Item -Force "$tempDir\cliproxyapi-plus.exe" "$binDir\cliproxyapi-plus.exe"
Remove-Item -Recurse -Force $tempDir
Write-Host "[OK] Binary built: $binDir\cliproxyapi-plus.exe" -ForegroundColor Green
# Create config
Write-Host ""
Write-Host "[4/5] Creating config..." -ForegroundColor Yellow
$configContent = @"
port: 8317
auth-dir: "$($configDir -replace '\\','/')"
api-keys:
- "sk-dummy"
quota-exceeded:
switch-project: true
switch-preview-model: true
"@
$configContent | Out-File -FilePath "$configDir\config.yaml" -Encoding UTF8
Write-Host "[OK] Config created: $configDir\config.yaml" -ForegroundColor Green
# Create helper scripts
Write-Host ""
Write-Host "[5/5] Creating helper scripts..." -ForegroundColor Yellow
# Start script
@"
@echo off
title CLIProxy Server
echo Starting CLIProxy on http://localhost:8317
echo Press Ctrl+C to stop
"%USERPROFILE%\bin\cliproxyapi-plus.exe" --config "%USERPROFILE%\.cli-proxy-api\config.yaml"
pause
"@ | Out-File -FilePath "$scriptsDir\start.bat" -Encoding ASCII
# Login script
@"
@echo off
title CLIProxy Login
echo.
echo Select provider:
echo 1. Antigravity (Claude/Gemini)
echo 2. GitHub Copilot
echo 3. Gemini CLI
echo 4. Codex
echo 5. Claude
echo 6. Qwen
echo 7. iFlow
echo.
set /p c="Choice (1-7): "
if "%c%"=="1" "%USERPROFILE%\bin\cliproxyapi-plus.exe" --config "%USERPROFILE%\.cli-proxy-api\config.yaml" -antigravity-login
if "%c%"=="2" "%USERPROFILE%\bin\cliproxyapi-plus.exe" --config "%USERPROFILE%\.cli-proxy-api\config.yaml" -github-copilot-login
if "%c%"=="3" "%USERPROFILE%\bin\cliproxyapi-plus.exe" --config "%USERPROFILE%\.cli-proxy-api\config.yaml" -login
if "%c%"=="4" "%USERPROFILE%\bin\cliproxyapi-plus.exe" --config "%USERPROFILE%\.cli-proxy-api\config.yaml" -codex-login
if "%c%"=="5" "%USERPROFILE%\bin\cliproxyapi-plus.exe" --config "%USERPROFILE%\.cli-proxy-api\config.yaml" -claude-login
if "%c%"=="6" "%USERPROFILE%\bin\cliproxyapi-plus.exe" --config "%USERPROFILE%\.cli-proxy-api\config.yaml" -qwen-login
if "%c%"=="7" "%USERPROFILE%\bin\cliproxyapi-plus.exe" --config "%USERPROFILE%\.cli-proxy-api\config.yaml" -iflow-login
pause
"@ | Out-File -FilePath "$scriptsDir\login.bat" -Encoding ASCII
Write-Host "[OK] Helper scripts created in $scriptsDir" -ForegroundColor Green
# Create Droid config.json
Write-Host ""
Write-Host "[6/6] Creating Droid config.json..." -ForegroundColor Yellow
$droidConfigDir = "$env:USERPROFILE\.factory"
$droidConfigFile = "$droidConfigDir\config.json"
if (-not (Test-Path $droidConfigDir)) {
New-Item -ItemType Directory -Force -Path $droidConfigDir | Out-Null
}
$droidConfig = @'
{
"custom_models": [
{
"model_display_name": "Claude Opus 4.5 Thinking [Antigravity]",
"model": "gemini-claude-opus-4-5-thinking",
"base_url": "http://localhost:8317/v1",
"api_key": "sk-dummy",
"provider": "openai"
},
{
"model_display_name": "Claude Sonnet 4.5 Thinking [Antigravity]",
"model": "gemini-claude-sonnet-4-5-thinking",
"base_url": "http://localhost:8317/v1",
"api_key": "sk-dummy",
"provider": "openai"
},
{
"model_display_name": "Claude Sonnet 4.5 [Antigravity]",
"model": "gemini-claude-sonnet-4-5",
"base_url": "http://localhost:8317/v1",
"api_key": "sk-dummy",
"provider": "openai"
},
{
"model_display_name": "Gemini 3 Pro [Antigravity]",
"model": "gemini-3-pro-preview",
"base_url": "http://localhost:8317/v1",
"api_key": "sk-dummy",
"provider": "openai"
},
{
"model_display_name": "Claude Opus 4.5 [Copilot]",
"model": "claude-opus-4.5",
"base_url": "http://localhost:8317/v1",
"api_key": "sk-dummy",
"provider": "openai"
},
{
"model_display_name": "GPT-5 Mini [Copilot]",
"model": "gpt-5-mini",
"base_url": "http://localhost:8317/v1",
"api_key": "sk-dummy",
"provider": "openai"
},
{
"model_display_name": "Gemini 2.5 Pro [Gemini]",
"model": "gemini-2.5-pro",
"base_url": "http://localhost:8317/v1",
"api_key": "sk-dummy",
"provider": "openai"
},
{
"model_display_name": "GPT-5.1 Codex Max [Codex]",
"model": "gpt-5.1-codex-max",
"base_url": "http://localhost:8317/v1",
"api_key": "sk-dummy",
"provider": "openai"
},
{
"model_display_name": "Qwen3 Coder Plus [Qwen]",
"model": "qwen3-coder-plus",
"base_url": "http://localhost:8317/v1",
"api_key": "sk-dummy",
"provider": "openai"
},
{
"model_display_name": "GLM 4.6 [iFlow]",
"model": "glm-4.6",
"base_url": "http://localhost:8317/v1",
"api_key": "sk-dummy",
"provider": "openai"
}
]
}
'@
if (Test-Path $droidConfigFile) {
Write-Host "[!] config.json already exists, skipping (backup your file if needed)" -ForegroundColor Yellow
} else {
$droidConfig | Out-File -FilePath $droidConfigFile -Encoding UTF8
Write-Host "[OK] Droid config created: $droidConfigFile" -ForegroundColor Green
}
# Done
Write-Host ""
Write-Host "========================================" -ForegroundColor Green
Write-Host " Installation Complete!" -ForegroundColor Green
Write-Host "========================================" -ForegroundColor Green
Write-Host ""
Write-Host "Next steps:" -ForegroundColor Cyan
Write-Host " 1. Run: $scriptsDir\login.bat" -ForegroundColor White
Write-Host " 2. Select provider (e.g., 1 for Antigravity)" -ForegroundColor White
Write-Host " 3. Complete OAuth in browser" -ForegroundColor White
Write-Host " 4. Run: $scriptsDir\start.bat (keep it running)" -ForegroundColor White
Write-Host " 5. Open Droid CLI, select model with [Provider] tag" -ForegroundColor White
Write-Host ""
Write-Host "Scripts: $scriptsDir" -ForegroundColor Yellow
Write-Host "Droid config: $droidConfigFile" -ForegroundColor Yellow
Write-Host ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment