VPSGauge

How to Run a Self Hosted AI Platform on a VPS in 6 Steps

Updated Nov 24, 2026 · by Kane · how we check

Part of VPS for AI agents, our guide to this topic

Live data the 9 prices on this page come from 5 providers' own sites, read daily. Last read Dec 4, 2026 · no price changes in our tracking.

Short answer

Yes—you can run a self hosted AI platform on a CPU-only VPS for small open models (7B and below, slowly), while larger models need a GPU. Set up Ollama, Open WebUI and Caddy in 6 steps (30 minutes): budget 8 GB RAM for 3B–7B models, 16 GB for 13B.

Time
30 min
Steps
6
Works on
Ubuntu
24.04 LTS
On this page
  1. Can you run a self-hosted AI platform on a CPU-only VPS?
  2. Which self-hosted AI platform should you choose?
  3. What you need before you start
  4. How to set up a self-hosted AI platform on Ubuntu 24.04: 6 steps
    1. 1Point a subdomain at your VPS and lock UFW
    2. 2Install Ollama with the official script
    3. 3Let Docker reach Ollama without opening port 11434 to the internet
    4. 4Pull a small open-weight model and test CPU speed
    5. 5Run Open WebUI in Docker bound to localhost
    6. 6Put Open WebUI behind Caddy with automatic HTTPS
  5. Key takeaways
  6. A VPS for this guide
  7. Self-hosted VPS vs cloud API cost: what the numbers say
  8. Common self-hosted AI problems
  9. Questions

This guide has no affiliate links in the steps.

Most tutorials assume a desktop graphics card under your desk or a cloud GPU instance that costs more per day than a regular server costs per month. A standard Linux VPS has no GPU at all, so two things happen at once: your system RAM has to hold the entire quantized model file plus the conversation context, and your virtual CPU cores have to do every matrix multiplication over shared memory channels. That rules out 30B and 70B models on a normal VPS, leaves 7B–8B models usable for patient single-user chat or background tasks, and makes 1B–3B models the practical daily driver. If your goal is an always-on agent that calls a cloud model over an API rather than running weights locally, start with our VPS for AI agents breakdown instead—an API agent needs 4 GB to 8 GB of RAM and no local model engine.

An Ubuntu VPS running Ollama and Open WebUI behind a Caddy HTTPS lock, with model size bars for 8 GB, 16 GB and 32 GB of RAM drawn in charcoal ink and receipt orange on paper white.

Can you run a self-hosted AI platform on a CPU-only VPS?

Yes, as long as the quantized model weights and the key-value (KV) context cache fit inside your server’s physical RAM without spilling into swap. Once a model swaps to disk, token generation drops to a standstill.

Ollama’s documentation (read Nov 24, 2026) sets the baseline memory rule for default 4-bit quantized models: you should have at least 8 GB of RAM available to run 7B models, 16 GB to run 13B models, and 32 GB to run 33B models. Underneath Ollama sits llama.cpp, which stores models in the GGUF format. At standard 4-bit quantization (Q4_K_M, roughly 4.5 bits per parameter), the weights alone take about 0.55 GB to 0.65 GB per billion parameters, and the operating system, Docker daemon, web interface and context window take another 2 GB to 4 GB on top.

Ollama README at v0.5.7, the memory note: you should have at least 8 GB of RAM available to run the 7B models, 16 GB to run the 13B models, and 32 GB to run the 33B models. Ollama’s own memory rule for 7B, 13B and 33B models. Source: github.com/ollama/ollama (v0.5.7 README), captured Nov 24, 2026.

