Skip to main content
Engineering

n8n + Local LLMs: Building Automation Without Zapier

by J4SGON

Zapier bills you per task. Make.com bills you per operation. n8n bills you nothing — if you run it yourself. We've been running n8n with local LLMs for three months, automating content generation, lead processing, and infrastructure monitoring. Here's what works, what doesn't, and how to build it.

Why n8n Instead of Zapier or Make

We started with Zapier like everyone else. Then the bill climbed: €89/month for 30,000 tasks. Then €149/month when we added more workflows. Then we realized every workflow that calls an LLM is another per-task charge plus the OpenAI API cost on top.

n8n is fair-code licensed: free to self-host, no task limits, no per-execution pricing. You run it on your infrastructure, connect it to your local models, and automation becomes a fixed cost — zero.

The tradeoff is setup effort. Zapier is plug-and-play. n8n is plug-and-configure. If you can run a Docker container and edit a JSON file, you can handle it.

The Architecture

Here's what our stack looks like:

┌─────────────────────────────────────────┐
│              n8n (:5678)                │
│  ┌─────────┐  ┌─────────┐  ┌─────────┐ │
│  │ Blog    │  │ Lead    │  │ Infra   │ │
│  │ Gen     │  │ Proc    │  │ Monitor │ │
│  └────┬────┘  └────┬────┘  └────┬────┘ │
└───────┼────────────┼────────────┼──────┘
        │            │            │
        ▼            ▼            ▼
┌──────────────┐  ┌──────────┐  ┌──────────┐
│ LiteLLM      │  │ vorlux-ai│  │ Grafana  │
│ (:4000)      │  │ (:8091)  │  │ (:3002)  │
│              │  │          │  │          │
│ qwen3.6 (32B)│  │ CRM API  │  │ Metrics  │
│ qwen2.5-7b   │  │ DAG exec │  │ Alerts   │
│ nomic-embed  │  │          │  │          │
└──────────────┘  └──────────┘  └──────────┘
        │
        ▼
┌──────────────┐
│ SearXNG       │
│ (:8085)       │
│ Web search   │
│ for context   │
└──────────────┘

The key insight: n8n doesn't call OpenAI. It calls LiteLLM, which routes to local models. Every LLM call is free, traced by Langfuse, and never leaves the building.

Setting Up the Pipeline

Step 1: n8n with Host Networking

The biggest gotcha is Docker networking. n8n runs in a container; your LLMs run on the host. By default, the container can't reach host services.

We solved this by switching n8n to network_mode: host:

# docker-compose.yml (n8n service)
services:
  n8n:
    image: n8nio/n8n:latest
    network_mode: host
    environment:
      - N8N_HOST=localhost
      - N8N_PORT=5678
      - WEBHOOK_URL=https://your-domain.com/
      - N8N_BASIC_AUTH_ACTIVE=true
      - N8N_BASIC_AUTH_USER=admin
      - N8N_BASIC_AUTH_PASSWORD=your-password
    volumes:
      - n8n_data:/home/node/.n8n

With host networking, n8n can reach localhost:4000 (LiteLLM), localhost:8091 (vorlux-ai), localhost:8085 (SearXNG), and every other host-native service directly. No host.docker.internal hacks, no UFW rules, no bridge network gymnastics.

Step 2: LiteLLM as the Model Gateway

n8n has built-in "AI Agent" and "AI Language Model" nodes that speak the OpenAI API format. Point them at LiteLLM instead of OpenAI:

Credential setup in n8n:

  • Type: OpenAI API
  • Base URL: http://localhost:4000/v1
  • API Key: your LiteLLM master key

Now every n8n AI node uses your local models. You get:

  • Fallback routing: if qwen3.6 is overloaded, LiteLLM falls back to qwen2.5-7b
  • Spend tracking: Langfuse records every call with model, tokens, latency
  • Rate limiting: per-model limits prevent any single workflow from starving others
  • One key: no need to manage separate credentials per model

Step 3: SearXNG for Web Context

When workflows need current information (trending topics, news, competitor analysis), use SearXNG:

HTTP Request node → GET http://localhost:8085/search?q={topic}&format=json

