Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Switch Llama icon

🦙 Switch Llama

One-click loading, unloading and switching of local Ollama models — with live VRAM bars, benchmarks and a will-it-fit predictor.

Windows PowerShell 5.1 Ollama License: MIT

A single 78 KB .exe. No install, no dependencies, no telemetry. It even installs Ollama for you.

Switch Llama main window

Why

Ollama is great, but juggling big local models means living in a terminal: ollama ps, ollama run, ollama stop, nvidia-smi, repeat. Switch Llama turns that into one dark-mode window:

  • see every model on disk and what's loaded right now
  • click Load — watch real progress as the model streams into VRAM
  • know before loading whether a model fits your GPUs
  • free all VRAM with one click when you need it back for games or training

✨ Features

Live model list Every model with size, loaded state, GPU/CPU split and keep-alive expiry. Auto-refreshes every 5 s.
📊 Per-GPU VRAM bars One live bar per GPU (multi-GPU supported), green → amber → red as memory fills.
🔮 Will-it-fit predictor Each model row says fits GPU, partial CPU or mostly CPU based on your free VRAM right now.
Benchmarks One click measures real tokens/sec per model (uses Ollama's own timing data). Sort your models by speed.
📈 Usage stats Measured load times ("loads in ~45 s"), load counts and last-used — persisted across restarts.
⬇️ Pull & delete Pull anything from ollama.com/library and delete models — all from the GUI.
🧹 Store cleanup Finds orphan blobs (crashed pulls, half-deleted models) and reclaims the disk space.
🔍 Model details Click a model: family, parameter count, quantization, context window. Create context-length variants (num_ctx) with two clicks.
Keep-alive picker Choose how long loads stay warm: 15 m / 1 h / 4 h / ∞.
📥 GGUF import Import any local .gguf — auto-merges multi-part/unsloth split shards first.
🌐 Multi-server Manage remote Ollama hosts too; the title-bar button drops down a list of every host you've added.
🔐 Remote llama.cpp over SSH Add an ssh://user@host server and load/unload GGUFs on a Linux box — no Ollama needed there. See Remote servers.
📋 Endpoint field The selected server's OpenAI-compatible base URL sits under the header with a copy button — paste it straight into OpenCode / Cline / Continue.
🔔 Tray mode Minimize to tray, toast notification when a big model finishes loading.
🖥 CLI mode SwitchLlama.exe load <model> / unload all / pull <name> — perfect for Stream Deck buttons.
🤝 OpenCode integration Optional: sets the default model in opencode.jsonc with one click.

📦 Download

Grab SwitchLlama.exe from the latest release and double-click it. That's it.

  • Ollama not installed? Switch Llama offers to install it for you (via winget) and starts the server in the background.
  • No models yet? It offers to pull a small starter model.
  • SmartScreen warning? The exe is unsigned — click More info → Run anyway. Or run from source (below) if you'd rather not run unsigned binaries. The exe is built with ps2exe from the script in this repo, so you can read every line it executes.

🚀 Run from source

No build needed — it's PowerShell all the way down:

git clone https://github.com/DevOps21133/switch-llama.git
cd switch-llama
powershell -NoProfile -ExecutionPolicy Bypass -STA -File .\SwitchLlama.ps1

Build your own exe (installs the ps2exe module on first run):

powershell -NoProfile -ExecutionPolicy Bypass -File .\build-exe.ps1

🖥 CLI

The same exe doubles as a headless CLI — great for hotkeys, scripts and Stream Decks:

SwitchLlama.exe load qwen3:8b      # load a model (keeps it warm 1 h)
SwitchLlama.exe unload qwen3:8b    # unload one model
SwitchLlama.exe unload all         # free all VRAM
SwitchLlama.exe pull llama3.2:3b   # pull from ollama.com

🔐 Remote servers over SSH

Got a big-RAM Linux box running llama-server (llama.cpp / ik_llama.cpp) instead of Ollama? Add it as an ssh:// server and Switch Llama drives it from the same window: it lists the GGUFs on the host, starts llama-server with the model you click, shows RAM/load/cores live, and stops it again with one click.

The title-bar server button opens a dropdown listing every server you've added — the active one carries a dot — plus Add a server… and Forget …. Pick a host and the whole window switches to it; the menu closes on its own when the cursor leaves it.

Right below the header, a read-only field shows the selected server's OpenAI-compatible base URL (http://HOST:PORT/v1 for ssh:// hosts, http://127.0.0.1:11434/v1 for local Ollama). Hit copy and paste it as the baseURL of an OpenAI-compatible provider in your editor.

Setup — the app never stores credentials, only paths. Add the host to %LOCALAPPDATA%\SwitchLlama\settings.json:

{
  "servers": [ "http://127.0.0.1:11434", "ssh://USER@HOST" ],
  "server":  "ssh://USER@HOST",
  "remotes": {
    "ssh://USER@HOST": {
      "key":    "C:\\path\\to\\id_ed25519",   // private key; omit if your agent has it
      "bin":    "/usr/local/bin",             // folder containing llama-server
      "models": "/srv/models",                // searched 2 levels deep for *.gguf
      "port":   8080,                         // llama-server --port
      "args":   "-c 8192",                    // flags for every model
      "modelArgs": {                          // extra flags per model, optional
        "MyModel-Q4_K_M": "-mla 3 -fa on --numa distribute"
      }
    }
  }
}

Requirements on the host: OpenSSH with key-based login (the app runs ssh -o BatchMode=yes, so it never prompts for a password), a llama-server binary, and curl for the health check. Nothing gets installed and no daemon is added — the model is launched detached with setsid nohup, so it keeps running if you close the app.

Notes:

  • Split GGUFs just work. model-00001-of-00006.gguf and friends are folded into one entry; the app passes shard 1 and llama.cpp finds the rest.
  • Thread count is auto-set to physical cores (nproc / 2) on first connect and written back to args — edit it if your box wants something else.
  • One model at a time: Load stops any running llama-server first (pkill -x llama-server), which is also what the Stop model button does.
  • Click a model name for its flags, the tail of the host log (/tmp/switchllama-server.log) and a Copy endpoint button for the OpenAI-compatible http://HOST:PORT/v1.
  • Ollama-only features (pull, GGUF import, keep-alive, store cleanup) grey out while a remote server is selected.

⚙️ How it works

  • Pure Windows PowerShell 5.1 + WPF — both ship with Windows, so there is nothing to install.
  • Talks to Ollama's local REST API (/api/tags, /api/ps, /api/generate, /api/show, /api/delete).
  • Load progress is real: Ollama has no progress API, so Switch Llama baselines VRAM + runner RAM and tracks how much of the model's bytes have actually arrived.
  • Benchmarks use Ollama's exact eval_count / eval_duration timings — no stopwatch guessing.
  • GPU bars read nvidia-smi (hidden, no console flashes). No NVIDIA GPU? Everything else still works.
  • Remote (ssh://) mode shells out to Windows' built-in ssh.exe — one round trip per refresh collects RAM, load, cores and llama-server health. Host details stay in your local settings file; nothing is sent anywhere else.
  • Stats and settings live in %LOCALAPPDATA%\SwitchLlama\ as plain JSON.

❓ FAQ

Does it work with AMD/Intel GPUs? Yes — loading, benching, pulling and everything else works. Only the VRAM bars and the fit predictor need nvidia-smi, so those hide themselves.

Is "Clean store" safe? It only deletes blobs that no model manifest references (leftovers from crashed pulls and deleted models), and always asks first. Don't run it while a pull is in progress.

Windows only? Yes. It's built on WPF. Linux/macOS folks: Gollama is a great TUI alternative.

📄 License

MIT — do whatever you want with it.


Built by DevOps21133 · powered by way too much local VRAM

About

One-click loading, unloading and switching of local Ollama models - live VRAM bars, tok/s benchmarks, will-it-fit predictor. Single 78 KB exe, zero dependencies.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages