How to self-host an LLM, and the best tools to do it

An 8-step method to run an open model on hardware you control, seven deployment tools compared, and the defaults and invoices that catch first deployments out.

Short answer: pick an open model whose license fits your use, check it fits in your GPU's memory, run it with Ollama on one machine or vLLM for many users, and never expose the API to the internet without authentication. llama.cpp runs on CPUs and small GPUs; Hugging Face Inference Endpoints gives you a dedicated GPU without servers to run; LM Studio is the desktop app; SGLang suits agent and RAG traffic; LocalAI replaces OpenAI calls on CPU servers.

The software is free in six cases out of seven. What costs money is the GPU, and what breaks first deployments is rarely the tool: a context window cut to 4k tokens, an API left open, a license that forbids your use. We compared the tools the top guides rank, read their documentation, licenses and pricing pages, and wrote the method that avoids those traps.

Romain Cochard
Romain CochardCEO of Hack'celeration
Updated 20267tools compared8method steps8traps and tips

The ranking is editorial: a sponsored place is always flagged on its card, and no affiliate link changes a score.

The basics

What a self-hosted LLM is, and 7 tools side by side

What a self-hosted LLM is. A self-hosted LLM is an open-weight large language model (Llama, Qwen, Mistral, DeepSeek, gpt-oss) that runs on hardware you control: your laptop, a server in your office, or a GPU you rent by the hour. Your prompts and documents go to that machine and nowhere else, there is no per-token bill, and the model keeps working offline. You trade an API key for a GPU to size, software to run and a server to secure.

How it works. Four layers stack up. The hardware holds the model in memory: the weights must fit in GPU memory (VRAM), or the model spills to the CPU and slows to a crawl. The model is a file of weights, often quantized, meaning stored in 4 or 8 bits instead of 16 so it takes a quarter or half the memory. The inference engine loads the weights and generates text, one token (a word piece, about three quarters of an English word) at a time; this step is called inference. On top, an API compatible with OpenAI lets your apps, scripts and chat interfaces talk to it as if it were ChatGPT.

What to demand from a tool. Five things: an OpenAI-compatible API so you change one URL and nothing else, support for the models and quantized formats you need, decent throughput when several users ask at once, a license that allows your use, and clear defaults (context length, network binding, memory) you can change. Other names in the guides: Hugging Face TGI, now in maintenance mode, whose makers recommend vLLM and SGLang instead; NVIDIA's TensorRT-LLM, partly under an NVIDIA license rather than Apache 2.0; and Jan, an Apache 2.0 desktop chat app in the same niche as LM Studio. If you would rather not host anything, compare our ranking of LLM APIs.

Best forFree planTeam sizeVisit
1OllamaBest way to run your first self-hosted LLM4.5/5Free and unlimited on your own hardware (MIT) · cloud models: Pro $20/mo, Max $100/mo, Team $500/mo✓Solo developers to small teamsVisit →
2vLLMBest for serving many users from your own GPUs4.4/5Free (Apache 2.0) · you pay the GPU, e.g. an H100 PCIe at $2.89/hr on RunPod✓Teams serving dozens to thousands of usersVisit →
3llama.cppBest for CPUs, small GPUs and full control4.3/5Free (MIT) · runs on hardware you already own✓CPU servers, edge devices, tinkerersVisit →
4Hugging Face Inference EndpointsBest managed way to deploy an open model on a dedicated GPU4.3/5From $0.033/hr (CPU) · NVIDIA L4 $0.70/hr · A100 $2.50/hr · H200 $5/hr · billed by the minute—Teams without an ops engineerVisit →
5LM StudioBest desktop app to run models without the command line4.1/5Free for home and work · Bionic+ $20/mo · Pro $100/mo (cloud models)✓Individuals and non-technical teamsVisit →
6SGLangBest for agents and RAG traffic that reuse long prompts4.1/5Free (Apache 2.0) · you pay the GPU, e.g. an A100 PCIe at $2.09/hr on RunPod✓Production teams with agents or RAGVisit →
7LocalAIBest drop-in replacement for the OpenAI API on CPU servers3.9/5Free (MIT) · no GPU required✓Developers replacing OpenAI callsVisit →

