Skip to content
AI Orchestrator: dynamically Selects Models Based on Input Type logo

AI Orchestrator: dynamically Selects Models Based on Input Type

Verified

Routes chat queries to optimal LLMs based on request classification.

n8nAI & LLMIntermediate👁 5.4K views
Open template
Updated 2026-06-16

What this workflow does

This n8n workflow classifies incoming chat requests and dynamically routes them to the most suitable LLM among Anthropic, OpenAI, Gemini, or OpenRouter models before generating a response through the AI Agent.

It is intended for developers and teams building scalable AI chat applications that need cost-efficient model selection and session-aware memory without manual routing logic.

Who is this for?

AI engineers and product teams running chat interfaces who need to balance cost, speed, and quality across multiple LLMs without manual routing.

What problem it solves

Teams waste money and latency by sending every query to the same heavy model; this workflow classifies requests first then routes them automatically to the right model.

Live workflow preview

Interactive canvas of every node and connection — scroll and click to explore. Powered by n8n's preview.

Open the template on n8n to import and run it. View source template →

What it automates

Customer support chatbot

Routes simple FAQs to Gemini Flash while sending complex troubleshooting to Claude Opus.

Internal dev assistant

Sends code questions to the coding-optimized model and general questions to a cheaper fast model.

Research agent interface

Classifies reasoning-heavy prompts and forwards them to Gemini Thinking while keeping general queries on GPT-4.1-mini.

How the workflow works

The 9 nodes in this automation, in order.

  1. 1AI Agent@n8n/n8n-nodes-langchain.agent
  2. 2Basic LLM Chain@n8n/n8n-nodes-langchain.chainLlm
  3. 3Anthropic Chat Model@n8n/n8n-nodes-langchain.lmChatAnthropic
  4. 4OpenAI Chat Model@n8n/n8n-nodes-langchain.lmChatOpenAi
  5. 5Simple Memory@n8n/n8n-nodes-langchain.memoryBufferWindow
  6. 6Structured Output Parser@n8n/n8n-nodes-langchain.outputParserStructured
  7. 7Google Gemini Chat Model@n8n/n8n-nodes-langchain.lmChatGoogleGemini
  8. 8OpenRouter Chat Model@n8n/n8n-nodes-langchain.lmChatOpenRouter
  9. 9Model Selector@n8n/n8n-nodes-langchain.modelSelector

Apps & integrations used

AI AgentBasic LLM ChainAnthropic Chat ModelOpenAI Chat ModelSimple MemoryStructured Output ParserGoogle Gemini Chat ModelOpenRouter Chat ModelModel Selector

How to set up AI Orchestrator: dynamically Selects Models Based on Input Type

  1. 1Add When chat message received trigger and connect chatInput + sessionId.
  2. 2Insert Request Type node using OpenAI Chat Model (gpt-4.1-mini) plus Structured Output Parser for the four categories.
  3. 3Wire the classification output into Model Selector node.
  4. 4Connect Model Selector branches to the matching chat models (Anthropic, Gemini, OpenRouter).
  5. 5Attach Simple Memory using sessionId for conversation history.
  6. 6Wrap final execution in Basic LLM Chain or AI Agent node.

How to customize this workflow

  • Swap the classifier model or add new request categories in the Structured Output Parser.
  • Replace any downstream model via OpenRouter or direct provider credentials.
  • Change trigger from chat message to webhook or form submission.
  • Insert an extra AI Agent step before model execution for tool use.

AI Orchestrator: dynamically Selects Models Based on Input Type: pros & cons

Pros

  • +Reduces spend by matching model size to task
  • +Clear separation of classification and execution logic
  • +Easy to extend with new models or categories
  • +Supports per-session memory out of the box

Cons

  • Requires API keys from multiple providers
  • Classification errors can send queries to the wrong model
  • Adds one extra LLM call before the final response
Did you find this helpful?

Frequently asked questions

It classifies incoming chat messages and routes each to the most suitable LLM among the connected models.

User reviews

Verified reviews from the community shape this listing's rating.

Loading reviews…

Sign in to review

Promote AI Orchestrator: dynamically Selects Models Based on Input Type

Add this badge to your website, or share the tool.

DFeatured on DhanasviAI Orchestrator: dynamically Selects Models Based on Input Type 0