Complete guide to integrating SmarterRouter with OpenWebUI (formerly Ollama WebUI).
- SmarterRouter running (Docker or manual)
- OpenWebUI installed and running
- Both on same network (or same host)
If not already running:
cd /path/to/SmarterRouter
docker-compose up -dVerify: curl http://localhost:11436/health should return {"status":"healthy"}
- Open your OpenWebUI in browser (default:
http://localhost:3000) - Click Settings (gear icon) → Connections
- Click Add a Connection
Fill in the form:
| Field | Value |
|---|---|
| Name | SmarterRouter |
| Base URL | http://localhost:11436/v1 |
| API Key | (leave blank - SmarterRouter doesn't require chat API key) |
| Model | smarterrouter/main (select from dropdown) |
Click Save.
- Return to Chat tab
- Create new conversation
- Model should default to
SmarterRouter(or select from dropdown) - Send a test message: "Write a Python function to calculate fibonacci numbers"
After receiving response, you'll see a signature at the bottom:
Model: llama3:70b
That indicates which model SmarterRouter selected. Try different prompts to see routing behavior:
- Coding prompt: "Explain how context managers work in Python" → Should route to coder model
- Reasoning prompt: "If a train leaves at 2pm traveling 60mph..." → Should route to reasoning model
- Simple prompt: "What's the weather today?" → Should route to small fast model
If you want faster but lower quality responses, adjust in SmarterRouter .env:
ROUTER_QUALITY_PREFERENCE=0.3 # favor speedThen restart: docker-compose restart
To access admin features (profiles, VRAM monitoring) from OpenWebUI:
-
Set admin API key in SmarterRouter
.env:ROUTER_ADMIN_API_KEY=sk-secure-random-key
Generate with:
openssl rand -hex 32 -
Restart SmarterRouter:
docker-compose restart -
In OpenWebUI (if admin panel available), configure admin endpoint with this key.
For instant responses to simple queries, pin a small model:
# In .env
ROUTER_PINNED_MODEL=phi3:miniRestart SmarterRouter. The pinned model stays loaded in VRAM, providing sub-second responses for simple prompts.
- Verify SmarterRouter is running:
curl http://localhost:11436/health - Check that ports match (
11436default) - If using Docker, ensure both containers on same network
- SmarterRouter exposes only
smarterrouter/mainas the model - Make sure you selected "SmarterRouter" connection
- Refresh OpenWebUI page
- First request to a model triggers loading (cold start)
- Subsequent requests to same model will be faster
- Consider pinning a small model:
ROUTER_PINNED_MODEL=phi3:mini
- Check SmarterRouter health:
curl http://localhost:11436/health - Verify backend (Ollama) is running:
curl http://localhost:11434/api/tags - Check logs:
docker logs smarterrouter
While OpenWebUI works through its UI, you can also test directly:
# Chat completion
curl -X POST http://localhost:11436/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"messages": [{"role": "user", "content": "Hello!"}],
"max_tokens": 50
}'
# Get info
curl http://localhost:11436/v1/models
# Health check
curl http://localhost:11436/healthUse these for debugging before connecting OpenWebUI.
- Configuration Reference - Fine-tune SmarterRouter behavior
- Performance Tuning - Optimize for your workload
- Troubleshooting - Common issues and solutions
- API Documentation - Complete API reference