Scores out of 5, the plain average of the five criteria on each card. Prices in US dollars; GPU prices are per hour of rental, plans are monthly unless stated.

Is your tool missing from this page? Email us: hello@hackceleration.com

1
Best way to run your first self-hosted LLM

Ollama

4.5/5

Ollama is a single install that downloads a model, loads it on your GPU (or CPU) and serves it on a local API at localhost:11434. One command pulls the weights, a second starts a chat, and any OpenAI client can talk to it by changing its base URL. It handles quantized GGUF models, picks sensible defaults for your hardware and unloads a model after 5 minutes without requests to free memory. The code is MIT-licensed, and running models on your own machine is free and unlimited.

Ollama now sells cloud models too: Pay as you go at $0 plus tokens, Pro at $20 a month (or $200 a year) with $60 of usage credits, Max at $100 with $300 of credits, and Team at $500 a month with unlimited users and $1,000 of shared credits. Those plans run models on Ollama's servers, primarily in the United States with overflow to Europe, which is no longer self-hosting. Keep the distinction in mind if privacy is why you are here. It plugs straight into automation tools: our guides to the n8n Ollama node and the Ollama Chat Model node show how, and the Embeddings Ollama node turns your documents into vectors for a RAG pipeline.

The limits show when several people share one server. Most backends process one request at a time by default, and in a 2025 benchmark on a single A100, vLLM peaked at 793 tokens per second against 41 for Ollama under load. Two defaults also surprise people: the context window and the open API, both covered in the traps below.

Standout features
  • One command from download to a running model
  • Local API compatible with OpenAI clients
  • Free and unlimited on your own hardware
+Pros
  • ✓Install in minutes on macOS, Windows or Linux
  • ✓Library of ready-to-run quantized models
  • ✓MIT license, free local use
−Cons
  • ✗Default context of 4k tokens on GPUs under 24 GiB
  • ✗Built for one user at a time, not for dozens
  • ✗Local API has no authentication
Verdict

Start here. Move the busy workloads to vLLM once more than a handful of people hit the same server.

Get Ollama →
2
Best for serving many users from your own GPUs

vLLM

4.4/5

vLLM is the open-source engine built for production serving. Its PagedAttention manages the attention key and value memory (the KV cache) in pages, and continuous batching slots new requests into the GPU as soon as there is room, so a single card serves many conversations at once. It exposes an OpenAI-compatible server, plus the Anthropic Messages API and gRPC, and runs on NVIDIA, AMD and Intel GPUs as well as CPUs. It is Apache 2.0 and free.

What you pay is the hardware. Renting, an H100 PCIe costs $2.89 an hour on RunPod's Secure Cloud and an A100 PCIe $2.09, billed per second; see our ranking of GPU cloud providers for other options. vLLM loads full-precision weights from Hugging Face (or AWQ and GPTQ quantized versions), splits a model across GPUs with tensor_parallel_size, and lets you cap the context with max_model_len to save memory.

The cost is setup and patience. A practitioner on a public forum in 2026 reported that vLLM took more than four minutes to load on two RTX 3090 cards and served a single request 3 tokens per second slower than the llama.cpp setup it was meant to replace: the engine shines with many users, not with one.

Standout features
  • PagedAttention and continuous batching
  • OpenAI and Anthropic compatible APIs
  • NVIDIA, AMD, Intel GPUs and CPUs
+Pros
  • ✓Far more throughput than Ollama under concurrent load
  • ✓Apache 2.0 and free
  • ✓Splits large models across several GPUs
−Cons
  • ✗Python environment and GPU drivers to manage
  • ✗Reserves most of the GPU memory by default
  • ✗Slower to start, no gain for a single user
Verdict

The engine to run when an open model serves real traffic. Overkill for a laptop.

Get vLLM →
3
Best for CPUs, small GPUs and full control

llama.cpp

4.3/5

llama.cpp is the C/C++ engine underneath much of local AI: Ollama and LM Studio both run models through it. It reads GGUF files, the format that packs a quantized model into one file, and runs them on CPUs, Apple silicon and consumer GPUs, offloading as many layers to the GPU as fit. Its built-in server launches an OpenAI-compatible API from one command. It is MIT-licensed and free.

