Brand Logo
Log in
RU Logo
RU Logo
Home
Courses
Guides
Workshops
Community
Perks
Support
Login

Guide

How to automatically switch between AI models for different tasks in n8n

GuideIntermediate

How to automatically switch between AI models for different tasks in n8n

n8n new model selector node lets you set up intelligent AI model routing that automatically selects the best model for each task 🧰 Who is this useful for: Developers who want specialized AI models for different coding languages Content creators needing different AI styles for various writing tasks Business users who want to optimize AI costs by using faster models for simple tasks Anyone looking to maximize AI performance by matching models to specific use cases STEP 1: Create Your Workflow Foundation Head over to n8n and create a new workflow in your personal space.

Required tools

None required

Updated

Jan 30, 2026

The Rundown: n8n new model selector node lets you set up intelligent AI model routing that automatically selects the best model for each task

🧰 Who is this useful for:

  • Developers who want specialized AI models for different coding languages
  • Content creators needing different AI styles for various writing tasks
  • Business users who want to optimize AI costs by using faster models for simple tasks
  • Anyone looking to maximize AI performance by matching models to specific use cases


STEP 1: Create Your Workflow Foundation

Head over to n8n and create a new workflow in your personal space.

Start by adding a "Chat Message" trigger as your entry point, this activates when you send a message.

Next, add an "AI Agent" component and connect it to your chat trigger. This serves as the brain that will process your requests using whichever model gets selected. For this tutorial, keep it simple without adding memory or tools.

Screenshot 2025-07-07 at 11.58.00 PM


STEP 2: Add and Configure Model Selector

Instead of selecting a single chat model for your AI Agent, choose "Model Selector" from the options. This is the new component that enables intelligent routing. You'll see options to configure multiple models, set this up for two models to start. Connect your API keys for each model you want to use (Gemini offers a free tier which makes it perfect for testing).

image-1936


STEP 3: Set Up Intelligent Routing Rules

Configure your model selection rules by setting up conditions for each model. For Model 1 (ChatGPT), create a rule that triggers when the message "contains" the word "code", this will route all coding-related requests to ChatGPT. For Model 2 (Gemini), leave the condition empty so it becomes the default for all other requests. You can create multiple rules based on keywords like "write," "summarize," or specific programming languages.

Screenshot 2025-07-07 at 11.57.15 PM


STEP 4: Test Your Smart AI Router

Test your setup with different types of messages to see the intelligent routing in action. Try "Hi, write a two sentence AI poem", this should route to Gemini since it doesn't contain "code." Then test with "Print hello world in Python code", this should automatically switch to ChatGPT because it contains your trigger keyword. You'll notice different response styles and capabilities based on which model handles each request.

Screenshot 2025-07-07 at 11.57.06 PM

Pro tip: Create multiple routing rules for different specializations, e.g., use Claude for creative writing, ChatGPT for coding, and Gemini for research tasks. You can even route based on complexity, sending simple questions to faster models and complex analysis to more powerful ones.

Instructors

Dr. Alvaro Cintas

Dr. Alvaro Cintas

PhD AI Professor

Published

July 7, 2025

Categories

General
HomeCoursesWorkshops