AutomationMart
Home/Browse/Dynamic AI model router for query optimization with OpenRouter
n8n

Dynamic AI model router for query optimization with OpenRouter

n8nn8n8 modulesv1.0
OpenAILinkedInPerplexity

The Agent Decisioner is a dynamic, AI-powered routing system that automatically selects the most appropriate large language model (LLM) to respond to a user's query based on the query’s content and purpose. This workflow ensures dynamic, optimized AI responses by intelligently routing queries to the best-suited model. --- Advantages 🔁 Automatic Model Routing: Automatically selects the best model for the job, improving efficiency and relevance of responses. 🎯 Opti

At a glance

Dynamic AI model router for query optimization with OpenRouter is a ready-made n8n workflow you import as a workflow JSON file — no build required. It connects OpenAI, LinkedIn, Perplexity. It's free to download. Follow the 5-step import below to go live in minutes.

Platform
n8n
Connects
OpenAI, LinkedIn, Perplexity
Modules
8
Price
Free
Version
v1.0
Dynamic AI model router for query optimization with OpenRouter workflow diagram

About this workflow

The Agent Decisioner is a dynamic, AI-powered routing system that automatically selects the most appropriate large language model (LLM) to respond to a user's query based on the query’s content and purpose. This workflow ensures dynamic, optimized AI responses by intelligently routing queries to the best-suited model. --- Advantages 🔁 Automatic Model Routing: Automatically selects the best model for the job, improving efficiency and relevance of responses. 🎯 Optimized Use of Resources: Avoids overuse of expensive models like GPT-4 by routing simpler queries to lightweight models. 📚 Model-Aware Reasoning: Uses detailed metadata about model capabilities (e.g., reasoning, coding, web search) for intelligent selection. 📥 Modular and Extendable: Easy to integrate with other tools or expand by adding more models or custom decision logic. 👨‍💻 Ideal for RAG and Multi-Agent Systems: Can serve as the brain behind more complex agent frameworks or Retrieval-Augmented Generation pipelines. --- How It Works 1. Chat Trigger: The workflow starts when a user sends a message, triggering the Routing Agent. 2. Model Selection: The AI Agent analyzes the query and selects the best-suited model from the available options (e.g., Claude 3.7 Sonnet for coding, Perplexity/Sonar for web searches, GPT-4o Mini for reasoning). 3. Structured Output: The agent returns a JSON response with the user’s prompt and the chosen model. 4. Execution: The selected model processes the query and generates a response, ensuring optimal performance for the task. Set Up Steps 1. Configure Nodes: - Chat Trigger: Set up the webhook to receive user messages. - Routing Agent (AI Agent): Define the system message with model strengths and JSON output rules. - OpenRouter Chat Model: Connect to OpenRouter for model access. - Structured Output Parser: Ensure it validates the JSON response format (prompt + model). - Execution Agent (AI Agent1): Configure it to forward the prompt to the selected model. 2. Connect Nodes: - Link the Chat Trigger to the Routing Agent. - Connect the OpenRouter Chat Model and Output Parser to the Routing Agent. - Route the parsed JSON to the Execution Agent, which uses the chosen model via OpenRouter Chat Model1. 3. Credentials: - Ensure OpenRouter API credentials are correctly set for both chat model nodes. 4. Test & Deploy: - Activate the workflow and test with sample queries to verify model selection logic. - Adjust the routing rules if needed for better accuracy. --- Need help customizing? Contact me for consulting and support or add me on Linkedin.

n8n

How to import this n8n workflow

  1. 1

    Download the workflow JSON file after purchase.

  2. 2

    Open n8n → click the menu → Import from File.

  3. 3

    Select the downloaded JSON and import.

  4. 4

    Set up credentials for each node that requires them.

  5. 5

    Click Execute Workflow to test, then activate.

Setup guide

Setup guide included

Purchase to unlock the full step-by-step guide

Related N8n workflows

🤖🔍 The ultimate free AI-powered researcher with Tavily web search & extract

