← Blog

How to Run an LLM Locally: A Practical Walkthrough

2026-09-12 · 5 min read · SubToAPI Team

Running an LLM locally means downloading a model's weights and executing inference on your own machine, without sending prompts to a hosted API. The short version: pick a runtime (Ollama is the easiest starting point), pull a quantized model sized to your RAM/VRAM, and start chatting through a local CLI or HTTP endpoint. The rest of this guide covers the actual steps, the hardware math, and where local inference stops making sense.

Running locally gives you full control over data (nothing leaves your machine), no per-token costs, and the ability to work offline. The tradeoffs are real too: local models are almost always smaller and less capable than frontier hosted models, and you're responsible for the infrastructure — updates, GPU drivers, disk space for multiple model versions.

Step 1: Pick a runtime

You don't need to compile anything from source unless you want to. Three options cover almost every use case:

For developers, Ollama is the practical default because it exposes a local HTTP API on localhost:11434 that behaves close enough to other chat completion APIs to slot into existing code.

Step 2: Check your hardware against model size

This is the step people skip and then wonder why everything is slow or crashes. Model size on disk roughly correlates with RAM/VRAM needed to run it, especially at 4-bit quantization:

| Model size | Quantized (4-bit) size | Minimum usable RAM | |---|---|---| | 3B | ~2 GB | 8 GB | | 7–8B | ~4.5 GB | 16 GB | | 13–14B | ~8 GB | 24–32 GB | | 34B+ | ~20 GB | 32–64 GB, GPU recommended |

If you have a discrete GPU with enough VRAM, inference will be dramatically faster than CPU-only. Without one, expect single-digit tokens/second on anything above 7B — usable for testing, painful for interactive use.

Step 3: Install and pull a model

With Ollama installed:

# install (macOS/Linux)
curl -fsSL https://ollama.com/install.sh | sh

# pull a model
ollama pull llama3.1:8b

# run it interactively
ollama run llama3.1:8b

That gives you a chat prompt in the terminal immediately. For programmatic access, Ollama exposes a local API:

curl http://localhost:11434/api/generate -d '{
  "model": "llama3.1:8b",
  "prompt": "Summarize this changelog in three bullets."
}'

This is the same pattern you'd use to wire a local model into a script or app — swap the endpoint, keep the rest of your integration logic.

Step 4: Choose the right quantization

Model files come in different quantization levels (Q4_K_M, Q5_K_M, Q8_0, etc.). Lower quantization = smaller file and faster inference, at the cost of some output quality. For most day-to-day use, Q4_K_M is the sweet spot: noticeably smaller than full precision, minimal quality loss for general tasks. Reserve Q8 or full precision for cases where you're benchmarking output quality specifically.

Step 5: Decide what you're actually optimizing for

Local LLMs make sense when:

Local LLMs are the wrong tool when:

For that last case, a lot of teams end up wanting the reliability and features of a managed API without giving up an existing Claude subscription they're already paying for. SubToAPI turns your Claude access into an HTTPS API with application keys (sub_live_...), streaming, tool use, and usage metadata — useful when local inference has proven the workflow but you need production-grade output quality and multi-user access. You can see the request shape in the quickstart and the messages docs.

curl https://api.subtoapi.app/v1/messages \
  -H "Authorization: Bearer $SUBTOAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-4",
    "max_tokens": 512,
    "messages": [{"role": "user", "content": "Draft a release note from this diff."}]
  }'

A realistic workflow

Most developers end up with a hybrid setup: local models for iteration, drafting, and anything sensitive, hosted models for tasks that need higher accuracy or need to run at scale. Prototype your prompt logic against Ollama locally where iteration is free, then point the same request shape at a hosted endpoint once you need better output quality or you're shipping to real users. If you're already running Claude interactively and want that same model behind an API for your app, signup takes a few minutes, and pricing starts at €9/month for solo use.

Troubleshooting common issues

Do I need a GPU to run an LLM locally?

No. CPU-only inference works fine for smaller models (3B–8B) at modest speeds. A GPU with enough VRAM makes inference significantly faster and lets you run larger models, but it's not required to get started.

What's the easiest way to run an LLM locally?

Install Ollama and run ollama run llama3.1:8b. It handles downloading, quantization, and gives you both a terminal chat and a local API in one step.

Can a local LLM match Claude or GPT-4 quality?

Not currently for complex reasoning, long-context tasks, or coding at a high level. Open-weight models that fit on consumer hardware are good for drafting, extraction, and classification, but frontier hosted models still lead on hard tasks.

Turn your Claude access into an HTTPS API

SubToAPI gives you application API keys, streaming, tool use and usage insights on top of your existing Claude access — set up in minutes.

Start free  Read the quickstart →