WHAT A CPU-ONLY VPS CAN RUN (Q4 QUANTIZATION) 1B TO 3B MODELS 8 GB RAM VPS usable CPU chat llama3.2:3b, qwen2.5:3b 7B TO 8B MODELS 8–16 GB RAM VPS slow on CPU (1–5 t/s) good for async jobs 13B TO 14B MODELS 16–32 GB RAM VPS very slow on vCPUs RAM-bandwidth bound 30B+ MODELS 32 GB+ or GPU skip CPU-only VPS use GPU or API Ollama docs: 8 GB RAM for 7B models, 16 GB for 13B, 32 GB for 33B
WHAT A CPU-ONLY VPS CAN RUN 1B TO 3B MODELS (8 GB RAM VPS) usable CPU chat · llama3.2:3b, qwen2.5:3b 7B TO 8B MODELS (8–16 GB RAM VPS) slow on CPU (1–5 t/s) · good for async jobs 13B TO 14B MODELS (16–32 GB RAM VPS) very slow on shared vCPUs · bandwidth bound 30B+ MODELS (32 GB+ OR GPU) skip CPU-only VPS · rent a GPU or use an API Ollama docs: 8 GB for 7B, 16 GB for 13B, 32 GB for 33B

Here is how those memory tiers map to real plans in our daily price data (checked Dec 4, 2026), with their billing rules spelled out:

Model size (Q4_K_M) Download RAM you need On a CPU-only VPS
1B–3B (llama3.2:3b, qwen2.5:3b) ~1.5–2.2 GB 8 GB Responsive for one person
7B–8B (llama3.1:8b, qwen2.5:7b) ~4.5–5.2 GB 16 GB (8 GB is tight) Slow typing, often 1–5 tokens/sec
13B–14B (qwen2.5:14b, phi3:14b) ~8.5–9.5 GB 16 GB; 32 GB with RAG + UI Long pause before the first token
30B–70B (llama3.3:70b) ~20–43 GB 32–64 GB+, or a 24 GB+ GPU Not practical; rent a GPU or use an API

Plans in our daily data for each RAM size (IPv4 included):

  • 8 GB: RackNerd 8 GB special (6 vCPU, 140 GB SSD) at $7.92/mo billed yearly; netcup VPS Lite 2 (4 vCPU, 160 GB SSD) at $8.64/mo excl. VAT, 3-month minimum; OVHcloud VPS-2 (4 vCPU, 75 GB NVMe) at $10.00/mo monthly.
  • 16 GB: HostHatch NVMe 16 GB (4 vCPU, 75 GB NVMe) at $15.00/mo monthly; netcup VPS Lite 3 (8 vCPU, 320 GB SSD) at $15.16/mo excl. VAT, 2-month minimum; InterServer 8 slices (4 vCPU, 320 GB SSD) at $24.00/mo monthly.
  • 32 GB: netcup VPS Lite 4 (16 vCPU, 640 GB SSD) at $28.07/mo excl. VAT; HostHatch NVMe 32 GB (8 vCPU, 125 GB NVMe) at $29.00/mo; InterServer 16 slices (8 vCPU, 640 GB SSD) at $48.00/mo.
  • 30B–70B models: these need a GPU server, and we do not track GPU server prices.

Read the provider catches before you pick a plan from that table. RackNerd’s yearly special renews at the same rate, has no money-back guarantee by default, and deletes an unpaid server 7 days after the due date (per RackNerd’s terms of service, checked Nov 9, 2026). Netcup’s Lite plans carry a minimum contract term, require one month’s cancellation notice to the end of the month, and ask for Stripe identity verification or a prepayment after your first order (checked Nov 11, 2026). HostHatch suspends unpaid servers 2 days after the due date, wipes them after 5 days, and grants 7-day refunds only when a verified fault is on HostHatch’s side (checked Nov 14, 2026). OVHcloud and InterServer bill month to month with no refund by default (checked Nov 14, 2026).

