Guides · AI Stack · 35

Run AI on your own computer with Ollama or LM Studio

Install Ollama or LM Studio, pick an open model that fits your memory, chat with it offline, and call it from code, n8n or a coding tool without opening it to the internet.

1-2 hours, plus download timeFree (runs on your own hardware)Advanced

Ollama and LM Studio are free apps that download an open model, run it on your computer, and give you a chat window plus an API that works like OpenAI's. What you type stays on your machine. Here's what that buys you, what it costs, and how to set it up without leaving a door open.

1Decide what local is good for

  • Privacy: Ollama says it doesn't see your prompts when you run locally, and LM Studio says nothing you type in chat leaves your device.
  • Offline: once downloaded, a model works with no network at all.
  • Volume: tagging 50,000 support tickets costs electricity, not tokens.
Local open modelFrontier model (Claude, ChatGPT, Gemini)
QualityGood at summaries, drafts, extraction and sorting. Weaker at long reasoning, hard code and recalling factsThe best available for hard reasoning, coding and long tasks
SpeedDepends on your hardware. Big models crawl on a laptopFast, on someone else's GPUs
ContextLimited by memory. Ollama starts at 4K tokens on machines with under 24 GB of VRAMHundreds of thousands of tokens
ExtrasNo web search, memory or connectors unless you add themBuilt in
CostFree after the hardwareSubscription or per-token bills

Give a local model private, repetitive, well-defined work, and keep a frontier model for the hard problems.

2Check your hardware honestly

A model runs fast only when it fits in GPU memory: VRAM on a PC graphics card, or the shared memory of an Apple Silicon Mac, minus what macOS and your apps need. Otherwise it spills onto the CPU and slows down a lot. Downloads are compressed ("quantized") to about 4 bits per weight, so download size is a fair guide to memory needed. Add a few GB for the conversation.

Your memory (Mac RAM or PC VRAM)Runs wellTry first (Ollama tag, download size)
8 GB1-4B models onlyqwen3.5:2b (2.7 GB), llama3.2:3b (2.0 GB), phi4-mini (2.5 GB), qwen3.5:4b (3.3 GB)
16 GBUp to about 12Bqwen3.5:9b (6.6 GB), gemma4:e4b (6.6 GB), gemma4:12b (7.7 GB)
24-32 GB20-30Bgpt-oss:20b (14 GB), gemma4:26b (16 GB+), qwen3.6:27b (18 GB)
64 GB30B+ with long contextgemma4:31b (19 GB), qwen3.6:35b (23 GB)
96-128 GBThe largest you can run at homegpt-oss:120b (65 GB), qwen3.5:122b (81 GB)

Sizes from the Ollama library, October 2026. The gpt-oss page says the 20B runs in as little as 16 GB, but that leaves a 16 GB laptop little room for anything else.

