Self-Host Your Own ChatGPT Alternative with Open WebUI and NanoGPT
Tired of sending every conversation to OpenAI's servers? I was too. That's why I set up Open WebUI — a self-hosted, ChatGPT-style interface — with NanoGPT as the backend. The result: a full-featured chat UI that looks and feels like ChatGPT, but where I control the infrastructure and my data doesn't get harvested for training.
Here's how to set it up, step by step.
What You'll Get
- A clean, ChatGPT-like web interface running on your own hardware
- Privacy-focused AI backend via NanoGPT (no data used for training)
- Multi-user support with conversation history
- Full control over models, parameters, and system prompts
- Works from any device on your network
If you're exploring private AI tools more broadly, I wrote up a list of recommendations at ai-privacy-tools.vercel.app.
Prerequisites
You'll need:
- A machine with Docker installed (Linux, macOS, or Windows with WSL2)
- An API key from nano-gpt.com
- About 5 minutes of your time
That's it. No Kubernetes, no Terraform, no DevOps degree required.
Step 1: Install Docker
If you already have Docker, skip this. Otherwise:
# Ubuntu/Debian
curl -fsSL https://get.docker.com | sh
sudo usermod -aG docker $USER
# Log out and back in for group changes to take effect
# macOS — just install Docker Desktop from docker.com
Verify it's working:
docker --version
docker run hello-world
Step 2: Launch Open WebUI
The simplest way to get running is a single docker run command:
docker run -d \
-p 3000:8080 \
-e NANOGPT_API_BASE_URL=https://nano-gpt.com/api/v1 \
-e NANOGPT_API_KEY=your-nanogpt-api-key \
-v open-webui:/app/backend/data \
--name open-webui \
--restart always \
ghcr.io/open-webui/open-webui:main
Let's break down what each flag does:
| Flag | Purpose |
|---|---|
-d |
Run in detached (background) mode |
-p 3000:8080 |
Map port 3000 on your host to port 8080 in the container |
-e NANOGPT_API_BASE_URL |
Point Open WebUI to NanoGPT's API |
-e NANOGPT_API_KEY |
Your API authentication |
-v open-webui:/app/backend/data |
Persist conversations and settings to a Docker volume |
--restart always |
Auto-restart on crash or reboot |
Once it's running, open your browser and go to:
http://localhost:3000
You'll be greeted by a setup screen where you create your admin account.
Step 3: Create Your Admin Account
On first launch, Open WebUI asks you to register. The first user becomes the admin. Pick a strong password — this controls your entire instance.
After registration, you'll land on the main chat interface. It should already show NanoGPT models available in the model selector dropdown.
Step 4: Configure NanoGPT as the Backend
If the models don't appear automatically, head to Settings → Connections and configure:
OpenAI API:
Base URL: https://nano-gpt.com/api/v1
API Key: your-nanogpt-api-key
Save and test the connection. You should see available models populate.
Using Docker Compose
If you prefer docker-compose.yml (and for production setups, you should), here's a complete config:
version: "3.8"
services:
open-webui:
image: ghcr.io/open-webui/open-webui:main
container_name: open-webui
ports:
- "3000:8080"
environment:
- NANOGPT_API_BASE_URL=https://nano-gpt.com/api/v1
- NANOGPT_API_KEY=${NANOGPT_API_KEY}
- WEBUI_SECRET_KEY=your-random-secret-key-here
volumes:
- open-webui:/app/backend/data
restart: always
volumes:
open-webui:
Create a .env file in the same directory:
NANOGPT_API_KEY=your-nanogpt-api-key
WEBUI_SECRET_KEY=generate-a-random-string-here
Then launch:
docker compose up -d
Step 5: Set Up User Access
Open WebUI supports multi-user setups. From the admin panel, you can:
- Invite users — Share a registration link or create accounts manually
- Set model access — Control which models each user/group can access
- Configure defaults — Set default system prompts, temperature limits, etc.
This is great for teams. Everyone gets their own workspace and conversation history, but you control which models are available and what parameters they can tweak.
Step 6: Fine-Tune Your Setup
Here are some configuration tweaks that make a real difference:
Change Default Models
In Admin Panel → Settings, set your preferred default model. I recommend minimax/minimax-m2.7 as a solid all-rounder.
Enable Conversation History
By default, Open WebUI saves all conversations to the Docker volume. If you want to be extra privacy-conscious, you can disable this:
environment:
- ENABLE_HISTORY=false
Add System Prompts
Go to Workspace → Modelfiles to create custom system prompts. For example, create a "Code Assistant" modelfile:
FROM minimax/minimax-m2.7
PARAMETER temperature 0.3
SYSTEM """
You are an expert programmer. Write clean, well-documented code.
Always explain your reasoning. If there are trade-offs, mention them.
"""
This gives you specialized AI personalities for different tasks.
Custom Models
Want to use multiple NanoGPT models? Add them in Settings → Connections:
Model 1: minimax/minimax-m2.7 (general purpose)
Model 2: google/gemini-2.5-flash (fast responses)
Users can then switch between models from the chat interface.
Security Considerations
Since you're running this yourself, a few things to keep in mind:
- Don't expose port 3000 to the internet without a reverse proxy and HTTPS
- Use strong passwords for your admin account
-
Keep Docker updated — run
docker compose pullperiodically - Back up your volume — conversations and settings live there
For a simple nginx reverse proxy with HTTPS:
server {
listen 443 ssl;
server_name ai.yourdomain.com;
ssl_certificate /path/to/cert.pem;
ssl_certificate_key /path/to/key.pem;
location / {
proxy_pass http://localhost:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# WebSocket support (needed for streaming)
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
Updating Open WebUI
Updates are simple:
docker compose pull
docker compose up -d
Your data persists in the volume, so you won't lose anything. I'd recommend updating at least once a month to get new features and security patches.
Troubleshooting
Models not showing up?
Check that your API key is valid and the base URL is correct. Test with curl:
curl -H "Authorization: Bearer your-key" \
https://nano-gpt.com/api/v1/models
Slow responses?
This is likely the model's response time, not your setup. Streaming should help — make sure it's enabled in the chat settings.
Container won't start?
Check logs:
docker logs open-webui
The most common issue is port conflicts. If port 3000 is taken, change it:
-p 8080:8080 # Use port 8080 instead
Why This Setup Works
The beauty of this stack is the separation of concerns. Open WebUI handles the frontend — the chat interface, user management, conversation history. NanoGPT handles the AI inference — the actual language model processing. And Docker handles the deployment — consistent, reproducible, isolated.
You get a ChatGPT-quality experience without ChatGPT's data policies. Your conversations stay on your machine. Your API calls go to a privacy-focused provider. And if you ever want to switch backends, you just change the base URL.
That's the kind of architecture I can get behind.
Originally published at ai-privacy-tools.vercel.app
Top comments (0)