Skip to main content

🔐🦙Private & local Ollama self-hosted + dynamic LLM router

Workflow preview

Workflow preview
100%
🔐🦙Private & local Ollama self-hosted + dynamic LLM router preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

Who is this for? This workflow template is designed for AI enthusiasts , developers , and privacy conscious users who want to leverage the power of local large language models (LLMs) without sendin...

Best for

  • Engineering automation workflows
  • AI Chatbot automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

@n8n/n8n-nodes-langchain.chattrigger, n8n-nodes-base.stickynote, @n8n/n8n-nodes-langchain.lmchatollama, @n8n/n8n-nodes-langchain.agent, @n8n/n8n-nodes-langchain.memorybufferwindow

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Joseph LePage.

Original n8n.io source

1.1 Workflow description

Title
🔐🦙Private & local Ollama self-hosted + dynamic LLM router
Workflow name
🔐🦙Private & local Ollama self-hosted + dynamic LLM router

Who is this for?

This workflow template is designed for AI enthusiasts, developers, and privacy-conscious users who want to leverage the power of local large language models (LLMs) without sending data to external services. It's particularly valuable for those running Ollama locally who want intelligent routing between different specialized models.

What problem is this workflow solving?

When working with multiple local LLMs, each with different strengths and capabilities, it can be challenging to manually select the right model for each specific task. This workflow automatically analyzes user prompts and routes them to the most appropriate specialized Ollama model, ensuring optimal performance without requiring technical knowledge from the end user.

What this workflow does

This intelligent router:

  • Analyzes incoming user prompts to determine the nature of the request
  • Automatically selects the optimal Ollama model from your local collection based on task requirements
  • Routes requests between specialized models for different tasks:
    • Text-only models (qwq, llama3.2, phi4) for various reasoning and conversation tasks
    • Code-specific models (qwen2.5-coder) for programming assistance
    • Vision-capable models (granite3.2-vision, llama3.2-vision) for image analysis
  • Maintains conversation memory for consistent interactions
  • Processes everything locally for complete privacy and data security

Setup

  1. Ensure you have Ollama installed and running locally
  2. Pull the required models mentioned in the workflow using Ollama CLI (e.g., ollama pull phi4)
  3. Configure the Ollama API credentials in n8n (default: http://127.0.0.1:11434)
  4. Activate the workflow and start interacting through the chat interface

How to customize this workflow to your needs

  • Add or remove models from the router's decision framework based on your specific Ollama collection
  • Adjust the system prompts in the LLM Router to prioritize different model selection criteria
  • Modify the decision tree logic to better suit your specific use cases
  • Add additional preprocessing steps for specialized inputs

This workflow demonstrates how n8n can be used to create sophisticated AI orchestration systems that respect user privacy by keeping everything local while still providing intelligent model selection capabilities.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - When chat message received

Type / Role
@n8n/n8n-nodes-langchain.chatTrigger - chatTrigger
Config choices
Version 1.1

Block 2 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 3 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 4 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 5 - Sticky Note3

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 6 - Ollama Dynamic LLM

Type / Role
@n8n/n8n-nodes-langchain.lmChatOllama - lmChatOllama
Config choices
Version 1

Block 7 - LLM Router

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 1.7

Block 8 - AI Agent with Dynamic LLM

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 1.7

Block 9 - Ollama phi4

Type / Role
@n8n/n8n-nodes-langchain.lmChatOllama - lmChatOllama
Config choices
Version 1

Block 10 - Router Chat Memory

Type / Role
@n8n/n8n-nodes-langchain.memoryBufferWindow - memoryBufferWindow
Config choices
Version 1.3

Block 11 - Agent Chat Memory

Type / Role
@n8n/n8n-nodes-langchain.memoryBufferWindow - memoryBufferWindow
Config choices
Version 1.3

Block 12 - Sticky Note7

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 13 - Sticky Note4

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 14 - Sticky Note8

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 15 - Sticky Note9

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 16 - Sticky Note5

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

3. Summary Table

Workflow 🔐🦙Private & local Ollama self-hosted + dynamic LLM router
Complexity advanced
Nodes 16
Categories Engineering, AI Chatbot
Author Joseph LePage
Published 12 Mar 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/3139/3139.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does 🔐🦙Private & local Ollama self-hosted + dynamic LLM router do?

Who is this for? This workflow template is designed for AI enthusiasts , developers , and privacy conscious users who want to leverage the power of local large language models (LLMs) without sendin...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Engineering, AI Chatbot use case.