Using it directly instead of through Ollama gives you every knob: the quantization level, the number of GPU layers, the context size and batch sizes. The price is that you assemble the rest yourself: picking the right GGUF file, a service to keep it running, and an API key, since the server's --api-key flag is off by default.

Standout features
  • Runs on CPU, Apple silicon and small GPUs
  • Every quantization level and setting exposed
  • OpenAI-compatible server built in
+Pros
  • ✓Small footprint, runs on CPUs and laptops
  • ✓MIT license
  • ✓Can run as the engine behind your own service
−Cons
  • ✗You manage model files and updates yourself
  • ✗Less throughput than vLLM with many users
  • ✗You build the service around it
Verdict

Pick it for CPU servers, edge devices or when you want to tune everything Ollama hides.

Get llama.cpp →
4
Best managed way to deploy an open model on a dedicated GPU

Hugging Face Inference Endpoints

4.3/5

Inference Endpoints deploys a model from the Hugging Face Hub onto a dedicated instance in AWS or Google Cloud (Azure offers CPU instances only), with vLLM, SGLang, llama.cpp or TGI as the engine and an HTTPS endpoint in front. You choose the model, the GPU and the region; Hugging Face runs the machine. The model weights and the instance are yours alone, which makes it the middle ground between a shared API and a server in your own rack. We gave it the score of our Hugging Face review.

Prices start at $0.033 an hour on CPU. A single NVIDIA L4 (24 GB) costs $0.70 an hour on Google Cloud ($0.80 on AWS), an A100 (80 GB) $2.50 on AWS and an H200 (141 GB) $5 on AWS. Prices are shown by the hour but billed by the minute, and an endpoint can scale to zero when idle. A busy A100 left on all month costs about $1,825, which is the number to compare with an API bill, or with the token-billed hosts in our ranking of inference providers.

Standout features
  • Dedicated GPU, no shared traffic
  • vLLM, SGLang, llama.cpp or TGI under the hood
  • Billing by the minute, scale to zero
+Pros
  • ✓Deploy from the Hub in a few clicks
  • ✓No drivers, containers or clusters to run
  • ✓Dedicated GPUs on AWS or Google Cloud
−Cons
  • ✗An H100 costs twice an H200 here
  • ✗Scale-to-zero means cold starts and 503 errors
  • ✗Data still leaves your own network
Verdict

The quickest way to get a private GPU endpoint without becoming an ops team. Watch the instance type.

Deploy on Hugging Face →
5
Best desktop app to run models without the command line

LM Studio

4.1/5

LM Studio is a desktop app for macOS, Windows and Linux: you search a model, download it and chat with it, all from a window. It runs models through llama.cpp and, on Apple silicon, through MLX. A local server mode exposes the loaded model on an OpenAI-compatible API, and a command-line tool (lms) scripts it. It is free at home and at work, with no form to fill.

The app now also sells cloud models under the Bionic name: Free at $0 for local models, Bionic+ at $20 a month and Pro at $100 a month for cloud models hosted in the US. Read the license before you build on it: the app is closed source, licensed for personal and internal business use, and its terms forbid using it as a service bureau, an application service provider or a software-as-a-service. Fine for your own team, not for a product you sell.

Standout features
  • Visual model search and chat
  • llama.cpp and MLX engines
  • Local OpenAI-compatible server
+Pros
  • ✓Easiest start for non-technical users
  • ✓Free for work use
  • ✓MLX engine for Apple silicon
−Cons
  • ✗Closed source app
  • ✗Terms rule out serving customers through it
  • ✗Built for one person at a desk, not a shared server
Verdict

The friendliest way to run a model on a laptop. Swap it for Ollama or llama.cpp before you serve anyone outside your team.

Get LM Studio →
6
Best for agents and RAG traffic that reuse long prompts

SGLang

4.1/5

SGLang is a high-performance serving framework for language and multimodal models, hosted by the non-profit LMSYS and Apache 2.0. Its RadixAttention keeps shared prompt prefixes in cache, so the long system prompt or retrieved context that thousands of requests repeat is computed once. It exposes OpenAI-compatible APIs, splits models across GPUs, and runs on NVIDIA and AMD GPUs, TPUs and more. The project says it runs on more than 400,000 GPUs worldwide.