No API key, no usage limits, no Google API billing. Results come back as JSON, ready for an LLM node to synthesize.

Three Workflows We Run in Production

1. Blog Generation Pipeline (Every 4 days)

This is our most complex workflow — 7 stages:

| Stage | Node Type | What It Does | |-------|-----------|-------------| | Research | HTTP Request | SearXNG search for trending topics in AI infrastructure | | Outline | AI Language Model | qwen3.6 generates article outline from research | | Draft | AI Language Model | qwen3.6 writes full draft from outline | | Edit | AI Language Model | qwen2.5-7b reviews for clarity, conciseness | | QA | Code Node | Word count, buzzword check, internal links, code blocks | | Save | HTTP Request | POST to j4sgon-site repo as draft with frontmatter | | Notify | HTTP Request | Discord webhook with summary |

Cost to run: €0 per execution. We run it every 4 days = ~7 posts/month. Equivalent on Zapier + OpenAI: ~€15/post × 7 = €105/month.

2. Lead Processing (Event-triggered)

When vorlux-ai's CRM receives a new lead, n8n triggers:

  1. Enrich: HTTP Request to vorlux-ai API → get lead details + company info
  2. Score: AI Language Model (qwen2.5-7b) → score lead 1-10 based on budget, authority, need, timeline
  3. Classify: Switch node → route to "qualified", "nurturing", or "disqualified"
  4. Draft Outreach: AI Language Model (qwen3.6) → personalized first-contact email
  5. Approve: Wait for human review in vorlux-ai dashboard

Latency: ~15 seconds from lead creation to drafted outreach email. Cost: €0. Equivalent on Zapier + OpenAI: ~€0.50/lead.

3. Infrastructure Monitor (Every 30 min)

Simple health check workflow:

  1. Check containers: HTTP Request to Portainer API → list container statuses
  2. Check services: HTTP Request to each service's health endpoint
  3. Aggregate: Code node → compile status report
  4. Alert: IF node → if any service down, send Discord notification

No LLM needed for this one — pure HTTP + logic. But the aggregation step could use a local model to generate human-readable summaries if needed.

Lessons From Three Months in Production

1. Use the HTTP Request Node for Everything

n8n's built-in integrations (Slack, Gmail, Notion, etc.) are convenient but they're wrappers around HTTP calls. If a service has an API, use the HTTP Request node directly. You get full control over headers, body, auth, and error handling. When a provider changes their API, you don't wait for n8n to update their node — you change one JSON field.

2. Code Nodes Are Your Friend

n8n's Code node (JavaScript) is where the real logic happens. Use it for:

  • Data transformation between stages
  • QA checks (word count, regex matching, validation)
  • Conditional routing that's too complex for the IF node
  • Building structured objects from messy API responses
// Example: QA check for blog post generation
const content = items[0].json.draft;
const wordCount = content.split(/\s+/).length;
const hasCodeBlocks = content.includes('```');
const buzzwords = ['synergistic', 'leverage', 'paradigm shift'];
const foundBuzzwords = buzzwords.filter(b => 
  content.toLowerCase().includes(b)
);

return [{
  json: {
    ...items[0].json,
    qa: {
      wordCount,
      hasCodeBlocks,
      buzzwordsFound: foundBuzzwords,
      passed: wordCount > 800 && foundBuzzwords.length === 0
    }
  }
}];

3. Model Selection Per Stage

Not every LLM call needs the big gun. Our blog pipeline uses two models:

  • qwen3.6 (32B) for outline + draft generation — quality matters
  • qwen2.5-7b for editing/review — fast, good enough for style cleanup

LiteLLM makes this transparent. Each n8n AI node specifies which model to use, and LiteLLM handles routing, fallback, and tracing. You're not locked in — swap models by changing one field.

4. Error Handling is Non-Optional

Production workflows fail. Models time out. APIs rate-limit. Disks fill up. n8n's error handling is basic but functional:

  • Error Trigger node: catches any workflow failure, routes to a notification
  • Retry on Fail: set on any HTTP Request or AI node — 3 retries with 5-second backoff
  • Stop node: explicitly halt a workflow branch that shouldn't continue