This n8n workflow integrates Tavily's search and extract APIs with AI summarization capabilities to process web content efficiently. Quick Setup 1. Get your Tavily API key from 2. Replace tvly-YOURAPIKEY in the "Tavily API Key" node 3. Connect your OpenAI credentials to the "OpenAI Chat Model" node 4. Deploy the workflow and start the chat trigger Core Features Search & Extract 🎯 - Intelligent web searching with relevance filtering - Automated content extraction from top results - AI-powered co

Free

Send Notion items to ChatGPT and update your database with the results

Enhance your database through AI-powered ChatGPT by sending Notion items to automatically refine, update, and optimize your data, ensuring optimal performance and organization.

Free

Generate weekly Seed & Series A scouting reports with PredictLeads and OpenAI

Monitor a company watchlist for new Seed and Series A funding rounds and deliver a formatted weekly scouting report via email and Slack. This workflow reads company domains from a Google Sheets watchlist, checks each one for recent financing events via the PredictLeads Financing Events API, filters for Seed and Series A rounds from the past 7 days, then uses OpenAI to generate a professional weekly scouting report with a summary table and trend analysis. The report is delivered via Gmail and Sla

Free

Create a new Google Sheets row for every new email received using ChatGPT to summarize the content

Automatically summarize new emails with ChatGPT and add them as new rows in Google Sheets. Streamline email management and data organization effortlessly.

Free

Ai email triage & alert system with GPT-4 and Telegram notifications

Fully Automated AI Email System for n8n: Triage, Summarize & Alert—Never Check Your Inbox Again! Fully Automated Email Intelligence: Triage, Summarize, Escalate & Alert—Never Check Your Inbox Again 🚀 Overview Turn every minute you waste in your inbox into revenue‑generating focus time. This is more than a workflow—it’s a profit engine disguised as an email assistant. ⚙️ Eliminate 90 % of inbox noise with AI triage and smart labeling. 🚨 Instantly surface high‑value leads & crises via Telegram pus

Free

AI voice chatbot with ElevenLabs & OpenAI for customer service and restaurants

The "Voice RAG Chatbot with ElevenLabs and OpenAI" workflow in n8n is designed to create an interactive voice-based chatbot system that leverages both text and voice inputs for providing information. Ideal for shops, commercial activities and restaurants How it works: Here's how it operates: 1. Webhook Activation: The process begins when a user interacts with the voice agent set up on ElevenLabs, triggering a webhook in n8n. This webhook sends a question from the user to the AI Agent node. 2. AI

Free

Build a RAG knowledge base from PDFs with Gemini, Supabase and Google Sheets

Quick Overview This workflow ingests educational PDF URLs from Google Sheets, extracts and chunks their text, generates embeddings with Google Gemini, and stores them in a Supabase pgvector table for retrieval, while also exposing a public chat webhook that answers questions using Gemini and the same Supabase knowledge base. How it works 1. Runs every hour on a schedule and reads rows from a Google Sheets document, keeping only entries where the status is empty. 2. Processes each queued URL one

Free

Effortless email management with AI-powered summarization & review

How it Works This workflow automates the handling of incoming emails, summarizes their content, generates appropriate responses using a retrieval-augmented generation (RAG) approach, and obtains approval or suggestions before sending replies. Below is an explanation of its functionality divided into two main sections: 1. Email Handling and Summarization: - The process begins with the Email Trigger (IMAP) node which listens for new emails in a specified inbox. - Once an email is received, the M

Free

Reviews

No reviews yet

Be the first to buy and share your experience.

Leave a review

Sign in to share your experience with this workflow.

Log in to review
Free
No ratings yet

Create a free account to purchase workflows.

  • JSON blueprint — instant download
  • Setup guide PDF included
  • 5 downloads · valid 30 days
  • Works with n8n

Need help setting this up?

Book a 3-hour live setup session with an Agility consultant.

₹2,499/ session
3 hrs · video call
  • Configure live on Google Meet / Zoom
  • Free follow-up if workflow has defects
  • Platform expert assigned to you
Book installation session
Free