It sits in the same league as vLLM, and the choice between them is usually made on your own traffic: run both on your model, your GPU and your real prompts before committing. Setup takes real work: expect to read documentation and pin versions.

Standout features
  • RadixAttention prefix caching
  • OpenAI-compatible APIs
  • GPUs, TPUs, NPUs and Apple silicon
+Pros
  • ✓Strong on agent and RAG workloads with shared prefixes
  • ✓Apache 2.0 and free
  • ✓Backed by LMSYS, used at very large scale
−Cons
  • ✗Steep setup: documentation and pinned versions
  • ✗Smaller community than vLLM
  • ✗Pointless for a single user on a laptop
Verdict

A production engine worth benchmarking against vLLM when your prompts repeat a long prefix.

Get SGLang →
7
Best drop-in replacement for the OpenAI API on CPU servers

LocalAI

3.9/5

LocalAI is an MIT-licensed engine that runs on a laptop, a server, in a container or on Kubernetes, and answers in the OpenAI and Anthropic API formats. A GPU makes it faster but is not required. It wraps more than 80 backends (llama.cpp, transformers, vLLM, speech and image engines), so one endpoint can cover chat, embeddings, transcription and image generation.

That breadth is its pull and its weakness: performance depends on the backend you pick, and tuning it means understanding the engine underneath. For pure text generation at scale, vLLM or SGLang go further; for one API that replaces several OpenAI endpoints on modest hardware, LocalAI is the shortest path.

Standout features
  • OpenAI and Anthropic API formats
  • More than 80 backends
  • Runs without a GPU
+Pros
  • ✓Text, embeddings, speech and images behind one API
  • ✓MIT license
  • ✓Container and Kubernetes ready
−Cons
  • ✗Speed depends on the backend you choose
  • ✗Lower throughput than dedicated engines
  • ✗Name and logo excluded from the MIT license
Verdict

Use it to swap OpenAI calls for a self-hosted endpoint without rewriting your code.

Get LocalAI →
The method

How to self-host an LLM, in 8 steps

The same steps work for a laptop experiment and a GPU server shared by a whole company; only the engine and the hardware change.

01

1. Decide why you self-host, and do the math

Three reasons hold up: data that must not leave your network, work that must run offline, and a volume high enough to beat per-token prices. Cost alone rarely wins at small scale. An H100 PCIe rented around the clock on RunPod costs $2.89 an hour, about $2,109.70 a month. The same open model, gpt-oss-120b, costs $0.15 per million input tokens and $0.60 per million output tokens on Ollama's cloud: 2 million tokens in and 1 million out every day comes to about $27 a month. The rented GPU only pays off at volumes far beyond that, or when privacy decides for you.

Example
$2,109.70 vs $27 a month
02

2. Pick the model, and read its license

Choose the smallest model that does your task well, and read its license before anything else, because "open" covers very different terms. Qwen3 and Mistral Small 3.1 are Apache 2.0, DeepSeek-R1 is MIT, and OpenAI's gpt-oss models are Apache 2.0. Llama is not: its community license requires a separate license from Meta above 700 million monthly active users, a visible "Built with Llama" mention, and "Llama" at the start of the name of any model you derive from it.

Check first
the license, not the leaderboard
03

3. Size the hardware from the model's memory

The weights must fit in VRAM. A rough rule: parameters times bytes per parameter. At 16 bits (2 bytes) an 8B model needs about 16 GB, a 70B model about 140 GB. At 4 bits (half a byte) the 70B model drops to about 35 GB, plus room for the KV cache, which grows with context length and the number of simultaneous users. gpt-oss-20b runs within 16 GB of memory. Renting is the cheap way to find out what you need: an A100 PCIe costs $2.09 an hour on RunPod, billed per second, and our list of cheap GPU clouds goes lower. Our guide to GPUs for AI inference and our dedicated GPU servers page go further.

70B model
~140 GB at 16-bit, ~35 GB at 4-bit
04

4. Choose the format and quantization