Ollama needs macOS 14+ (only Apple Silicon gets GPU speed) or Windows 10 22H2+, and lists supported graphics cards in its hardware docs. LM Studio needs an Apple Silicon Mac on macOS 14+, and on Macs it can also run MLX builds (Apple's machine-learning framework), as can Ollama's -mlx tags. Leave tens of GB free on disk.

3Install Ollama or LM Studio

OllamaLM Studio
Best forWiring models into code, n8n and coding toolsBrowsing and comparing models, chatting with documents
LicenseOpen source (MIT)Free for home and work, not open source
Local APIhttp://localhost:11434/v1http://localhost:1234/v1

Ollama: download from ollama.com/download. On a Mac, drag it to Applications, open it, and let it add the ollama command. On Windows, run OllamaSetup.exe (no admin rights needed). On Linux, use the script below.

Install and run Ollama (as of October 2026)
Linux (or macOS):     curl -fsSL https://ollama.com/install.sh | sh
Windows PowerShell:   irm https://ollama.com/install.ps1 | iex
ollama run qwen3.5:4b      # downloads the model, then chats in the terminal (/bye to quit)
ollama ps                  # "100% GPU" is what you want
ollama ls                  # models on disk
ollama rm llama3.2:3b      # delete one to free space

LM Studio: download from lmstudio.ai/download. Open the Discover tab (Cmd+2 on Mac, Ctrl+2 elsewhere) and search, for example, qwen3.5. Versions are labeled by quantization, like Q4_K_M or Q8: LM Studio advises 4-bit or higher if your machine can run it. Then pick the model in the Chat tab's loader and type.

Install only from ollama.com, lmstudio.ai or their official GitHub pages.

4Pick open models and check the license

As of October 2026, these families are current, in Ollama's library, and on Hugging Face, which LM Studio searches:

Family (maker)SizesLicenseGood for
Qwen3.5 (Alibaba)0.8B to 122BApache 2.0Strong all-rounder even at small sizes, reads images
Qwen3.6 (Alibaba)27B, 35BApache 2.0Coding and agent work on 32 GB+ machines
Gemma 4 (Google DeepMind)E2B, E4B, 12B, 26B, 31BApache 2.0Writing and images. The 26B is quick: only about 4B parameters work at a time
gpt-oss (OpenAI)20B, 120BApache 2.0Reasoning and tool use, text only
Llama 3.2 (Meta)1B, 3BLlama 3.2 Community LicenseTiny helpers on weak machines
Phi-4-mini (Microsoft)3.8BMITSmall model for reasoning and function calling
EmbeddingGemma (Google)300MGemma Terms of UseTurning text into numbers for search and RAG, not chat

Apache 2.0 and MIT let you use, change and ship a model commercially. The Llama 3.2 license adds conditions, such as showing "Built with Llama" if you distribute it and following Meta's use policy. Read the model card before building a product on any model.

Test a local model on your real work (paste into the local model, then into Claude or ChatGPT)
Do these three tasks, labeled 1 to 3.
1. Summarize this text in 5 bullets, using only facts that appear in it: [paste a real document]
2. Extract every name, date and dollar amount from it as a table.
3. Draft a 120-word reply to this email in a friendly, direct tone: [paste an email]
If something you need is missing, write "Missing:" and say what. Don't guess.

Any task the local model handles well can stay on your machine.

5Give it a proper chat window

  • The built-in apps: the Ollama app on macOS and Windows has a chat window that takes dragged-in PDFs and text files (raise the context length in settings for long ones). LM Studio's Chat tab can attach documents and processes them locally.
  • Open WebUI: a ChatGPT-style interface in your browser, with chat history and accounts for several people. It finds Ollama on its own.
Install Open WebUI without Docker (needs Python 3.11 or 3.12)
pip install open-webui
open-webui serve           # then open http://localhost:8080

The first account becomes the admin. Prefer this route on a laptop: Open WebUI's docs say the Docker route needs Ollama listening on all interfaces (0.0.0.0), which opens it to your network. Its license bars removing its branding above 50 users.

6Call your local model from code

Both apps accept OpenAI-style requests, so most code built for OpenAI works once you change the base URL. Ollama ignores the key, but the library wants one, so pass any text. In LM Studio, switch on Start server in the Developer tab, or run lms server start.

Python: chat with a local model (pip install openai)
from openai import OpenAI

# Ollama: http://localhost:11434/v1    LM Studio: http://localhost:1234/v1
client = OpenAI(base_url="http://localhost:11434/v1", api_key="ollama")

reply = client.chat.completions.create(
    model="qwen3.5:4b",  # in LM Studio, use the model identifier it shows
    messages=[{"role": "user", "content": "Summarize this clause in 3 bullets: ..."}],
)
print(reply.choices[0].message.content)

Both also serve /v1/embeddings and /v1/models (Ollama, LM Studio). Quick test: curl http://localhost:11434/v1/models should list your models.

7Plug it into n8n or a coding tool

n8n: n8n Cloud can't reach a model on your laptop, so run n8n on the same machine.

  1. Install Node.js (20.19 to 24.x), run npx n8n, and open http://localhost:5678.
  2. Choose Create Credential, then Ollama, with Base URL http://localhost:11434 (try http://127.0.0.1:11434 if it fails, or http://host.docker.internal:11434 if n8n runs in Docker Desktop). Save and look for "Connection tested successfully" (Ollama's n8n guide).
  3. Add a Basic LLM Chain or AI Agent node and attach the Ollama Chat Model. Agents call tools, so pick a tool-capable model like qwen3.5:9b or gpt-oss:20b.

Coding tools: ollama launch sets up Claude Code, Codex, OpenCode and others to use your Ollama models. In VS Code, install the Ollama extension and pick a model from the Ollama group in the Chat view.

Point a coding tool at a local model
ollama pull qwen3.6:27b       # 18 GB: 32 GB+ machines. On 16 GB, try qwen3.5:9b
ollama launch claude          # Claude Code on your Ollama models
ollama launch codex           # OpenAI's Codex CLI

Be realistic. Ollama's Claude Code guide asks for a tool-capable model and 64K tokens of context or more (the slider in the app's settings, or OLLAMA_CONTEXT_LENGTH=64000 ollama serve, per the context docs). That needs far more memory than chat, and small models fumble multi-file changes. Keep permission prompts on, review every diff, and never use --dangerously-skip-permissions outside an isolated machine.

8Never expose the port

  • Ollama listens only on your own machine (127.0.0.1, port 11434) by default, and its local API has no password. Leave OLLAMA_HOST unset, don't set it to 0.0.0.0 on a laptop that joins public Wi-Fi, and never open or forward port 11434 on a router or cloud firewall.
  • Why it matters: in January 2026, SentinelOne and Censys counted 175,000 Ollama servers reachable from the internet in 130 countries, and traced a criminal marketplace reselling access to exposed AI servers (The Hacker News).
  • LM Studio: leave Serve on Local Network off, since any bind other than 127.0.0.1 exposes the server. Authentication is off by default: if others must connect, turn it on in Developer > Server Settings and create a token.
  • Remote access: use an SSH tunnel or a private network such as Tailscale, never a public port.
  • Models and content: download from each app's library or the maker's official Hugging Face page. A local model reading an email or web page can still be tricked by hidden instructions, so connect tools with care.
Local AI checklist0/6

What's next

Point your local model at your own documents in Give AI your company's knowledge, wire it into workflows with Automate your week with n8n, Make or Zapier, or move it to an always-on box with Run your agents 24/7 on a small server. Before you connect anything to real data, read Use AI safely and cheaply.

Get the next lesson in your inbox

Your free AI path in the right order, plus new guides when they come out.

Free. No card. One click to unsubscribe.

Want it done,not just learned?

The AI Skill Pack: 13 ready Claude Skills for your inbox, weekly report, meetings, content, research, proposals and SOPs. Installed in ten minutes. $27, one time.

See the AI Skill PackOr keep going free: everything in one place