Practical VPS tutorial
How to Run Open WebUI on a VPS with External AI API
Set up Open WebUI on a VPS with an external AI API: Docker Compose, private admin setup, provider connections, HTTPS and fixes for empty model lists.
Want your own chat interface without running a model server? Open WebUI can live on a small VPS and send requests to an external AI provider. Your VPS holds the interface, accounts and chat history; the provider does the model inference.

I'd use this setup when a custom domain and control over the interface matter more than hosting the model itself. You don't need Ollama or a GPU for external chat inference. Your prompts still go to the provider, so its privacy and retention policy still matters.
We'll deploy the interface privately first, create the administrator, connect a provider and then add HTTPS.
What you'll need
- An Ubuntu VPS with Docker Engine and Compose.
- SSH access, sudo privileges and
openssl. - A provider's API key, supported model ID and OpenAI-compatible base URL.
- A hostname and an HTTPS reverse proxy for public access.
For a small chat-only stack, I'd start testing with 2 vCPU, 2-4 GB RAM and 25-40 GB SSD. Local document processing, embeddings and voice can change that budget.
This example pins Open WebUI v0.12.5, the latest release checked on October 31, 2026. It uses host port 3001 so it can coexist with a website already using 3000.

1. Create the project and keep its secret key
sudo mkdir -p /opt/open-webui
sudo chown "$(id -u):$(id -g)" /opt/open-webui
cd /opt/open-webui
(
umask 077
set -o noclobber
cat > .env <<EOF
WEBUI_VERSION=v0.12.5
WEBUI_SECRET_KEY=$(openssl rand -hex 32)
EOF
)The .env creation block refuses to overwrite an existing file. Keep WEBUI_SECRET_KEY unchanged when updating or recreating containers. It protects sessions and encrypted data; losing it can break saved connections. Store a recoverable copy outside the VPS.
2. Start Open WebUI with persistent storage
Save this as /opt/open-webui/compose.yml:
name: open-webui
services:
open-webui:
image: ghcr.io/open-webui/open-webui:${WEBUI_VERSION:?set WEBUI_VERSION}
restart: unless-stopped
ports:
- "127.0.0.1:3001:8080"
environment:
WEBUI_SECRET_KEY: ${WEBUI_SECRET_KEY:?set WEBUI_SECRET_KEY}
ENABLE_OLLAMA_API: "false"
volumes:
- data:/app/backend/data
logging:
driver: local
volumes:
data:Now validate and start it:
sudo docker compose config --quiet
sudo docker compose pull
sudo docker compose up -d
sudo docker compose ps
curl --fail http://127.0.0.1:3001/healthIf the health check runs before startup finishes, wait and try it again. Check sudo docker compose logs --tail=50 open-webui if it keeps failing.
The data volume holds users, chats and settings. Port 3001 is reachable only from the host. We also disable the Ollama connection because this guide uses an external provider.
The standard image includes optional local-feature dependencies. For a chat-only install, you can also investigate the slim variant; some retrieval, document and speech features then need external services. Choose the variant for the features you need, not just download size.
3. Create the administrator before opening public access
On your own computer, open an SSH tunnel. Replace the username and IP:
ssh -N -L 3001:127.0.0.1:3001 deploy@SERVER_IPLeave that terminal open and visit http://127.0.0.1:3001 in your local browser. Create the first account, confirm it has administrator access and review whether new registrations are allowed.
4. Add the external AI API connection
Open Settings → Admin → Connections, add an OpenAI-compatible connection and enter the provider's base URL and key. Use the URL its documentation gives you; a base URL field usually should not contain the full /chat/completions path.
Then choose or enter the exact model ID. Don't guess it from a model's marketing name.
Here's a useful distinction: model discovery and chat completion are separate requests. Some providers support chat but not the /models endpoint used by verification. If verification fails, consult the connection guide, add model IDs manually where needed and test a short message.
Check streaming and tool calling separately. An OpenAI-compatible endpoint does not necessarily implement every feature the same way. Use a dedicated API key and check whether the provider's spending control is a hard limit or just an alert.
5. Put the interface behind HTTPS
Point your hostname at the VPS. For an existing host-based Caddy installation, add this site block using your real domain:
chat.example.com {
reverse_proxy 127.0.0.1:3001
}For another proxy, forward to http://127.0.0.1:3001, preserve the original host and protocol, enable WebSockets and disable response buffering for streaming. The HTTPS guide recommends a read timeout of at least 300 seconds for long model responses.
Set the public WebUI URL in Admin settings. Add this under the Compose service's environment, using your actual hostname:
CORS_ALLOW_ORIGIN: "https://chat.example.com"Apply it with sudo docker compose up -d. If you later use the SSH tunnel in a browser, include its localhost origin in the allowed origins as well.
A proxy running inside Docker needs a shared network and upstream open-webui:8080; its own localhost is not the VPS host.
6. Check a reply, a restart and a backup
Send a short prompt through the HTTPS site. Confirm the reply streams, then restart the service:
cd /opt/open-webui
sudo docker compose restart open-webui
sudo docker compose logs --tail=50 open-webuiBack up the data volume, Compose file and original .env. With the default SQLite database, stop writers before copying the data. The Docker backup guide explains consistent archives and restore testing.
Common Open WebUI connection problems
/models; try a manually configured ID.CORS_ALLOW_ORIGIN to the browser's actual origin.FAQ
Does an external-API Open WebUI installation need a GPU?
Not for the remote chat model. Local embeddings, voice and other optional work need their own resource assessment.
Does self-hosting Open WebUI keep prompts away from the provider?
No. You host the interface and local data, but the selected provider receives the model requests.
Why did an update invalidate sessions or saved connections?
Check whether WEBUI_SECRET_KEY changed. Restore the original key from backup when appropriate rather than rotating it as part of every deployment.
Related tutorials
- Secure the VPS and its public ports
- Back up Docker application data
- Estimate RAM for API apps and local models
Next step
Keep the deployment moving
Sources and further reading
- Open WebUI releases
- Quick start and image variants
- OpenAI-compatible connections
- Environment settings and secret keys
- HTTPS, streaming and reverse proxies
Commands assume a fresh Ubuntu server. Replace domains, users, database names and provider-specific values before running them. VPS sizing is a practical starting point, not a guarantee: monitor the real workload and resize when CPU, memory, disk or network headroom becomes tight.
Where to run this
- RackNerdCheapest annual KVM specials
- HostingerBeginner-friendly KVM with snapshots
- InterServerSlice pricing, monthly billing
Affiliate links: you pay the same price as buying direct.