Two families of files. GGUF packs a quantized model in one file and is what llama.cpp, Ollama and LM Studio run; it is the right choice for CPUs, Macs and single GPUs. Full weights in safetensors (or AWQ and GPTQ quantized versions) are what vLLM and SGLang load for GPU serving. Start at 4-bit or 8-bit quantization: moderate quantization keeps most of the quality, aggressive levels hurt reasoning and math first.

Start with
4-bit or 8-bit
05

5. Start the engine and its API

On one machine: install Ollama, pull a model and it already serves an API on port 11434; point any OpenAI client at it by changing the base URL (the client wants an API key value, and Ollama ignores it). For a shared GPU server: install vLLM in a Python environment and start vllm serve with the model name; it answers on an OpenAI-compatible endpoint. Run it in a container with a restart policy so it comes back after a reboot.

API
OpenAI-compatible in all 7 tools
06

6. Set the context length and concurrency on purpose

Defaults are tuned for a laptop, not for your workload. Ollama gives a 4k-token context on GPUs under 24 GiB of VRAM, 32k between 24 and 48 GiB; agents, coding tools and RAG need far more, and you raise it with OLLAMA_CONTEXT_LENGTH. In vLLM, cap max_model_len to the context you really use: a smaller cap leaves more memory for simultaneous requests. Then load-test with as many parallel users as you expect.

Ollama default
4k tokens under 24 GiB VRAM
07

7. Lock the server down

Ollama binds to 127.0.0.1 by default for a reason: its local API requires no authentication. If you change OLLAMA_HOST to reach it from other machines, put a reverse proxy with HTTPS and an API key in front, or keep it on a private network or VPN. In 2025, a scan found 1,139 Ollama instances open to the internet, about 18.8% of them actively serving models to anyone. vLLM takes an --api-key flag; set it.

Exposed instances found
1,139
08

8. Add an interface, then measure quality

Most teams put Open WebUI in front of Ollama or vLLM to get a ChatGPT-like interface with users, history and document upload. Its license (since version 0.6.6) is BSD-3 plus a branding clause: you may rebrand it only for 50 or fewer users in a 30-day period, and it is not an OSI-approved open source license. Before switching users over, score the self-hosted model on your own questions; our guide on how to evaluate LLM answers gives the method, and our LLM observability tools trace it in production.

Open WebUI rebranding
50 users or fewer per 30 days
Traps and tips

8 traps and tips the guides leave out

What we found reading the documentation, licenses and pricing pages to the bottom, plus what practitioners report on public forums.

01

Ollama cuts long prompts to fit 4k tokens

On a GPU with less than 24 GiB of VRAM, Ollama's default context is 4k tokens. A RAG prompt with a few retrieved pages, or an agent with its tool list, overflows it and the start of the conversation is dropped. A developer on a public forum in 2025 reported messages silently dropped instead of an error. Set OLLAMA_CONTEXT_LENGTH (64000 for agents and coding tools) and check memory still fits.

Default
4k tokens
02

The local API answers anyone who can reach it

The Ollama API has no login. Binding it to 0.0.0.0 on a cloud server publishes your GPU to the internet; a 2025 scan counted 1,139 such instances. Keep the default bind, or front it with a proxy that checks a key.

Scan result
1,139 open instances
03

On Hugging Face, an H100 costs twice an H200

Inference Endpoints lists the H100 (80 GB) only on Google Cloud at $10 an hour, and the H200 (141 GB) on AWS at $5 an hour. The bigger, newer card costs half as much, so check the H200 before you pick an H100 by habit. Billing is by the minute.

Difference
$5 an hour
04

Scale-to-zero answers with errors while it wakes up

An endpoint with scale-to-zero turned on goes to zero replicas after an hour without requests by default, and after as little as 15 minutes if you set it so. The next request triggers a cold start, the proxy answers with an error (503, or 502) while the replica boots, and the request is not held unless it carries an X-Scale-Up-Timeout header. Add that header or retries on the client, or keep one replica for anything users wait on.

Idle delay
1 hour by default
05

A stopped RunPod pod still bills its disk, at double rate

On RunPod, a volume disk costs $0.10 per GB a month while the pod runs and $0.20 when it is idle. Model weights take room: 100 GB of models on a stopped pod cost $20 a month for nothing. Keep weights on network storage or delete idle pods; our RunPod pricing breakdown lists the other storage tiers.

