Roar AI
Get started
Resources

Self-hosted LLM or API: when to run your own model

What it takes to self-host an open-weight LLM, how much GPU memory and money it needs, and when an API is the better choice, with worked numbers.

In short
  • Self-hosting an open-weight model means renting or buying GPUs with enough memory for it, and running serving software such as vLLM, SGLang, llama.cpp or Ollama.
  • At 16-bit precision a model needs about 2 GB of GPU memory per billion parameters, plus room for the conversation it is working on. Smaller precisions cut that by half or by three quarters.
  • It pays off at steady, very high volume, or when data cannot leave your own machines. For most teams an API costs less, because you pay only for the tokens you use.

Open-weight models, whose makers publish the weights for anyone to run, are now good enough for a large share of real work. That makes running one yourself a real option. The question is whether it is a good one for you: a self-hosted model gives you full control over where data goes, but you take on the hardware, the software and the bill for every hour the GPU is switched on.

This guide covers what self-hosting involves, how much memory and money it takes, and how to decide between your own model and an API. Prices and figures were checked on 28 November 2026.

What self-hosting involves

Running a model yourself takes three things:

  1. A GPU with enough memory to hold the model's weights and the text it is working on. You can rent one by the hour from a GPU cloud or buy your own.
  2. Serving software that loads the model and answers requests. The common choices are vLLM and SGLang for serving many users at once, llama.cpp for running efficiently on modest or mixed hardware, and Ollama for the simplest setup on a single machine. vLLM and llama.cpp both offer an OpenAI-compatible API, so existing code can call them. Hugging Face's TGI, once a common choice, was archived in March 2026.
  3. Someone to run it: to update the model and the software, watch for failures, scale when traffic grows, and keep the machine secure.

How much GPU memory a model needs

The rule of thumb from Hugging Face: at 16-bit precision, a model needs about 2 GB of GPU memory per billion parameters. Storing the weights in 8 bits roughly halves that, and in 4 bits roughly quarters it, usually at a small cost in quality.

On top of the weights, the model keeps a working memory of the conversation, called the KV cache, which grows with the length of the text. For long documents or many users at once it can add tens of gigabytes.

Some current examples, from the makers' own figures:

ModelParametersMemory it needs
GPT-OSS 20B21 billionRuns within 16 GB
GPT-OSS 120B117 billionFits on one 80 GB GPU
Gemma 4 31B31 billionAbout 70 GB at 16-bit, 35 GB at 8-bit, 18 GB at 4-bit, before the KV cache
Qwen 3.5 397B397 billionEight high-memory data-centre GPUs

The GPT-OSS models use a mixture-of-experts design, where only part of the model works on each token. That makes them fast for their size, but all of the weights still have to be in memory.

What it costs

GPU clouds rent by the hour, and the meter runs whether the model is busy or idle. On 28 November 2026, on-demand prices on two well-known GPU clouds were:

GPUMemoryPer hour
NVIDIA H10080 GB$2.89 to $4.89
NVIDIA L40S48 GB$1.09
NVIDIA A1024 GB$1.29
NVIDIA L424 GB$0.69

A single H100 left running all month costs about $2,100 to $3,600, before storage, networking and the time of the person who looks after it. Buying your own hardware lowers the hourly cost over a few years, in exchange for a large upfront price and the work of running a server room or renting space in one.

An API charges per token instead. On the same day, GPT-OSS 120B on Roar AI's price list cost $0.195 per million input tokens and $0.78 per million output tokens. At the usual mix of three input tokens to one output token, one H100's monthly rent buys about six billion tokens, roughly 200 million tokens every day, before the self-hosted machine has done anything at all. Below that volume the API is cheaper; above it, a busy, well-run GPU can win. To price your own volume on an API, try the token and API cost calculator.

When self-hosting makes sense

  • Data that cannot leave your own machines, by law, by contract or by policy.
  • Steady, very high volume that keeps a GPU busy around the clock.
  • A fine-tuned or custom model that no API offers.
  • Offline or isolated environments, such as a factory floor or a secure network without internet access.

When an API makes sense

  • Usage that varies. Most apps are quiet at night and busy in bursts, and an API charges nothing for the quiet hours.
  • More than one model. Trying a new model on an API is a change of name; self-hosting it means new hardware and new setup.
  • Frontier models. GPT, Claude and Gemini are only available through APIs.
  • No one to run servers. Every self-hosted model is a system someone has to keep running.

A middle ground: an open model hosted in your country

Many teams look at self-hosting because their data has to stay in the country, not because they want to run servers. An API that runs the model in that country covers the same need without the hardware.

Some API providers, Roar AI among them, run open models on their own hardware inside a particular country, billed per token like any other model. Each Roar AI model page states where its requests are processed, so you can check before you choose. One Roar AI key reaches 200+ models, including GPT-OSS, Llama, Gemma and Qwen, so work that does not need to stay in the country can use whichever model suits it. Our guide to AI data residency covers how to decide what has to stay where.

Questions people ask

What is a self-hosted LLM?

A self-hosted LLM is an open-weight language model that you run on GPUs you control, rented or owned, using serving software such as vLLM, SGLang, llama.cpp or Ollama, instead of calling a provider's API.

How much GPU memory do I need to run an LLM?

About 2 GB per billion parameters at 16-bit precision, half that at 8-bit and a quarter at 4-bit, plus extra for the text the model is working on. GPT-OSS 20B runs within 16 GB, and GPT-OSS 120B fits on one 80 GB GPU.

Is self-hosting an LLM cheaper than using an API?

Only at steady, very high volume. A rented H100 costs about $2,100 to $3,600 a month whether it is busy or not. At API prices for a comparable open model, that buys several billion tokens a month, which is more than most apps use.

Can I keep AI data in my country without self-hosting?

Yes, by using a model that an API runs in your country. Check where each model’s requests are processed before you send it data that has to stay put; every Roar AI model page states it, and there is no hardware to run.

Start building
in minutes

Get a key, call any model, ship your app. Pay in your local currency.