π Ollama Model Unloader

A powerful Open WebUI extension that helps you free up system resources by unloading Ollama models when they're not in use.
π Overview
Ollama Model Unloader is a simple but effective tool that allows you to unload AI models from memory with just a click. This is particularly useful when:
- You need to free up RAM or VRAM on your system
- You want to switch between different models without restarting Ollama
- You're experiencing system slowdowns due to multiple loaded models
β¨ Features
- π₯οΈ Works with both local and remote Ollama hosts
- π Automatically searches multiple locations for Ollama servers
- π Supports custom port configurations
- π Displays real-time progress and results
- π Automatically collapses output panel when finished (configurable)
- π‘οΈ Robust error handling for a smooth experience
βοΈ Configuration Options
You can customize the behavior of the Ollama Model Unloader through the following settings:
| Setting | Description | Default Value |
OLLAMA_HOSTS | List of Ollama host IPs or hostnames to connect to | ["localhost", "127.0.0.1", "ollama", "host.docker.internal"] |
OLLAMA_PORT | Port number for Ollama API | 11434 |
WAIT_BETWEEN_UNLOADS | Seconds to wait between model unloads | 0 |
AUTO_CLOSE_OUTPUT | Whether to automatically close/collapse output when finished | True |
AUTO_CLOSE_DELAY | Seconds to wait before automatically closing output | 3 |
β οΈ Important Notes
- Unloading models might not instantly release system RAM if models have spilled over from VRAM. Monitor your system resources.
- High CPU usage might persist temporarily after unloading if system RAM is heavily utilized.
- Avoid unloading models while they are actively generating text to prevent potential issues.
- If issues persist after unloading, consider restarting your Ollama service manually.
- For remote Ollama instances, ensure the Ollama API is accessible over your network and that any necessary firewalls are configured to allow connections.
π¦ Installation
- In Open WebUI, navigate to the Extensions panel
- Find "Ollama Model Unloader" in the community extensions
- Click "Install"
- The tool will now appear in your toolbar for easy access
π Changelog
- 0.0.5 - Added more error handling and support for remote Ollama servers
- 0.0.4 - Refactor
- 0.0.3 - Added error reporting and better checks
- 0.0.2 - Added status and progress
- 0.0.1 - Initial upload to openwebui community
π§ How It Works
When activated, the tool:
- Searches for Ollama servers on the configured hosts and port
- Gets a list of all currently running models
- Sends an API request to unload each model by setting
keep_alive to 0
- Verifies that models are properly unloaded
- Provides status updates throughout the process
π» Technical Details
The unloader works by making HTTP requests to the Ollama API. Specifically, it:
- Uses
GET /api/ps to find running models
- Uses
POST /api/generate with keep_alive: 0 to unload models
- Includes comprehensive error handling for network issues, API errors, and unexpected scenarios
π¨βπ» Author
Developed by pkeffect
π Links
π License
This project is licensed under the MIT License
Required Open WebUI Version: 0.6.0 or higher