100 GB idle
$20 a month
06

vLLM takes almost the whole GPU

By default vLLM reserves nearly all GPU memory for itself (the fraction is set by --gpu-memory-utilization, between 0 and 1). A second model or an embedding service on the same card then fails to load. Lower the fraction to share a GPU.

Setting
--gpu-memory-utilization
07

LM Studio cannot power a product you sell

LM Studio is free at work, but its terms limit use to personal and internal business purposes and forbid use as a service bureau, an application service provider or a software-as-a-service. Prototype on it, then serve customers with Ollama, llama.cpp or vLLM, which are MIT or Apache 2.0.

Allowed
personal and internal use
08

Ollama's cloud credits do not roll over

If you mix local models with Ollama's cloud for the heavy ones, the Pro plan's $60 of monthly credits reset each month and unused credit is lost. Paying $200 a year instead of $20 a month saves $40, and the annual plan still resets credits monthly. Pro also caps cloud use at 3 concurrent requests; Max and Team allow 10.

Annual saving
$40 a year
FAQ

Self-hosted LLMs: your questions

  • Can I run an LLM without a GPU?

    Yes, with llama.cpp, Ollama or LocalAI on CPU, but expect a few tokens per second on larger models. Small models work best: gpt-oss-20b runs within 16 GB of memory, and 4-bit 7B to 8B models fit in a few gigabytes. For a team, rent a GPU by the hour rather than queueing everyone on a CPU.

  • Is Llama open source?

    Not in the OSI sense. Llama ships under Meta's community license, which allows commercial use but asks companies above 700 million monthly active users to request a separate license, requires a "Built with Llama" mention, and puts "Llama" at the start of derived model names. If you need a permissive license, Qwen3 and Mistral Small 3.1 are Apache 2.0 and DeepSeek-R1 is MIT.

  • How much VRAM do I need for a 70B model?

    About 35 GB for the weights at 4-bit, plus several gigabytes of KV cache, so a 48 GB card or two 24 GB cards in practice. At 16-bit the weights alone need about 140 GB, which means two 80 GB GPUs or one H200 (141 GB), rented at $5 an hour on Hugging Face Inference Endpoints.

  • Can Ollama serve a whole team?

    For a handful of users, yes; for dozens, it becomes the bottleneck. In a 2025 benchmark on one A100 40 GB with Llama 3.1 8B, at concurrency levels from 1 to 256, vLLM peaked at 793 tokens per second and Ollama at 41. Most Ollama backends handle one request at a time unless you raise OLLAMA_NUM_PARALLEL.

  • Can I run a self-hosted LLM in Docker?

    Yes. Ollama publishes an official image, ollama/ollama: on a CPU-only machine a single docker run starts it, with port 11434 mapped and a volume that keeps downloaded models across restarts. For an NVIDIA GPU, install the NVIDIA Container Toolkit on the host first and add --gpus=all; AMD GPUs use the rocm image tag. LocalAI also ships separate GPU images, for example for NVIDIA CUDA 12 and 13, so pick the tag that matches your driver.

  • What happened to Hugging Face TGI?

    Text Generation Inference is in maintenance mode: it only receives minor bug fixes and documentation updates. Hugging Face recommends vLLM and SGLang for serving, and llama.cpp or MLX for local engines. Existing deployments keep working; new ones should start on vLLM.

  • Can I give my team a private ChatGPT on a self-hosted model?

    Yes. Open WebUI in front of Ollama or vLLM gives users accounts, chat history and document upload, deployed with Docker Compose. Keep its branding visible if more than 50 people use it in a 30-day period, or buy its enterprise license to rebrand.

  • Can I fine-tune a self-hosted model?

    Yes, and many teams fine-tune a small LoRA adapter rather than the whole model. One developer reported in 2026 moving from paid APIs to self-hosted Qwen, Gemma and Llama models with LoRA adapters, quantized from 16 GB to under 5 GB, and gating every model swap on a frozen evaluation set. vLLM can load LoRA adapters at serving time.

Hack'celeration Labs

The next AI infrastructure guide, in your inbox

New comparisons of AI and automation tools, as soon as they are published.

No spam. Unsubscribe anytime.