n8n is an open-source workflow automation tool — think Zapier but self-hosted. Combined with Ollama, you can build private AI automation workflows that run entirely on your own hardware, with no data leaving your network. This guide covers how to connect the two and build useful automations.
Why Ollama + n8n?
Most AI automation tools rely on cloud APIs (OpenAI, Anthropic) which means your data passes through third-party servers and you pay per token. Running n8n with a local Ollama model gives you:
- Full privacy — no data leaves your machine or network
- No API costs — run unlimited automations without per-token billing
- No rate limits — process as much as your hardware can handle
- Works offline — automations continue running without internet access
What You Need
- Ollama installed and running with at least one model pulled
- n8n — either self-hosted (
npx n8nor Docker) or n8n Cloud with your Ollama accessible via a URL
For self-hosted n8n with Docker:
docker run -it --rm --name n8n -p 5678:5678 -v ~/.n8n:/home/node/.n8n n8nio/n8n
Connecting Ollama to n8n
n8n has an Ollama node built in. To configure it:
- In n8n, go to Credentials → New Credential → Ollama
- Set the base URL to
http://localhost:11434(or your server IP if running remotely) - Save the credential
Alternatively, use the HTTP Request node to call Ollama’s OpenAI-compatible endpoint directly at http://localhost:11434/v1/chat/completions.
Practical Automation Examples
1. Summarise Incoming Emails
Trigger: Email received via Gmail or IMAP → Extract body text → Ollama node (summarise in 3 bullet points) → Send summary to Slack or save to Notion.
2. Classify and Route Support Tickets
Trigger: New row in Google Sheets or webhook → Ollama classifies the ticket type (billing, technical, general) → Route to different team channels or assign labels automatically.
3. Document Processing Pipeline
Trigger: New file in Google Drive or local folder → Extract text → Ollama summarises and extracts key information → Store structured output in a database or spreadsheet.
4. Daily News Digest
Schedule trigger (8am daily) → Fetch RSS feeds from multiple sources → Ollama summarises each article → Compile into a formatted email or Slack message → Send.
5. Local Chatbot Webhook
Webhook trigger → Receive message → Ollama generates response → Return response. Deploy this as a simple private chatbot endpoint for internal tools.
Basic n8n Workflow: Webhook to Ollama
Here is the simplest working pattern — a webhook that accepts a message and returns an Ollama response:
- Add a Webhook node — set method to POST
- Add an Ollama Chat Model node — connect your credential, select your model
- Add an AI Agent node or HTTP Request to send the webhook body to Ollama
- Return the response with a Respond to Webhook node
Using the OpenAI-Compatible Endpoint in n8n
If you prefer the OpenAI node in n8n (which has more options), use Ollama’s OpenAI-compatible endpoint:
- Create an OpenAI credential in n8n
- Set the base URL to
http://localhost:11434/v1 - Set the API key to any non-empty string
- Use any Ollama model name in the model field
Tips for Production Use
- Use a faster, smaller model for high-volume automations — Qwen2.5 3B or Llama 3.2 3B handle classification and summarisation well
- Reserve larger models (Llama 3.3 70B, Llama 4) for complex reasoning tasks triggered infrequently
- Set a system prompt in your Ollama calls to constrain output format — especially useful for classification tasks where you want a single word or JSON output
- Use Ollama structured outputs for reliable JSON extraction in processing pipelines
Related Guides
- Ollama OpenAI API Compatibility: Drop-In Replacement Guide
- How to Use Ollama with Python
- How to Get Structured JSON Output from Ollama
Related n8n Guides
- n8n — The Complete Self-Hosted Automation Guide
- How to Install n8n with Docker: Self-Hosted Setup Guide
- n8n + Ollama: Build Local AI Automation Workflows






