§ LLMS.FREERUN LOCALLYVERIFIED 2026

Ollama Local LLM Setup: Install, Run and API

Ollama is a free, MIT-licensed CLI and desktop app for Windows, macOS and Linux that downloads GGUF models with one command. Once installed, it serves an OpenAI-compatible API on port 11434 so any existing client works locally. Below are install commands, CLI essentials, storage paths and GPU fixes.

# install, then start your first model
curl -fsSL https://ollama.com/install.sh | sh
ollama run llama3.2
§ 01 · CLI REFERENCEESSENTIAL OLLAMA COMMANDSMIT OPEN SOURCE

Essential Ollama CLI Commands

Ollama bundles automatic CUDA, ROCm and Apple Metal GPU detection with a background daemon so you do not have to manage raw GGUF paths manually. These six commands cover almost every daily local workflow:

Essential Ollama CLI commands for downloading, running, inspecting and removing local models
CommandWhat It Does
ollama run llama3.2Downloads the default 4-bit quantization if missing and starts an interactive terminal chat.
ollama pull qwen2.5:7bDownloads or updates a model without launching an interactive session.
ollama psShows currently loaded models and the exact GPU vs CPU split in the PROCESSOR column.
ollama listLists every model stored on disk with its tag, ID and file size.
ollama rm llama3.2Deletes a downloaded model from disk to reclaim storage space.
ollama run hf.co/<org>/<repo>Pulls and runs a GGUF checkpoint directly from Hugging Face.
§ 02 · LOCAL APIOPENAI-COMPATIBLE ENDPOINTLOCALHOST:11434/V1

Calling Ollama Through the OpenAI SDK

Ollama serves an OpenAI-compatible API at http://localhost:11434/v1 alongside its native /api/chat endpoint. Pass any placeholder api_key (such as "ollama"). To expose Ollama to other devices on your LAN, set OLLAMA_HOST=0.0.0.0 before starting the service.

import os
from openai import OpenAI

client = OpenAI(
    base_url="http://localhost:11434/v1",
    api_key="ollama",
)
r = client.chat.completions.create(
    model="llama3.2",
    messages=[{"role": "user", "content": "Hello"}],
)
print(r.choices[0].message.content)

Context length tip: Ollama defaults to a conservative context window (num_ctx) to save VRAM. For coding agents or long documents, pass a larger num_ctx in a custom Modelfile or check your GPU headroom in the LLM VRAM Calculator.

§ 03 · STORAGE & GPUMODEL FOLDERS & TROUBLESHOOTINGOLLAMA_MODELS

Model Storage Paths and GPU Offload Fixes

Set the OLLAMA_MODELS environment variable to move downloaded models to another folder or external drive, then restart the Ollama service.

Default Ollama model storage directories by operating system
Operating SystemDefault Models Folder
macOS~/.ollama/models
Linux (service install)/usr/share/ollama/.ollama/models
WindowsC:\Users\<you>\.ollama\models

Why Is Ollama Slow or Not Using the GPU?

Slow token generation almost always means the model plus KV cache exceeds your GPU VRAM, causing layers to spill onto system RAM and CPU. Run ollama ps while the model is active and inspect the PROCESSOR column — choose a smaller model or tighter quantization until it reads 100% GPU.

§ FAQCOMMON QUESTIONSANSWERS

Ollama Questions

Is Ollama Free and Open Source?

Yes. Ollama is free, MIT-licensed open-source software for Windows, macOS and Linux. Individual models you pull carry their own open licenses (such as Apache 2.0 or Llama Community).

Can Ollama Run Completely Offline?

Yes. Once weights are pulled to your disk with ollama pull, Ollama runs 100% offline with zero external API calls.

How Do I Move Ollama Models to Another Drive?

Set the OLLAMA_MODELS environment variable to your target directory (such as an external SSD), move the existing folder if desired, and restart the Ollama background service.

Should I Use Ollama or LM Studio?

Pick Ollama for a lightweight MIT open-source CLI, background daemon and Docker/Linux automation; pick LM Studio if you want a visual desktop GUI and Apple Silicon MLX models.