# Ollama GPU Switcher A simple web UI to toggle OpenClaw agents between **work mode** (local ollama inference) and **lab mode** (cloud fallback), so experiments get exclusive GPU access. ## The Problem With a single GPU (RTX 3090), loading different models causes VRAM swaps. When the lab agent (Eric) loads granite4 while other agents are using qwen3, both tasks fail. This tool lets you switch all non-lab agents to cloud (groq) with one click. ## Modes | Mode | GPU Agents | Lab Agent | GPU Status | |------|-----------|-----------|------------| | ๐Ÿ› ๏ธ Work | qwen3-128k:14b (ollama) | granite4 (ollama) | Shared | | ๐Ÿงช Lab | groq (cloud) | granite4 (ollama) | Exclusive for lab | ## Features - One-click mode switching (work โ†” lab) - Real-time agent status display - Lab model selector (change what Eric runs) - Auto-refresh every 30s - Dark theme, mobile-friendly - **No LLM involved** โ€” pure config switching via OpenClaw gateway API ## Setup ```bash pip install -r requirements.txt ``` ## Usage ```bash # Set your gateway token (from openclaw.json) export OPENCLAW_GATEWAY_TOKEN="your-token-here" # Run on port 8585 (default) python app.py # Or custom port PORT=9090 python app.py ``` Then open `http://localhost:8585` in your browser. ## Environment Variables | Variable | Default | Description | |----------|---------|-------------| | `OPENCLAW_GATEWAY_URL` | `http://127.0.0.1:18789` | Gateway API endpoint | | `OPENCLAW_GATEWAY_TOKEN` | *(empty)* | Gateway auth token | | `PORT` | `8585` | Web UI port | ## How It Works The app reads and patches the OpenClaw gateway config via its REST API: 1. **Status**: `GET /api/status` โ†’ reads agent model assignments 2. **Switch**: `POST /api/switch` โ†’ patches agent models (qwen3 โ†” groq) 3. **Lab model**: `POST /api/lab-model` โ†’ changes Eric's model Config changes trigger an automatic gateway restart. ## License MIT