AI Coding

How to Run an AI Model Locally on Your Laptop (Free, Offline)

Every prompt you send to a cloud chatbot leaves your machine. Your code, your notes, that half-finished contract. For a lot of people that’s fine. For some, it’s the reason they can’t use AI at work at all. That’s why more people now want to run an AI model locally.

There’s another option. You can download an open-weight model and run it on your own laptop, offline, for free. Two apps make this easy in 2026: Ollama and LM Studio.

Here’s what your hardware needs, how to get a model running in a few minutes, and the honest trade-off nobody puts in the headline.

Ollama or LM Studio?

Both are free, both run on Windows, macOS and Linux, and both use the same idea: download a model file, load it into memory, chat with it. The difference is mostly how you like to work.

Ollama vs LM Studio comparison for running AI models locally
OllamaLM Studio
Main interfaceApp plus terminal commandsDesktop app with a chat window
Finding modelsollama.com/library, by nameBuilt-in Discover tab with search
Local APIlocalhost:11434Local server (docs use port 1234)
Command lineollama run, ollama pslms get, lms server start
CostFree, MIT-licensedFree for home and work

Our pick: LM Studio if you just want to chat with a model and never open a terminal. Ollama if you want to call the model from your own code or plug it into other tools. LM Studio has been free for work use since July 2025, and Ollama’s GitHub repository is MIT-licensed.

Local LLM hardware requirements: will it run on your laptop?

This is where most guides wave their hands. Here’s what the official docs actually say.

LM Studio’s requirements page asks for an Apple Silicon Mac (M1 or later) on macOS 14 or newer, with 16 GB of RAM recommended, though 8 GB Macs “may still work” with smaller models. On Windows it needs a CPU with AVX2 support, recommends at least 16 GB of RAM, and suggests 4 GB or more of dedicated video memory. On Linux it wants Ubuntu 20.04 or newer.

Ollama’s Windows page lists Windows 10 22H2 or newer, NVIDIA driver 551.61 or newer if you have an NVIDIA card, and at least 4 GB of disk space for the app itself. Models are extra, and the docs warn they can take “tens to hundreds of GB.”

The simple rule: the model has to fit in memory. On a Mac with Apple Silicon, that’s your unified memory. On a PC, it’s ideally your graphics card’s VRAM, with system RAM as a slower fallback. A model’s download size is a decent first hint of how much memory it’ll need, and you’ll want headroom on top for the conversation itself.

To make that concrete, here’s Google’s Gemma 4 family on the Ollama library page:

Gemma 4 model download sizes in Ollama for running AI locally
Ollama tagDownload sizeContext window
gemma4:e2b4.6 to 7.5 GB128K
gemma4:e4b6.6 to 9.5 GB128K
gemma4:12b7.7 to 8.0 GB256K
gemma4:26b16 to 19 GB256K
gemma4:31b19 to 20 GB256K

So a 16 GB laptop is comfortable with the small tags. The 26B and 31B versions really want a 32 GB machine or a big graphics card.

How to run an AI model locally with Ollama

Steps to run an AI model locally with Ollama
  1. Install it. Download the app from ollama.com. On Windows that’s OllamaSetup.exe, which installs without admin rights. On Linux the repo gives curl -fsSL https://ollama.com/install.sh | sh.
  2. Run a model. Open a terminal and type ollama run gemma4:e2b. The quickstart uses this exact model. The first run downloads it, then you’re in a chat.
  3. Chat. Type a question, press Enter. Type /bye to leave.
  4. Check it’s using your GPU. In a second terminal, run ollama ps. The Processor column shows “100% GPU”, “100% CPU” or a split. If you see a lot of CPU, the model is too big for your graphics memory, so try a smaller tag.

On Windows, models land in %HOMEPATH%\.ollama by default. If your C: drive is small, set the OLLAMA_MODELS environment variable to another folder before you download anything big, then restart Ollama.

Step by step with LM Studio

Install LM Studio from lmstudio.ai. Open the Discover tab, search for a model (try “gemma” or “qwen”), and download one that fits the memory you have. Then go to the Chat tab, open the model loader at the top, pick the model, and start typing. LM Studio’s basics guide walks through the same flow with screenshots.

Call your local model from code

This is where Ollama shines. It runs a small API server on http://localhost:11434, so any script can talk to the model. Here’s a version in plain Python with no extra packages:

import json
import urllib.request

body = {
    "model": "gemma4:e2b",
    "messages": [{"role": "user", "content": "Explain recursion in one sentence."}],
    "stream": False,
}
req = urllib.request.Request(
    "http://localhost:11434/api/chat",
    data=json.dumps(body).encode(),
    headers={"Content-Type": "application/json"},
)
with urllib.request.urlopen(req) as resp:
    print(json.load(resp)["message"]["content"])

A note on honesty: we didn’t install Ollama for this article. We ran this script on Python 3.12 against a small mock server that returns the response shape from Ollama’s docs, so the request format and parsing are checked, but the model output isn’t. The request body matches the /api/chat example in the quickstart.

LM Studio offers OpenAI-style endpoints (chat, responses, embeddings) through its local server, so code written for OpenAI’s API can often point at it with a changed base URL.

The catch: a model that fits on a laptop is not the same as the frontier model behind ChatGPT or Claude. Small local models are fine for summaries, rewording, simple code and private notes. They’re noticeably weaker at long, multi-step coding work, and they run slower than you’re used to unless the whole model fits in GPU memory. One more detail: Ollama also offers cloud models (like gemma4:cloud). Its FAQ says those are processed on ollama.com, not on your machine. If privacy is the reason you’re here, stick to the local tags, or turn cloud features off with OLLAMA_NO_CLOUD=1.

What this means for you

If you handle code or documents you can’t send to a third party, a local model is the easiest way to get some AI help without a policy fight. Ollama’s FAQ is direct about it: “Ollama runs locally. We don’t see your prompts or data when you run locally.”

If you’re a student or on a tight budget, it’s a free way to practise prompting and build small AI projects without API bills. Pair it with editor extensions from our free AI coding tools list, and you’ve got a basic offline coding assistant.

And if you build tools, a local Ollama server works well as a backend for a private MCP server setup. Curious which open models are worth downloading? Our explainer on open-weight AI models covers Llama, Qwen, Mistral and Gemma, including what their licenses allow.

Our verdict

If you have 16 GB of RAM or an Apple Silicon Mac, try it this week. It costs nothing but disk space. Start with a small model like gemma4:e2b, see if the quality is enough for your daily tasks, and only download the big ones if you have the memory. Skip local models for heavy agent-style coding on an 8 GB machine; you’ll spend more time waiting than working.

Next: learn which open models you can download in Open-weight AI models explained.

FAQ

Can I run an AI model without a graphics card?

Yes. Ollama falls back to the CPU and system RAM, and ollama ps will show “100% CPU.” It works, just slower. Small models are the sensible choice here.

Does a local model need the internet?

Only to download it. After that, local models run offline. Cloud-tagged models in Ollama do need a connection, because they run on ollama.com.

How much RAM do I need?

LM Studio recommends 16 GB. As a rough guide, your free memory should be comfortably larger than the model’s download size, which you can check on the model’s library page before downloading.

Is running AI locally really private?

For local models, Ollama’s FAQ says it doesn’t see your prompts or data. Your prompts stay on your machine. Just avoid cloud-tagged models if privacy is the goal.

Leave a Comment