When you actually need a GPU. Token generation speed on a large language model is bound by how fast the processor can stream gigabytes of weights from memory for every single token. A dedicated graphics card gives you hundreds of gigabytes per second of VRAM bandwidth; a shared CPU VPS gives you a slice of main system DDR4 or DDR5 shared with other virtual machines. If you need fast code completion, multiple concurrent users, or models above 13B parameters, a CPU-only VPS will frustrate you. We only track standard CPU VPS plans on this site and do not track GPU rental prices. It is the exact question people wrestle with in the community (their report, not our test):

I got a decent server with no GPU and i was thinking, is it worth to buy one (like a RTX 4060) to selfhost ollama and use then models for coding, ai agents and other small things?

r/selfhosted · Jun 2025 · Worth selfhosting ollama?

Which self-hosted AI platform should you choose?

Pick Ollama plus Open WebUI if you want a private ChatGPT-style chat interface backed by open-weight models on your own server. If you want to chat primarily with your own PDFs and documents, pick AnythingLLM; if you are building multi-step workflows or connecting webhooks to models, pick Dify or n8n.

These tools are not seven direct competitors doing the same job. They sit in three layers:

  1. Model runtimes (Ollama, llama.cpp, LocalAI) load the .gguf weight files into RAM, run inference on the CPU or GPU, and expose a local HTTP API.
  2. Chat and RAG workspaces (Open WebUI, AnythingLLM) provide the browser login, chat history, document upload and vector search, and send prompts to a local runtime or an external cloud API.
  3. Workflow and agent builders (Dify, n8n) chain prompts together with webhooks, databases, schedules and code blocks.
THE SELF-HOSTED AI STACK: THREE LAYERS 1 MODEL RUNTIME loads GGUF weights in RAM exposes local REST API Ollama · llama.cpp · LocalAI 2 CHAT & RAG WORKSPACE ChatGPT-style web UI user accounts & doc upload Open WebUI · AnythingLLM 3 WORKFLOWS & AGENTS chains prompts, webhooks can call local or cloud APIs Dify · n8n (AI nodes) most self-hosters pair one runtime (Ollama) with one UI (Open WebUI)
THE SELF-HOSTED AI STACK: THREE LAYERS 1 MODEL RUNTIME loads GGUF weights, exposes local API Ollama · llama.cpp · LocalAI 2 CHAT & RAG WORKSPACE ChatGPT-style web UI, auth, doc upload Open WebUI · AnythingLLM 3 WORKFLOWS & AGENTS chains prompts, webhooks, local or cloud API Dify · n8n (AI nodes) pair one runtime (Ollama) with one UI (Open WebUI)

Here is how the seven platforms compare in their own official documentation, all checked on Nov 24, 2026 (n8n docs checked Nov 14, 2026):

Platform What it is Minimum server (project docs) Licence
Ollama Runtime: downloads and runs models 8 GB RAM for 7B, 16 GB for 13B, 32 GB for 33B MIT
llama.cpp Runtime: GGUF engine with an OpenAI-style API Not stated; RAM must fit the model (~4.5–6 GB for a Q4 7B) MIT
LocalAI Runtime + UI: drop-in OpenAI/Anthropic API Not stated; no GPU needed MIT
Open WebUI Chat + RAG: ChatGPT-style web app Not stated Open WebUI License
AnythingLLM Chat + RAG: document chat, vector DB built in 2 GB RAM, 2 cores with AVX2, 5 GB disk MIT
Dify Workflow + RAG: visual app builder 2 cores, 4 GB RAM Dify Open Source License
n8n (AI nodes) Workflows + agents: AI steps on a schedule or webhook 2 GB RAM; 4 GB and 2 vCPU with n8n Assistant Sustainable Use License

Licence catches: Open WebUI is source-available and its branding must stay intact above 50 users in 30 days. Dify’s licence is a modified Apache 2.0 that bans multi-tenant commercial hosting and logo removal. n8n is fair-code, free for internal and organisation workflows.

Minimum-server sources: AnythingLLM system requirements · Dify README · n8n Hetzner guide; the others are from each project’s README.

