n8n + Ollama in 2026: Build a Self-Hosted AI Workflow Stack With Zero API Bills

n8nollamaqdrantragselfhostedautomation

TL;DR: n8n gives you Zapier-style visual automation, Ollama gives you free local inference, and Qdrant gives you a vector store for RAG — all three run from one Docker Compose file on a single machine. The catch: n8n uses the Sustainable Use License, not a true open-source license, so you can self-host it for your own business but not resell it as a service.

What you’ll have running after this guide:

  • An n8n instance at localhost:5678 with Ollama and Qdrant wired in as AI nodes, all on one Docker network
  • A working LLM workflow (webhook in → local model → structured output) you can clone for email triage, Slack bots, and issue labeling
  • A document RAG pipeline: PDFs chunked, embedded with nomic-embed-text, stored in Qdrant, and queried by any workflow

Honest take: If you’re already paying for Zapier plus an LLM API, this stack replaces both for the cost of electricity — and n8n’s 400+ integrations make it the right visual tool for the job. Pick Flowise instead only if all you want is a simple RAG chatbot.

Why this stack, and the license fine print

The pieces fit together unusually well. n8n is the orchestrator: triggers (webhooks, IMAP, cron, Slack events), branching logic, and native AI nodes that speak to local models. Ollama serves the models. Qdrant holds the embeddings. n8n itself is CPU-only — inference is the only part that wants a GPU.

Before you build on it, know what you’re standing on:

  • n8nSustainable Use License, a fair-code license, not OSI-approved open source. You may use and modify it freely for internal business purposes or personal use. You may not offer n8n itself as a hosted service, sell it, or build a competing automation product on it without a commercial agreement. Automating your own company’s workflows — even revenue-generating ones — is explicitly fine.
  • Ollama — MIT. No restrictions that matter for self-hosters.
  • Qdrant — Apache 2.0. Same.

If your plan is “internal automations for my team or homelab,” you’re compliant. If your plan is “sell managed n8n to clients,” stop and talk to n8n first. This article was written against the n8n 2.x line (2.34 at the time of writing).

Hardware: one mid-range GPU is enough

n8n, Postgres, and Qdrant together idle at under 2 GB of RAM. The GPU budget goes entirely to Ollama:

  • 8B-class models (the sweet spot for triage, labeling, and summarization): a used RTX 3060 12GB handles Q4 quants with room for context.
  • 13B–24B models (noticeably better reasoning for RAG answers): a RTX 4060 Ti 16GB or better.
  • CPU-only: works for embeddings and small models, but chat responses in the multi-second range make interactive workflows feel broken. Fine for nightly batch jobs.

If you want to prototype before buying hardware, a RunPod GPU pod running Ollama gives you the same API surface — point n8n’s Ollama credentials at the pod URL and everything below works identically. For picking a card for a permanent build, see the GPU guides at runaihome.com.

Step 1: The Docker Compose stack

The fastest path is n8n’s official self-hosted-ai-starter-kit, which ships exactly this combination (n8n + Ollama + Qdrant + Postgres):

git clone https://github.com/n8n-io/self-hosted-ai-starter-kit.git
cd self-hosted-ai-starter-kit
cp .env.example .env   # set POSTGRES_PASSWORD and the two encryption keys
docker compose --profile gpu-nvidia up -d   # or --profile cpu

If you’d rather own the file, this trimmed compose captures the essential wiring — every service on one network, addressed by service name:

services:
  n8n:
    image: docker.n8n.io/n8nio/n8n
    ports: ["5678:5678"]
    environment:
      - OLLAMA_HOST=http://ollama:11434
    volumes:
      - n8n_data:/home/node/.n8n

  ollama:
    image: ollama/ollama
    volumes:
      - ollama_data:/root/.ollama
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: all
              capabilities: [gpu]

  qdrant:
    image: qdrant/qdrant
    volumes:
      - qdrant_data:/qdrant/storage

volumes:
  n8n_data:
  ollama_data:
  qdrant_data:

Pull your models into the Ollama container:

docker compose exec ollama ollama pull qwen3:8b
docker compose exec ollama ollama pull nomic-embed-text

The trap that breaks every first attempt: inside Docker, localhost means “this container.” When you create the Ollama credential in n8n, the base URL must be http://ollama:11434 (the service name), not http://localhost:11434. The same applies to Qdrant: http://qdrant:6333. If you see ECONNREFUSED 127.0.0.1:11434 in a node error, this is why. (If n8n runs in Docker but Ollama runs on the host, use http://host.docker.internal:11434 instead.)

Step 2: First AI workflow in five minutes

Open localhost:5678, create your owner account, and build this three-node workflow:

  1. Webhook node — trigger. Copy the test URL it generates.
  2. Basic LLM Chain node — attach an Ollama Chat Model sub-node, select qwen3:8b, and write a prompt like: “Classify the following message as bug, feature-request, or question. Reply with only the label. Message: {{ $json.body.text }}”
  3. Respond to Webhook node — return the model’s output.

