Maxinames
All articles
Cloud Servers11 min read

Self-Host Your Own AI: Running Open-Source LLMs on a Cloud Server

When does it make sense to run Llama or Mistral yourself instead of paying per-token to OpenAI? A practical guide to specs, tools, security, and cost — with real numbers.

Glowing server hardware in a darkened rack

The economics of running your own large language model have shifted dramatically in the last 18 months. Open-source models like Llama 3.3, Mistral Small 3, and Qwen 2.5 now match GPT-3.5 quality on most everyday tasks. They run on commodity hardware. And a single Cloud Server can serve thousands of requests per month for less than a typical mid-volume OpenAI bill. This guide is the practical case for and against self-hosting in 2026, with real numbers and a step-by-step path if you decide to do it.

When self-hosting is worth it

  • Cost predictability. Per-token pricing punishes long context and chat-style applications. A flat-rate server is often cheaper from around 5–10 million tokens per month upward.
  • Privacy and compliance. Customer data, internal documents, regulated industries — anything you don't want to send to a third-party API.
  • Latency. Round-trips to a US-hosted API average 200–500 ms. A model running in your own region serves the first token in under 100 ms.
  • No rate limits. Spike traffic that breaks an OpenAI tier just queues against your own server.
  • Customization. Fine-tuning, custom system prompts, embedding pipelines, function-calling tools — full control over the stack.

When you should not self-host

  • You need GPT-4-level quality on hard reasoning tasks. The biggest open models close most of the gap, but the frontier closed models are still ahead on the hardest benchmarks.
  • You serve fewer than 100,000 tokens per month. The hosted APIs win on cost at low volume.
  • Nobody on the team is comfortable maintaining a Linux server.
  • You need image generation, voice, or other multimodal output that open-source ecosystems still lag behind on.

Picking a model size

Open-source LLMs are sized in billions of parameters (1B, 3B, 7B, 13B, 32B, 70B, etc.). Bigger isn't always better — for many production use-cases an 8B model with good prompting beats a generic 70B. Rough guide:

  • 1B–3B — Classification, simple summaries, autocomplete. Runs on any modern CPU.
  • 7B–8B — Conversational chat, RAG retrieval-augmented Q&A, code completion. The sweet spot for most production deployments. Requires 16+ GB RAM on CPU, runs comfortably on a small GPU.
  • 13B–14B — Better reasoning, longer context handling. Needs ~32 GB RAM on CPU, or an entry GPU.
  • 32B–34B — GPT-3.5-class performance for most tasks. GPU territory; CPU runs but is too slow for real-time use.
  • 70B+ — Best open-source quality, approaches GPT-4 on many tasks. Requires multiple GPUs or a single high-memory accelerator. Typically rented from a GPU host rather than self-managed.

Hardware: CPU vs GPU

GPUs are dramatically faster for inference but also dramatically more expensive. The decision hinges on response time and concurrency.

CPU inference

Modern AVX-512 CPUs run quantised 7B models at 5–15 tokens per second per request. That feels slow in a chat UI but is fine for batch jobs, async pipelines, and embedding generation. A 4-vCPU / 8 GB Cloud Server can serve a quantised 7B model usefully. An 8 vCPU / 16 GB server handles concurrent users on a 7B model or a single user on a 13B.

GPU inference

An NVIDIA L4 or A10 produces 50–100 tokens/sec on a 7B model — comfortable for real-time chat with tens of concurrent users. Higher-end cards (L40S, H100) push the same model toward 200+ tokens/sec and serve hundreds of concurrent users. For self-hosted production-grade chat, you almost always want a GPU.

Choosing your inference tool

  • Ollama — Easiest to get started. One-line install, REST API on port 11434, model library you can pull like Docker images. Best choice for prototyping and small production loads.
  • llama.cpp — The bare-metal C++ engine that powers most CPU-inference deployments. More setup, but maximum control over quantisation and threading. Worth it if you're squeezing performance out of CPU.
  • vLLM — High-throughput GPU server with continuous batching. The choice for production GPU deployments serving many concurrent users.
  • LM Studio — Desktop app, useful for experimentation but not a server tool.

Quick start: Ollama on a Cloud Server

If you're new to self-hosting, this is the fastest way to get a usable API:

  1. Provision a Cloud VPS Standard (2 vCPU / 4 GB) for prototyping or Business (4 vCPU / 8 GB) for serious use.
  2. SSH in and run: curl -fsSL https://ollama.com/install.sh | sh
  3. Pull a model: ollama pull llama3.2:3b (small, fast) or ollama pull llama3.1:8b (better quality).
  4. Test it: ollama run llama3.1:8b "Write a one-line Python function that reverses a string"
  5. Bind the API to your network interface and protect it with a reverse proxy (nginx + basic auth, or behind your VPN).

From your application, the API is OpenAI-compatible — point your existing OpenAI client at http://your-server:11434/v1 and most code works without changes.

Security checklist

  • Never expose Ollama directly on a public IP without authentication. The default install listens on localhost; if you change that, put nginx with a token in front.
  • Rate limit per IP at the proxy. A misconfigured client can melt CPU inference in minutes.
  • Log prompts and completions if your jurisdiction requires audit trails. Open them up to compliance review the same way you would any data store.
  • Update Ollama and your model files monthly. Open-source models receive frequent quality and safety updates.
  • Run the inference process under a dedicated user, not root.

Real-world cost comparison

Indicative numbers for a hypothetical mid-volume use case (5 million input + 5 million output tokens per month, mixed chat + RAG):

  • OpenAI GPT-4o-mini API: ~$15–20/month. Lowest setup cost, no maintenance.
  • OpenAI GPT-4o API: ~$200–300/month at the same volume.
  • Self-hosted Llama 3.1 8B on Cloud VPS Business ($54/mo): $54/month flat. Comparable quality to GPT-3.5 / GPT-4o-mini for most tasks, comfortable for the volume above on CPU.
  • Self-hosted Llama 3.3 70B on a rented GPU ($300–600/mo): approaches GPT-4 quality. Becomes worth it past ~25 million tokens per month.

The crossover point depends on your task. For chat replacement at GPT-4o-mini quality, the OpenAI API is hard to beat at low volume. For specialised pipelines where you'd otherwise pay for full GPT-4, self-hosting wins above modest volumes.

Where to start

If you're new to this, provision a Cloud VPS Standard ($26/mo), install Ollama, pull Llama 3.2 3B, and spend an evening pointing your existing application at it. The cost of finding out is minimal. If it works for your use case, scale up; if it doesn't, you've spent less than a few weeks of OpenAI credits to get the data you needed.

Ready to put this into practice?

Search for your domain, pick a hosting plan, or talk to our team.