AnythingLLM system requirements page: your CPU must support the AVX2 instruction set, the one hard requirement AnythingLLM has of your hardware. AVX2 is the one hard hardware requirement. Source: docs.anythingllm.com, captured Nov 24, 2026.

Three details in that table catch people off guard after they rent a server:

  • The 2 GB and 4 GB figures for AnythingLLM, Dify and n8n are for the platform containers alone. If Dify or AnythingLLM calls OpenAI, Anthropic or DeepSeek over an API, a 4 GB VPS works. If you also run Ollama on the same VPS, add Ollama’s 8 GB to 16 GB model memory on top.
  • Licence rules matter if you share the URL. Ollama, llama.cpp, LocalAI and AnythingLLM use the permissive MIT License. Open WebUI moved to the custom Open WebUI License, which forbids removing or altering the Open WebUI name and logo whenever a deployment exceeds 50 end users in a rolling 30-day period without an enterprise agreement. Dify’s modified Apache 2.0 license forbids operating a multi-tenant commercial service or stripping the Dify logo from the frontend. For n8n’s fair-code rules and full Docker setup, see our guide to self-hosting n8n on a VPS; if you want a dedicated box for browser-driving agents like OpenClaw, see our OpenClaw VPS picks.

What you need before you start

To set up the Ollama + Open WebUI stack below, prepare four things:

  • An Ubuntu 24.04 LTS VPS with at least 8 GB of RAM (4+ vCPUs recommended) and a non-root sudo user if you want to run 3B to 7B local models. If you only want Open WebUI as a private frontend for cloud API keys, a 2 GB VPS is enough. New to running your own software stack? Read our overview of what self-hosting actually involves.
  • Docker Engine and the Docker Compose plugin installed. Follow our Ubuntu Docker install guide if docker --version is not yet available on your server.
  • UFW enabled on the server so only SSH, HTTP and HTTPS are open to the public internet. If you haven’t set up the firewall yet, follow our UFW firewall guide first.
  • A domain or subdomain (such as ai.example.com) whose DNS records you can edit. Throughout the commands below, replace ai.YOUR_DOMAIN with your real subdomain and YOUR_SERVER_IP with your VPS’s public IPv4 address.

How to set up a self-hosted AI platform on Ubuntu 24.04: 6 steps

We install Ollama directly on the Ubuntu host as a systemd service, run Open WebUI in a Docker container bound to 127.0.0.1:3000, and put Caddy in front for automatic Let’s Encrypt HTTPS. That keeps the setup clean and avoids two classic security mistakes: exposing Ollama’s unauthenticated port 11434 to the public internet, and letting Docker’s port publishing bypass your UFW rules on port 3000.

REQUEST FLOW ON UBUNTU 24.04: ONLY CADDY FACES THE INTERNET 1 BROWSER HTTPS port 443 ai.YOUR_DOMAIN public internet 2 CADDY Let's Encrypt TLS reverse_proxy to 127.0.0.1:3000 3 OPEN WEBUI Docker container bound to 127.0.0.1 calls host :11434 4 OLLAMA systemd service port 11434 closed to public internet UFW allows 22, 80, 443 only — ports 3000 and 11434 are never exposed publicly
REQUEST FLOW ON UBUNTU 24.04 1 BROWSER (PUBLIC INTERNET) HTTPS port 443 · ai.YOUR_DOMAIN 2 CADDY REVERSE PROXY Let's Encrypt TLS -> 127.0.0.1:3000 3 OPEN WEBUI (DOCKER) bound to 127.0.0.1:3000 -> calls host :11434 4 OLLAMA (SYSTEMD ON HOST) port 11434 closed to the public internet UFW allows 22, 80, 443 only
1

Point a subdomain at your VPS and lock UFW

At your DNS provider, create an A record for ai pointing to YOUR_SERVER_IP. Wait a minute, then verify from your server that the name resolves:

servergetent hosts ai.YOUR_DOMAIN

Check: Your server’s public IPv4 address next to ai.YOUR_DOMAIN. Do not move on to Caddy until this prints your IP.

Next, verify that UFW allows only SSH, HTTP (80) and HTTPS (443), and denies everything else incoming:

serversudo ufw default deny incoming
sudo ufw allow OpenSSH
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw enable
sudo ufw status
2

Install Ollama with the official script

Run the official install script from Ollama’s Linux documentation (checked Nov 24, 2026):

servercurl -fsSL https://ollama.com/install.sh | sh

The script downloads the Linux binary to /usr/local/bin/ollama, creates an ollama system user, and registers /etc/systemd/system/ollama.service with ExecStart=/usr/local/bin/ollama serve. Check that the service is active:

serversudo systemctl status ollama

Check: Active: active (running) and a log line showing Ollama listening on 127.0.0.1:11434.

3

Let Docker reach Ollama without opening port 11434 to the internet

By default, Ollama binds strictly to 127.0.0.1:11434. A Docker container has its own network namespace, so when Open WebUI tries to reach the host via host.docker.internal:11434, a 127.0.0.1 listener on the host refuses the connection.

Use systemd’s drop-in override (sudo systemctl edit ollama.service) rather than editing /etc/systemd/system/ollama.service directly, which gets overwritten on updates. To bind Ollama to your Docker bridge interface (or 0.0.0.0 behind the UFW rules you locked in Step 1), create the override directory and file:

serversudo mkdir -p /etc/systemd/system/ollama.service.d
sudo nano /etc/systemd/system/ollama.service.d/override.conf
override.conf — nano[Service]
Environment="OLLAMA_HOST=0.0.0.0:11434"
Environment="OLLAMA_KEEP_ALIVE=5m"

Reload systemd and restart Ollama:

serversudo systemctl daemon-reload
sudo systemctl restart ollama

Because Ollama is a native host process (not a Docker container with -p), it obeys UFW. Your sudo ufw default deny incoming rule from Step 1 blocks outside scanners from reaching port 11434, while containers on the local docker0 bridge can talk to it.

4

Pull a small open-weight model and test CPU speed

Before adding the web UI, pull a small model from the command line and see how fast your VPS generates tokens. On an 8 GB VPS, start with a 3B parameter model (llama3.2:3b, about 2.0 GB on disk):

serverollama pull llama3.2:3b
ollama run llama3.2:3b --verbose "Explain what a reverse proxy does in two sentences."

If you rented a 16 GB VPS and want a stronger 7B model, run ollama pull qwen2.5:7b (about 4.7 GB) instead.

Check: A two-sentence answer followed by timing lines at the bottom, including eval rate: ... tokens/s. On a 4- to 8-vCPU server with llama3.2:3b, you should see roughly 6 to 15 tokens per second; on a 7B model, 2 to 6 tokens per second is normal on CPU.

If it fails: Error: model requires more system memory (...) than is available. Your VPS does not have enough free RAM for that model size. Pull a smaller model (llama3.2:3b or qwen2.5:1.5b) instead of adding disk swap—swap makes LLM inference unusably slow.

5

Run Open WebUI in Docker bound to localhost

Open WebUI’s quick-start documentation (read Nov 24, 2026) uses docker run with --add-host=host.docker.internal:host-gateway so the container can reach Ollama on the host. We make one critical change for a public VPS: we bind the host port to 127.0.0.1:3000:8080 instead of -p 3000:8080, and pass a generated WEBUI_SECRET_KEY so session cookies stay valid across container restarts.

Open WebUI README: the docker run command with -p 3000:8080, –add-host=host.docker.internal:host-gateway and the open-webui data volume. The official quick-start command; we change only the port binding to 127.0.0.1. Source: github.com/open-webui/open-webui, captured Nov 24, 2026.

Run this command on your server:

serversudo docker run -d \
  -p 127.0.0.1:3000:8080 \
  --add-host=host.docker.internal:host-gateway \
  -e WEBUI_SECRET_KEY=$(openssl rand -hex 32) \
  -v open-webui:/app/backend/data \
  --name open-webui \
  --restart always \
  ghcr.io/open-webui/open-webui:main

The first pull downloads the :main image (which bundles local RAG embedding support) and takes a couple of minutes. Check that the container is healthy and listening on localhost:

serversudo docker ps
curl -I http://127.0.0.1:3000

Check: HTTP/1.1 200 OK (or a redirect to the login page) from 127.0.0.1:3000, while http://YOUR_SERVER_IP:3000 from outside the server is refused.

6

Put Open WebUI behind Caddy with automatic HTTPS

Install Caddy from Ubuntu’s official packages and point your subdomain at 127.0.0.1:3000:

serversudo apt update
sudo apt install -y caddy
sudo nano /etc/caddy/Caddyfile

Replace the file contents with:

Caddyfile — nanoai.YOUR_DOMAIN {
    reverse_proxy 127.0.0.1:3000
}

Reload Caddy so it obtains a Let’s Encrypt TLS certificate:

serversudo systemctl reload caddy

Now open https://ai.YOUR_DOMAIN in your browser right away and create your account. In Open WebUI, the first account created automatically becomes the administrator.

Key takeaways

  1. A CPU-only VPS can run small quantized open models (1B–3B comfortably on 8 GB RAM; 7B–8B slowly on 8–16 GB RAM), while 30B+ models need a GPU server.
  2. Pair a model runtime (Ollama, llama.cpp or LocalAI) with a chat or workflow layer (Open WebUI, AnythingLLM, Dify or n8n)—check each project’s RAM floor, AVX2 requirement and branding licence first.
  3. In our 6-step Ubuntu 24.04 setup, keep port 11434 protected by UFW and bind Open WebUI to 127.0.0.1:3000:8080 so Docker does not bypass your firewall; let Caddy handle HTTPS on port 443.
  4. Register your admin account on Open WebUI immediately after Caddy starts, then disable public sign-ups in the Admin Panel.
  5. Use the hybrid approach when CPU speed is too slow: host Open WebUI or Dify on your VPS, run private tasks on local Ollama, and attach an API key for heavy reasoning.

A VPS for this guide

Everything above runs on a VPS with 8 GB of RAM or more. The cheapest 8 GB+ plan at each provider whose prices we read every day, IPv4 included:

Plan · providervCPU · RAM · diskYou payVisit
Cloud VPS 4
Contabo · Asia (India) +8
4 vCPU·8 GB·100 GB$6.60/mo
VPS Lite 2 G12.5s
netcup · Nuremberg +2
4 vCPU·8 GB·160 GB$8.64/mo
NVMe 8 GB
HostHatch · Amsterdam +15
2 vCPU·8 GB·35 GB$9.00/mo
VPS-2
OVHcloud · Vint Hill, VA +1
4 vCPU·8 GB·75 GB$10.00/mo
KVM VPS Special 8 GB
RackNerd · New York +3
7 vCPU·8 GB·150 GB$10.00/mo

Prices read Dec 4, 2026. gets that provider's deals on Telegram. Compare every 8 GB plan →

Self-hosted VPS vs cloud API cost: what the numbers say

Self-hosting an open model on a VPS does not beat cloud API pricing on raw cost per token for light or moderate single-person use. You self-host on a VPS for two other reasons: keeping sensitive text off third-party servers, or capping your spend at a fixed monthly bill when background scripts run all day.

Compare our daily VPS prices (checked Dec 4, 2026) against the official per-million-token rates on the major model providers’ pricing pages (all read Nov 24, 2026):

