Skip to main content
This guide covers all installation methods for switchAILocal, from quick local setup to production Docker deployments.

Prerequisites

Required

  • Go 1.24+ - Download
  • Git - For cloning the repository
  • Terminal/Shell - Command line access

Optional

  • Docker - For containerized deployment
  • Node.js 18+ - For building the Management UI
  • CLI Tools - gemini, claude, vibe for zero-config providers

Installation Methods

The unified operations hub script handles building, dependencies, and lifecycle management automatically.
1

Clone Repository

git clone https://github.com/traylinx/switchAILocal.git
cd switchAILocal
2

Check Dependencies

Verify Go and Docker are installed:
./ail.sh check
Expected output:
[INFO] Running pre-flight checks...
[OK]   Go detected: 1.24.0
[OK]   Docker detected.
[OK]   All systems go.
macOS users: Run ./ail.sh install to auto-install missing dependencies via Homebrew.
3

Start Server

Build and start in one command:
./ail.sh start
The script will:
  1. Create .ail state directory
  2. Build the switchAILocal binary
  3. Start the server in background
  4. Save PID to .ail/local.pid
  5. Write logs to server.log
./ail.sh start -f
# Builds, starts, and follows logs
4

Verify Installation

Check server status:
./ail.sh status
Test the API:
curl http://localhost:18080/v1/models \
  -H "Authorization: Bearer sk-test-123"

Hub Script Commands

start
command
Build and start the serverOptions:
  • -d, --docker - Use Docker runtime
  • -b, --build - Force rebuild (Docker only)
  • -f, --follow - Follow logs after starting
./ail.sh start -f
./ail.sh start --docker --build
stop
command
Stop the running server
./ail.sh stop
./ail.sh stop --docker
restart
command
Restart the server (stop + start)
./ail.sh restart
status
command
Show status of all instances (local, Docker, bridge)
./ail.sh status
logs
command
View server logsOptions:
  • -f, --follow - Follow log output
./ail.sh logs        # Last 50 lines
./ail.sh logs -f     # Follow logs
check
command
Verify dependencies (Go, Docker)
./ail.sh check
install
command
Auto-install dependencies (macOS only, requires Homebrew)
./ail.sh install
bridge
command
Manage the bridge agent (for advanced integrations)
./ail.sh bridge start
./ail.sh bridge stop
./ail.sh bridge status

Building the Management UI

The optional web dashboard provides a modern interface for configuration and monitoring.
1

Install Node.js

Requires Node.js 18+ and npm:
node --version  # Should be v18.0.0 or higher
npm --version
2

Build UI

Run the build script:
./ail_ui.sh
This script:
  1. Navigates to frontend/
  2. Installs dependencies (npm install)
  3. Builds React app (npm run build)
  4. Inlines all assets (CSS, JS, SVGs)
  5. Outputs single-file static/management.html (~226 KB)
3

Verify Build

ls -lh static/management.html
# Should show ~226 KB file
4

Access Dashboard

Start the server and visit:
http://localhost:18080/management
The Management UI requires a secret key. See Management Dashboard for setup.

Post-Installation Configuration

1
Copy Configuration Template
2
cp config.example.yaml config.yaml
3
Add Your Provider Credentials
4
Edit config.yaml and add API keys or enable local providers:
5
Cloud APIs
gemini-api-key:
  - api-key: "AIzaSy...YOUR_KEY_HERE"

claude-api-key:
  - api-key: "sk-ant-...YOUR_KEY_HERE"

codex-api-key:
  - api-key: "sk-...YOUR_KEY_HERE"
Local Models
ollama:
  enabled: true
  base-url: "http://localhost:11434"
  auto-discover: true

lmstudio:
  enabled: true
  base-url: "http://localhost:1234/v1"
  auto-discover: true
CLI Wrappers
# No configuration needed!
# Install CLI tools and switchAILocal detects them automatically:
# - npm install -g @google/gemini-cli
# - brew install anthropic/tap/claude
# - npm install -g @mistralai/vibe
6
Set Authentication Keys
7
Update the API keys that clients use to authenticate to your switchAILocal server:
8
api-keys:
  - "your-secure-key-here"
  - "another-key-for-team"
9
Replace the default sk-test-123 key before deploying to production.
10
Restart Server
11
Apply configuration changes:
12
./ail.sh restart

Verification Tests

curl http://localhost:18080/health
Expected response:
{"status": "ok"}

Troubleshooting

Error: go: directive requires go version >= 1.24Solution:
# Check current version
go version

# Update Go
# macOS
brew upgrade go

# Linux
wget https://go.dev/dl/go1.24.0.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.24.0.linux-amd64.tar.gz
Error: bind: address already in useSolution:
# Find process using port
lsof -i :18080

# Kill existing process
kill -9 <PID>

# OR change port in config.yaml
port: 18081
Error: error building imageSolution:
# Clean Docker cache
docker system prune -a

# Rebuild without cache
docker build --no-cache -t switchailocal .

# Check disk space
df -h
Error: config.yaml not foundSolution:
# Create from template
cp config.example.yaml config.yaml

# Verify file exists
ls -la config.yaml

# Check working directory
pwd  # Should be in switchAILocal root
Error: go: error loading module requirementsSolution:
# Clean module cache
go clean -modcache

# Tidy dependencies
go mod tidy

# Re-download
go mod download

# Verify go.sum
go mod verify

System Requirements

Minimum

  • CPU: 2 cores
  • RAM: 512 MB
  • Disk: 100 MB
  • OS: Linux, macOS, Windows

Recommended

  • CPU: 4+ cores
  • RAM: 2 GB
  • Disk: 1 GB (for logs & cache)
  • OS: Linux/macOS for CLI tools
Additional RAM required if running local models with Ollama or LM Studio.

Next Steps