Test it:

curl -X POST http://localhost:5678/webhook-test/<your-path> \
  -H "Content-Type: application/json" \
  -d '{"text": "The export button crashes when I click it twice"}'

You should get bug back in about a second on an 8B model with GPU. That webhook-in, LLM-classify, structured-out shape is the skeleton of almost every automation below — swap the trigger and the destination and you have a new tool.

One setting worth fixing immediately: in the Ollama Chat Model node’s options, raise the context length. Ollama’s default context window silently truncates long inputs — the model doesn’t error, it just never sees the end of your document. For RAG and email threads, set it to 16k–32k if your VRAM allows.

Step 3: RAG over your documents with Qdrant

n8n ships purpose-built vector nodes, so the pipeline is shorter than any LangChain script:

Ingestion workflow (run on a folder trigger or manual upload):

  1. Read/Write Files or HTTP Request node — fetch the PDF or markdown.
  2. Default Data Loader + Recursive Character Text Splitter sub-nodes — chunk at ~800 characters with 100 overlap. Smaller chunks retrieve more precisely; larger chunks preserve more context per hit.
  3. Qdrant Vector Store node (insert mode) — attach an Embeddings Ollama sub-node pointed at nomic-embed-text, collection name docs.

Query workflow:

  1. Chat Trigger node — n8n gives you a hosted chat UI for free.
  2. Question and Answer Chain node — retriever set to the same Qdrant collection, chat model set to your Ollama model.

Ask it something only your documents know. The answer is generated locally, the embeddings never left your machine, and there is no per-query cost — which changes how you use RAG. Nightly digest jobs that would cost real money against a metered API are free to run hourly here. For a deeper comparison of vector stores for this job, see our pgvector vs Chroma vs Qdrant guide.

Five automations that earn their keep

  1. Email triage — IMAP trigger → LLM assigns a label and one-line summary → move to folder / post to Slack. An 8B model is genuinely good at this.
  2. GitHub issue auto-labeler — GitHub trigger on new issues → classify against your label set → apply via the GitHub node.
  3. Slack answer-bot — Slack trigger → Qdrant retrieval over your internal docs → Ollama answer → threaded reply. The privacy case writes itself: internal questions never reach a third-party API.
  4. Nightly document digest — cron trigger → summarize everything added to the docs collection that day → email yourself the digest.
  5. Coding-agent kicker — webhook → LLM writes a task brief → HTTP Request node hits your self-hosted OpenCode or Aider setup to prep a PR. For cloud-side coding backends, aicoderscope.com covers the options.

n8n vs Flowise vs LangGraph, honestly

We compared these three in depth in the workflow orchestration shootout; the short version holds in 2026. n8n wins when the AI step is one part of a larger automation — its 400+ integrations and mature branching/error handling are the moat. Flowise wins when you only want a RAG chatbot and nothing else; it’s simpler to reach that one outcome. LangGraph wins when you need custom agent logic in Python and version-controlled code over visual canvases. If you’re assembling a broader local setup around this, start from the open-source AI stack overview.

When NOT to use this stack

  • You need guaranteed-quality answers. Local 8B models mislabel edge cases a frontier API model would catch. For customer-facing output, keep a human or a cloud model in the loop.
  • You’re automating for clients as a service. n8n’s license makes reselling hosted n8n a commercial-agreement conversation, not a docker command.
  • Sub-second latency at high concurrency. Ollama serves one home lab fine; for real parallel load you want vLLM behind the same n8n nodes — see our vLLM production setup.
  • Your workflows are trivial. If it’s “when form submitted, add row to sheet,” you don’t need an LLM or this stack.

FAQ

Does n8n’s free self-hosted version limit workflows or executions? No. Self-hosted community n8n has no execution caps. Some enterprise features (SSO, LDAP, environments) are paywalled, but nothing in this guide touches them.

Can I use OpenAI-compatible endpoints instead of the Ollama nodes? Yes. Ollama exposes an OpenAI-compatible API at /v1, and n8n’s OpenAI nodes accept a custom base URL — point them at http://ollama:11434/v1 with any placeholder API key. Useful when a community node supports OpenAI but not Ollama natively.

How much does this actually save versus Zapier + a metered LLM API? Zapier’s paid tiers plus even light API usage typically run $50–200/month. This stack’s marginal cost is electricity — roughly $10–15/month for a machine with a mid-range GPU running 24/7 at US rates. The one-time GPU cost pays back in a few months if you were paying for both.

Sources

  • RTX 3060 12GB — the budget workhorse for 8B-class models in this stack
  • RTX 4060 Ti 16GB — headroom for 13B–24B models and bigger context windows

Was this article helpful?