Option What you pay What you get
8 GB CPU VPS $7.92/moto $10.00/mo Fixed bill; 1B–3B models well, 7B slowly; data stays on your disk
16 GB CPU VPS $15.00/moto $24.00/mo Fixed bill; room for 7B–8B plus Open WebUI or Dify
32 GB CPU VPS $28.07/moto $48.00/mo Fixed bill; fits 13B–14B, still slow
OpenAI API (gpt-4o-mini) $0.15in · $0.60 out per 1M tokens Fast small model; prompts go to OpenAI
Anthropic API (Haiku 5.5 / Sonnet 5.5) Haiku $0.10 in · $0.50 out; Sonnet $2 in · $10 out, per 1M tokens Fast frontier models, pay per token
DeepSeek API (deepseek-flash / deepseek-v4-pro) flash $0.15 in · $0.60 out; v4-pro $0.66 in · $1.98 out, per 1M tokens off-peak Cheapest per token; cache hits cost less

Fine print: the 8 GB low end is RackNerd billed yearly; netcup prices exclude VAT. Anthropic’s Haiku price is for prompts up to 100K tokens. DeepSeek’s input prices are for cache misses (cache hits $0.003–$0.044 per 1M) and double during UTC peak hours. Sources, checked Nov 24, 2026: VPS prices from our daily reads of provider pages · OpenAI API Pricing · Anthropic Pricing · DeepSeek API Pricing

Look at the gap between a $10.00/month 8 GB VPS and a $0.10–$0.15 per million input token API. If you only ask a few questions a day, an API key costs pennies a month and gives you fast answers from a much larger model.

SELF-HOSTED MODELS VS CLOUD API: COST AND PRIVACY 1 LOCAL WEIGHTS ON VPS prompts stay on your disk flat monthly VPS bill best for private 1B–8B jobs 2 CLOUD LLM API fast frontier models pay per 1M input/output tokens cheaper for light or burst use 3 HYBRID ON ONE VPS self-host Open WebUI / Dify Ollama for private drafts API key for heavy reasoning Open WebUI, AnythingLLM, Dify and n8n can switch between local Ollama and cloud APIs
SELF-HOSTED MODELS VS CLOUD API 1 LOCAL WEIGHTS ON VPS prompts never leave your server flat monthly VPS bill · 1B–8B models 2 CLOUD LLM API fast frontier models, no GPU to rent pay per 1M tokens · cheaper at low volume 3 HYBRID ON ONE VPS self-host Open WebUI, Dify or n8n local Ollama for private docs + API for hard tasks all four UIs can route to both local Ollama and APIs

Where the VPS wins is control and hybrid routing. As one self-hoster put it when weighing local hardware against cloud subscriptions in a February 2025 r/selfhosted thread, concerns about sending private or business data to the cloud are often what stops people from using AI tools on real work. And you do not have to choose 100% local or 100% cloud: Open WebUI, AnythingLLM, Dify and n8n all let you connect local Ollama and an OpenAI, Anthropic or DeepSeek API key in the same interface. You can keep private logs and customer documents on your local llama3.2:3b or qwen2.5:7b model, and switch the dropdown to an API model when you need heavy coding or reasoning.

Common self-hosted AI problems

Open WebUI loads, but the model dropdown is empty or says “WebUI could not connect to Ollama.”Ollama is still bound only to 127.0.0.1:11434 on the host, so requests from the Docker container’s host.docker.internal address are rejected. Check sudo systemctl status ollama to confirm your /etc/systemd/system/ollama.service.d/override.conf file loaded OLLAMA_HOST=0.0.0.0:11434, and confirm you passed --add-host=host.docker.internal:host-gateway to docker run.

Model responses cut off mid-sentence or the server freezes for a minute.The Linux out-of-memory (OOM) killer terminated the runner process, or the model spilled into disk swap. Run sudo dmesg -T | grep -i "killed process" to check for OOM kills. Switch to a smaller model (llama3.2:3b instead of an 8B or 14B model), or lower the context length (num_ctx) in Open WebUI’s model parameters from 8192 down to 2048.

