The Power of Local AI Automation
ChatGPT is a chat box. You type, it responds. That’s it. What if AI could work while you sleep? Read your emails, summarize documents, generate content, post to social media — all without you touching a keyboard?
That’s what n8n + Ollama gives you. n8n is an open-source workflow automation tool (like Zapier, but self-hosted and free). Ollama provides the local AI brain. Together, they create automated pipelines that run 24/7 on your hardware, with zero API costs.
What You Need
- Ollama installed and running (see our beginner guide)
- Docker for running n8n
- 4GB RAM for n8n (on top of what Ollama uses)
Installing n8n
Docker (Recommended)
| |
Open http://localhost:5678 and create your admin account.
Without Docker
| |
Connecting n8n to Ollama
n8n has a built-in Ollama node that connects to your local Ollama instance.
Step 1: Add Ollama Credentials
- In n8n, go to Credentials → Add Credential
- Search for Ollama API
- Set the base URL:
http://host.docker.internal:11434(if n8n is in Docker) orhttp://localhost:11434(if running natively) - Save — no API key needed, Ollama doesn’t require one
Step 2: Test the Connection
Create a simple workflow:
- Add a Manual Trigger node
- Add an Ollama node
- Configure: Model =
llama3.1:8b, Prompt =Say hello - Click Execute Workflow
If you see a response, you’re connected. Your local AI is now programmable.
Real Workflow Examples
Workflow 1: Automated Content Generation
Trigger: Schedule (daily at 9 AM) Steps:
- Schedule Trigger → fires daily
- Ollama node → generates 5 article topic ideas based on a niche prompt
- Ollama node → writes a full article from the best topic
- Write File node → saves to
/content/articles/ - Slack/Telegram node → notifies you it’s done
| |
Workflow 2: Email Summarization
Trigger: New email (IMAP) Steps:
- IMAP Trigger → new email arrives
- Ollama node → summarizes the email in 3 bullet points
- Telegram node → sends summary to your phone
| |
Workflow 3: YouTube Video Pipeline (Our Actual Workflow)
Trigger: Manual or schedule Steps:
- Manual Trigger → enter video topic
- Ollama node → writes a 5-minute video script
- Ollama node → generates image prompts for each scene
- HTTP Request → sends prompts to ComfyUI API (image generation)
- HTTP Request → sends script to Kokoro TTS API (voice generation)
- Execute Command → FFmpeg combines audio + images into video
- Google Drive node → uploads finished video
| |
This is the exact pipeline we use for our YouTube channel. One workflow trigger produces a finished video. Cost: $0.
Workflow 4: Document Q&A Chatbot
Trigger: Webhook (HTTP POST) Steps:
- Webhook → receives a question
- Read File node → loads relevant document
- Ollama node → answers the question based on the document
- Webhook Response → returns the answer
This gives you a private ChatGPT that knows your documents — no API costs, no data leaving your network.
Workflow 5: Automated Social Media Posts
Trigger: Schedule (3x per week) Steps:
- Schedule Trigger → fires Mon/Wed/Fri
- RSS Feed node → pulls latest AI news
- Ollama node → writes a social media post about the top story
- HTTP Request → posts to X/Twitter API
- Telegram node → sends you a preview
| |
Tips for Reliable Workflows
1. Set Model Keep-Alive
Ollama unloads models after 5 minutes of inactivity by default. For automation, keep models warm:
| |
Or per-request in n8n Ollama node:
| |
2. Use the Right Model for Each Task
| Task | Recommended Model | Why |
|---|---|---|
| Creative writing | llama3.1:8b | Good prose quality |
| Code generation | qwen2.5:7b | Strong coding performance |
| Summarization | llama3.2:3b | Fast, good enough |
| Complex reasoning | qwen2.5:14b | Better logic, slower |
| Tool calling/agents | glm4.7:9b | Designed for function calling |
3. Handle Errors Gracefully
Add an Error Trigger node to catch failures:
| |
4. Use Environment Variables
Store sensitive config in environment variables, not in workflow nodes:
| |
5. Monitor with Built-in Logs
n8n logs all executions. Check Executions tab in the UI to debug failed runs.
Advanced: Multi-Model Workflows
You can chain multiple Ollama calls with different models in one workflow:
| |
The 14B model plans (slow but smart), the 8B model writes (balanced), and the 3B model generates metadata (fast). Each model plays to its strength.
Troubleshooting
“Connection refused” to Ollama
- Ensure Ollama is running:
ollama serve - Check the URL in n8n credentials
- If n8n is in Docker, use
host.docker.internal:11434, notlocalhost:11434
Workflow times out
- Large models take time on CPU — increase the timeout in the Ollama node
- Use a smaller model for automation (3B or 7B)
Model not found
- Pull the model first:
ollama pull llama3.1:8b - Check model name spelling (case-sensitive)
Next Steps
- Setting Up ComfyUI — Add image generation to your workflows
- Kokoro TTS Setup — Add voice synthesis to your pipelines
- My Complete Homelab AI Stack — See the full infrastructure
n8n is open source with a fair-code license. Self-hosting is free for individuals. Support them at n8n.io.