Learn Ollama

Run open LLMs on your own computer or server, with a CLI, desktop app and local API

25 lessons · 5 hours · 4 levels · covers Ollama 0.40.x (Oct 2026)

Ollama downloads and runs open-weight language models (such as Gemma, Llama, Qwen and gpt-oss) on your own Mac, Windows or Linux machine. It offers a desktop app, a command-line tool, a local REST API with an OpenAI-compatible endpoint, and official Python and JavaScript libraries, so apps and frameworks can use local models for chat, embeddings, tool calling and structured output. Optional cloud models run larger models on Ollama's servers through the same interface.

Before you start

Ollama builds on these; the tree links to the exact lessons you need.

How deep do you want to go?

1. EssentialsRead and write simple code, do the everyday basics8 lessons · 1 hour in total
2. PracticalUse it productively at work, with the usual idioms16 lessons · 3 hours in total
3. AdvancedThe less common features, performance and trade-offs22 lessons · 4 hours in total
4. ExpertInternals and the edge cases experts know25 lessons · 5 hours in total

The Ollama tree

OllamaWhat Ollama isWhat Ollama isInstalling OllamaInstalling OllamaChatting with ollama runChatting with ollamarunManaging downloaded modelsManagingdownloaded modelsChoosing a modelChoosing a modelMemory, GPUs and quantizationMemory, GPUs andquantizationContext length in OllamaContext length inOllamaWhen local beats hosted, and when notWhen local beatshosted, and when notThe local REST APIThe local REST APIThe official Python libraryThe official PythonlibraryOpenAI-compatible endpointOpenAI-compatibleendpointModelfiles and custom modelsModelfiles andcustom modelsGeneration parametersGenerationparametersEmbeddings with OllamaEmbeddings withOllamaStructured outputs with JSON schemasStructured outputswith JSON schemasTool calling with local modelsTool calling with localmodelsWhat a large language model isWhat a largelanguage model isPrompts, messages and rolesPrompts, messagesand rolesTool calling (function calling)Tool calling (functioncalling)The context windowThe context windowHallucinations and other limitsHallucinations andother limitsCalling a model through an APICalling a modelthrough an APIDictionariesDictionariesDefining functionsDefining functionsSystem prompts and instructionsSystem prompts andinstructionsTemperature: why answers varyTemperature: whyanswers varyEmbeddings and semantic similarityEmbeddings andsemantic similarityStructured output (JSON)Structured output(JSON)
Essentials and Practical shown (16 of 25 lessons); the full list is below. Click a lesson to read it.

All 25 lessons, in order

Getting started

  1. What Ollama is · Essentials · 6 min

    Understand what it means to run a language model locally and what Ollama gives you to do it.

  2. Installing Ollama · Essentials · 8 min

    Install Ollama on macOS, Windows or Linux, and check that the app and background server are running.

  3. Chatting with ollama run · Essentials · 10 min

    Download and chat with a model in the terminal using ollama run, one-shot prompts and in-chat commands.

  4. When local beats hosted, and when not · Essentials · 8 min

    Decide between local Ollama models and hosted APIs based on privacy, cost, quality, speed and operations.

Choosing and managing models

  1. Managing downloaded models · Essentials · 8 min

    Download, list, inspect, stop, copy and delete models with pull, ls, ps, show, stop, cp and rm.

  2. Choosing a model · Essentials · 10 min

    Pick a model family and size for your task by reading the library: parameters, capabilities and context length.

  3. Memory, GPUs and quantization · Essentials · 12 min

    Estimate whether a model fits your RAM or GPU memory, and understand quantization in simple terms.

  4. Context length in Ollama · Essentials · 10 min

    Know Ollama's default context length, how to raise it in the app, server, chat and API, and what it costs in memory.

Using Ollama from code

  1. The local REST API · Practical · 12 min

    Call Ollama's HTTP API with /api/chat and /api/generate, handle streaming responses, and list models over HTTP.

  2. The official Python library · Practical · 12 min

    Use the ollama Python package to chat, stream, set options and connect to remote servers with Client.

  3. OpenAI-compatible endpoint · Practical · 10 min

    Point OpenAI client libraries and tools at Ollama's /v1 endpoint to switch between hosted and local models.

  4. Embeddings with Ollama · Practical · 12 min

    Create embeddings locally with embedding models and /api/embed, and use them for semantic search.

  5. Structured outputs with JSON schemas · Practical · 12 min

    Force a model's reply to match a JSON schema with the format parameter, using Pydantic models to define and validate it.

  6. Tool calling with local models · Practical · 14 min

    Let a local model call your Python functions: pass tools, run the requested calls, send results back, and loop.

  7. Thinking and vision models · Advanced · 12 min

    Enable and control reasoning output with think, and send images to vision-capable models.

  8. Ollama in LangChain, LlamaIndex and n8n · Advanced · 12 min

    Use Ollama models from LangChain, LlamaIndex and n8n, and know the settings that commonly trip people up.

Customizing models

  1. Modelfiles and custom models · Practical · 12 min

    Write a Modelfile with FROM, PARAMETER, SYSTEM and MESSAGE, build it with ollama create, and inspect existing ones.

  2. Generation parameters · Practical · 10 min

    Control randomness, length, stopping and reproducibility with temperature, top_p, num_predict, stop and seed.

Performance and deployment

  1. Performance: GPU use, keep-alive and concurrency · Advanced · 14 min

    Tune speed and memory with GPU checks, keep_alive, parallel requests, loaded-model limits, flash attention and KV-cache quantization.

  2. Configuring the Ollama server · Advanced · 12 min

    Set server environment variables on macOS, Linux and Windows, move model storage, and read logs.

  3. Running Ollama in Docker · Advanced · 12 min

    Run the official ollama/ollama image with persistent model storage and NVIDIA or AMD GPU access.

  4. Ollama cloud models · Advanced · 10 min

    Use Ollama's hosted cloud models from the app, CLI and API, and understand the privacy and feature trade-offs.

Security and advanced use

  1. Securing an exposed Ollama server · Expert · 14 min

    Expose Ollama safely: understand that the API has no authentication, and add network limits, a reverse proxy and model hygiene.

  2. Importing, quantizing and sharing models · Expert · 14 min

    Import GGUF or Safetensors weights (including fine-tunes) with a Modelfile, quantize Safetensors imports, and push models to ollama.com.

  3. Serving many users with Ollama · Expert · 14 min

    Plan capacity, concurrency, model versioning and monitoring for a shared Ollama service, and know when to use another engine.