Uploaded October 2025 | Updated September 2026, 1 day ago
In this step-by-step lab, we build a cost-savvy “mixture of experts” flow in n8n using self-hosted models on Ollama. A lightweight model classifies each incoming chat prompt (reasoning, coding, or other) and then routes it to the most appropriate agent/model—so you only pay the “big model tax” when you actually need to.
What we build:
A prompt router in n8n using the Text Classifier node + AI Agent nodes
Classifier model: deepseek-r1:1.5b (fast, cheap, good enough for routing)
Reasoning agent: deepseek-r1:7b (use the heavy model only when necessary)
Coding agent: codellama:latest (optimized for Python, JSON, Node.js, iRules, etc.)
General agent: deepseek-r1:1.5b or llama3.2:3b (budget-friendly generalist)
Why it matters:
Reduce AI costs and latency by matching the model to the job
Keep n8n responsive by running models on a separate host
Learn a practical pattern you can extend to Slack, ticketing, or internal tools
Prereqs:
Complete our Ollama Basics and n8n Installation labs
Docker installed (host networking configured)
Optional but recommended: NVIDIA GPU on the model server
Notes:
- Contributed by: Aubrey King
- Related Article: None
00:00 Introduction
01:36 Prerequisites
02:49 Configure LLM host
05:18 Configure app host
06:56 Configure n8n
09:04 Chat trigger and text classifier
18:17 Reasoning Agent
19:51 Coding Agent
20:45 Fallback Agent
21:32 Time To Test!
23:59 Where to go next?
⬇️⬇️⬇️ JOIN THE COMMUNITY! ⬇️⬇️⬇️
DevCentral is an online community of technical peers dedicated to learning, exchanging ideas, and solving problems - together.
Find all our platform links ⬇️ and follow our Community Evangelists! 👋
➡️ DEVCENTRAL: community.f5.com
➡️ YOUTUBE: youtube.com/devcentral
➡️ LINKEDIN: linkedin.com/showcase/f5-devcentral
➡️ TWITTER: twitter.com/devcentral
Your Community Evangelists:
👋 Jason Rahm: linkedin.com/in/jrahm | twitter.com/jasonrahm
👋 Buu Lam: linkedin.com/in/buulam | twitter.com/buulam
👋 Aubrey King: linkedin.com/in/aubreyking | twitter.com/aubreykingf5
👋 Chase Abbott: linkedin.com/in/chaseabbott1
In this step-by-step lab, we build a cost-savvy “mixture of experts” flow in n8n using self-hosted models on Ollama. A lightweight model classifies each incoming chat prompt (reasoning, coding, or other) and then routes it to the most appropriate agent/model—so you only pay the “big model tax” when you actually need to.
What we build:
A prompt router in n8n using the Text Classifier node + AI Agent nodes
Classifier model: deepseek-r1:1.5b (fast, cheap, good enough for routing)
Reasoning agent: deepseek-r1:7b (use the heavy model only when necessary)
Coding agent: codellama:latest (optimized for Python, JSON, Node.js, iRules, etc.)
General agent: deepseek-r1:1.5b or llama3.2:3b (budget-friendly generalist)
Why it matters:
Reduce AI costs and latency by matching the model to the job
Keep n8n responsive by running models on a separate host
Learn a practical pattern you can extend to Slack, ticketing, or internal tools
Prereqs:
Complete our Ollama Basics and n8n Installation labs
Docker installed (host networking configured)
Optional but recommended: NVIDIA GPU on the model server
Notes:
- Contributed by: Aubrey King
- Related Article: None
00:00 Introduction
01:36 Prerequisites
02:49 Configure LLM host
05:18 Configure app host
06:56 Configure n8n
09:04 Chat trigger and text classifier
18:17 Reasoning Agent
19:51 Coding Agent
20:45 Fallback Agent
21:32 Time To Test!
23:59 Where to go next?
⬇️⬇️⬇️ JOIN THE COMMUNITY! ⬇️⬇️⬇️
DevCentral is an online community of technical peers dedicated to learning, exchanging ideas, and solving problems - together.
Find all our platform links ⬇️ and follow our Community Evangelists! 👋
➡️ DEVCENTRAL: community.f5.com
➡️ YOUTUBE: youtube.com/devcentral
➡️ LINKEDIN: linkedin.com/showcase/f5-devcentral
➡️ TWITTER: twitter.com/devcentral
Your Community Evangelists:
👋 Jason Rahm: linkedin.com/in/jrahm | twitter.com/jasonrahm
👋 Buu Lam: linkedin.com/in/buulam | twitter.com/buulam
👋 Aubrey King: linkedin.com/in/aubreyking | twitter.com/aubreykingf5
👋 Chase Abbott: linkedin.com/in/chaseabbott1