Token generation is under 1 token per second on a multi-core VPS.Either the model is swapping to disk (check ollama ps and free -h), or Ollama spawned the wrong number of CPU threads for a virtualized host. In Open WebUI’s advanced model parameters, set num_thread to match your VPS’s exact vCPU count.

Port 3000 is reachable from the internet even though UFW denies it.You launched Open WebUI with -p 3000:8080 instead of -p 127.0.0.1:3000:8080. Docker writes its own iptables rules ahead of UFW. Stop and remove the container (sudo docker rm -f open-webui), then run the Step 5 command with 127.0.0.1:3000:8080—your open-webui Docker volume preserves your accounts and chats.

AnythingLLM crashes immediately with “Illegal instruction (core dumped).”Your VPS CPU does not expose the AVX2 instruction set required by LanceDB. Check grep -o avx2 /proc/cpuinfo. If avx2 is missing, switch to a VPS line with modern AMD EPYC or Intel Xeon vCPUs, or use Open WebUI instead.

Questions

Can you self host your own AI?

Yes. On a standard CPU-only Linux VPS with 8 GB to 16 GB of RAM, you can run small open-weight models (1B to 8B parameters, quantized to 4-bit) using Ollama and a browser interface like Open WebUI. Larger 30B to 70B models require a dedicated GPU server or a high-bandwidth local machine.

What is the best self-hosted AI platform?

For a ChatGPT-style web interface over local models, Ollama + Open WebUI is the standard pairing. Pick AnythingLLM (2 GB RAM minimum, AVX2 CPU required) if your primary goal is chatting with uploaded documents, Dify (2 CPU cores and 4 GiB RAM minimum) for visual AI workflows and RAG pipelines, or n8n for connecting AI prompts to scheduled automations and webhooks.

How much RAM do I need to run Ollama on a VPS?

Ollama’s documentation recommends at least 8 GB of RAM for 7B models, 16 GB for 13B models, and 32 GB for 33B models. On an 8 GB VPS, 3B models (llama3.2:3b, qwen2.5:3b) leave comfortable headroom for Ubuntu and Docker; 7B models run best when you step up to a 16 GB plan.

Does self-hosting AI cost less than using an API?

Not for light or occasional use. Entry cloud APIs like OpenAI’s gpt-4o-mini ($0.15 input / $0.60 output per 1M tokens), Anthropic’s Claude Haiku 5.5 ($0.10 input / $0.50 output per MTok), and DeepSeek’s deepseek-flash ($0.15 off-peak input / $0.60 output per 1M tokens) cost pennies for small workloads, while an 8 GB to 16 GB VPS costs $7.92 to $24.00 a month. Self-hosting wins when your prompts cannot leave your own server or when you want a fixed monthly ceiling.

How we checked: The commands, systemd override paths, minimum hardware figures and licence terms in this guide come from each project’s official repository and documentation: Ollama (github.com/ollama/ollama, including the v0.5.7 README memory note and ollama.com/install.sh), llama.cpp (github.com/ggml-org/llama.cpp), LocalAI (github.com/mudler/LocalAI), Open WebUI (github.com/open-webui/open-webui and its LICENSE), AnythingLLM (github.com/Mintplex-Labs/anything-llm and docs.anythingllm.com/installation-docker/system-requirements), Dify (github.com/langgenius/dify and its LICENSE), and n8n (docs.n8n.io), all read on Nov 24, 2026 (n8n read Nov 14, 2026). Cloud API prices were read on Nov 24, 2026 from OpenAI, Anthropic and DeepSeek’s official pricing pages. We did not benchmark token-per-second speeds across every provider’s VPS images for this guide; community threads from r/selfhosted are linked and dated as user reports. VPS plan prices are read daily from each provider’s site, and account terms come from our verified provider records. How we check.

Keep reading