We have a global Error Trigger that sends a Discord message when any workflow fails. In three months, it's fired 12 times — mostly model timeouts during GPU memory contention.

5. n8n IF Nodes Are Fragile

There's a bug in n8n 2.26.x where IF nodes throw "Cannot read properties of undefined" when activated via API. They work fine when created through the UI. This is annoying for programmatic workflow setup. Workaround: use Switch nodes or Code nodes for conditional logic when possible.

6. Host Networking is the Answer

We spent two weeks debugging Docker bridge networking issues. Containers couldn't reach host services. host.docker.internal worked on some platforms but not others. UFW rules needed updating. Then we switched n8n to network_mode: host and everything just worked. If n8n is the only service in that container, host networking is fine — and it eliminates an entire class of networking headaches.

7. Use Webhooks for External Triggers

n8n webhooks let external systems trigger workflows. We expose a webhook URL that vorlux-ai calls when a new lead is created. The webhook triggers the lead processing pipeline instantly — no polling, no delays. Just register the webhook URL in vorlux-ai's CRM config.

The Cost Comparison

| Tool | Monthly Cost | What You Get | |------|-------------|-------------| | Zapier Professional | €80 | 30K tasks, limited AI actions | | Make Team | €69 | 40K operations, basic routing | | n8n Cloud | €50 | 10K executions, managed | | n8n self-hosted | €0 | Unlimited, full control |

The catch: self-hosted means you handle updates, backups, and security. But if you're already running a Docker host (and if you're reading this blog, you probably are), one more container is negligible.

Add local LLMs to the mix and the savings compound. A blog generation workflow that calls GPT-4o costs ~€0.15/post in API fees. At 7 posts/month, that's €10.50/month — not huge, but it adds up across dozens of workflows. With local models, it's €0. Always.

What Doesn't Work (Yet)

YouTube Upload

n8n has a YouTube node, but it requires OAuth credentials and the Google Cloud setup is non-trivial. We haven't automated video uploads yet — the YouTube pipeline generates videos, but a human publishes them. This is fine for our cadence (bi-weekly).

Complex Multi-Step Reasoning

Local 7B-32B models handle most workflow tasks well: classification, drafting, summarization, routing. But for complex multi-step reasoning (e.g., "analyze this contract and identify 5 risk clauses with mitigation suggestions"), you need a frontier model. Our approach: use local models for 80% of workflow calls, route the hard 20% to a cloud model via LiteLLM's fallback. Total cloud spend: ~€5/month.

Workflow Versioning

n8n doesn't have git-based version control for workflows. You can export workflows as JSON and commit them to a repo manually, but there's no automatic sync. We export our workflows to n8n/workflows/*.json and commit changes. It's manual but workable.

Getting Started

If you want to replicate our setup:

  1. Deploy n8n: docker compose up -d with host networking
  2. Deploy LiteLLM: Configure with your local models (Ollama, vLLM, or both)
  3. Create credentials in n8n: OpenAI API type pointing at LiteLLM
  4. Build your first workflow: Start simple — a cron trigger → HTTP Request → AI node → output
  5. Add SearXNG: For workflows that need web context
  6. Set up error alerts: Discord or Slack webhook on Error Trigger
  7. Export workflows as JSON: Commit to your repo for version tracking

The entire setup takes about 2 hours if your LiteLLM and local models are already running. If not, add another hour for LiteLLM configuration.

The Verdict

n8n + local LLMs is the automation stack we'd been looking for. It replaces Zapier's per-task pricing, OpenAI's per-token pricing, and the privacy concerns of sending workflow data through third-party SaaS. The setup investment pays off within the first month if you run more than 5,000 tasks.

The combination of n8n's visual workflow builder with LiteLLM's model routing and local inference is genuinely powerful. You get the convenience of a no-code automation tool with the economics and privacy of self-hosted AI. For European businesses navigating data sovereignty requirements, this stack isn't just cheaper — it's strategically necessary.


We've open-sourced our workflow templates. Learn more about J4SGON's sovereign AI stack at vorluxai.com.

n8nautomationself-hostedlocal-llmsovereign-aiopen-sourcelitellm