Ollama Add-on
Run Large Language Models (LLMs) locally on your Home Assistant hardware with complete privacy and no cloud dependency.
Features
- 🔒 Complete Privacy: All processing happens locally
- 🚀 Multiple Models: Support for Llama, Mistral, Phi, and more
- 🎯 REST API: Easy integration with Home Assistant and other services
- 💾 Model Management: Download, update, and remove models easily
- ⚡ GPU Support: Acceleration for supported hardware
Installation
- Add the J0rsa repository to your Home Assistant
- Search for “Ollama” in the Add-on Store
- Click Install and wait for the download to complete
- Configure the add-on (see Configuration below)
- Start the add-on
Configuration
# Example configuration
gpu_support: false # Enable if you have compatible GPU
models_path: /data/models # Where to store models
api_host: 0.0.0.0 # API listening address
api_port: 11434 # API port
Configuration Options
| Option |
Description |
Default |
gpu_support |
Enable GPU acceleration if available |
false |
models_path |
Directory to store downloaded models |
/data/models |
api_host |
API listening address |
0.0.0.0 |
api_port |
API listening port |
11434 |
Usage
Downloading Models
After starting the add-on, you can download models using the API:
curl http://homeassistant.local:11434/api/pull -d '{
"name": "llama2"
}'
Popular Models
- llama2: Meta’s Llama 2 model (7B parameters)
- mistral: Mistral AI’s 7B model
- phi: Microsoft’s Phi-2 model (2.7B)
- codellama: Specialized for code generation
- neural-chat: Intel’s conversational model
Running Inference
Send a prompt to the model:
curl http://homeassistant.local:11434/api/generate -d '{
"model": "llama2",
"prompt": "Why is the sky blue?"
}'
Integration with Home Assistant
You can integrate Ollama with Home Assistant using REST commands:
rest_command:
ask_ollama:
url: "http://localhost:11434/api/generate"
method: POST
headers:
Content-Type: "application/json"
payload: '{"model": "llama2", "prompt": ""}'
Hardware Requirements
Minimum Requirements
- CPU: 4 cores recommended
- RAM: 8GB minimum (16GB recommended)
- Storage: 10GB+ depending on models
Model Size Guidelines
- 7B models: ~4GB RAM
- 13B models: ~8GB RAM
- 30B models: ~16GB RAM
API Documentation
Endpoints
| Endpoint |
Method |
Description |
/api/generate |
POST |
Generate text from a prompt |
/api/pull |
POST |
Download a model |
/api/tags |
GET |
List available models |
/api/delete |
DELETE |
Remove a model |
Example: List Models
curl http://homeassistant.local:11434/api/tags
Tips and Tricks
- Model Selection: Start with smaller models (7B) and upgrade if needed
- Performance: Enable GPU support if you have compatible hardware
- Storage: Models are stored persistently in
/data/models
- Memory: Monitor RAM usage, especially with larger models
- API Key: Consider adding authentication for external access
Troubleshooting
Add-on Won’t Start
- Check logs for error messages
- Ensure sufficient RAM is available
- Verify port 11434 is not in use
Model Download Fails
- Check internet connectivity
- Ensure sufficient storage space
- Try downloading a smaller model first
- Consider using smaller models
- Enable GPU acceleration if available
- Close other resource-intensive add-ons
Support