airouter

AI-powered routing node for n8n workflows

Package Information

Downloads: 0 weekly / 10 monthly
Latest Version: 0.1.0
Author: QixYuanmeng

Documentation

n8n-nodes-airouter

n8n.io - Workflow Automation

AI-powered routing node for n8n workflows. This node allows you to create intelligent branch routing based on AI analysis of input text, similar to intent classification nodes in Dify or Coze.

Installation
Features
Usage
Configuration
Examples
Compatibility
Resources

Installation

Follow the installation guide in the n8n community nodes documentation.

# Install from npm (when published)
npm install n8n-nodes-airouter

# Or install locally for development
npm install /path/to/n8n-nodes-airouter

Features

  • AI-Powered Routing: Uses connected Chat Models (OpenAI, Anthropic, etc.) to analyze input and route to appropriate branches
  • Dynamic Branch Creation: Support for any number of custom branches
  • Fallback Handling: Automatic fallback routing for unmatched inputs or errors
  • Flexible Input: Supports any text field from previous nodes
  • Rich Configuration: Customizable system prompts, branch descriptions, and keywords
  • Error Handling: Configurable error handling with fallback options
  • Confidence Scoring: Optional AI confidence metrics in output

Usage

Basic Setup

  1. Connect a Chat Model: Link any n8n AI Language Model (OpenAI, Anthropic, etc.) to the second input
  2. Configure Input Text: Set the text field to analyze (default: {{$json.text || $json.message || $json.content}})
  3. Define Branches: Add branches with names and descriptions
  4. Connect Outputs: Connect each branch output to different workflow paths

Node Inputs

  • Main Input: The data flow containing text to analyze
  • Chat Model: Any n8n AI Language Model connection

Node Outputs

  • Branch Outputs: One output for each configured branch
  • Fallback Output: Default output for unmatched inputs or errors

Configuration

Input Text

The text field to analyze for routing decisions. Supports n8n expressions.

System Prompt

Customize the AI's instructions. The default prompt guides the AI to return exact branch names.

Branches

Configure routing branches with:

  • Branch Name: Used as output connection name and routing target
  • Description: Helps AI understand when to use this branch
  • Keywords: Optional comma-separated keywords for additional context

Options

  • Temperature: Controls AI randomness (0-2, default: 0.1)
  • Max Tokens: Maximum AI response length (default: 50)
  • Include Confidence: Add AI usage metrics to output
  • Fallback on Error: Route to fallback on AI failures (default: true)

Examples

Customer Support Routing

Branches:
- Name: "question"
  Description: "User is asking a question about products or services"
  Keywords: "what, how, when, where, why, question"

- Name: "complaint"
  Description: "User is expressing dissatisfaction or reporting issues"
  Keywords: "problem, issue, broken, not working, upset"

- Name: "request"
  Description: "User is requesting something specific or asking for help"
  Keywords: "please, can you, I need, help me"

Content Classification

Branches:
- Name: "technical"
  Description: "Technical documentation or programming content"
  Keywords: "code, API, programming, technical, development"

- Name: "marketing"
  Description: "Marketing, sales, or promotional content"
  Keywords: "sale, promotion, marketing, campaign, buy"

- Name: "support"
  Description: "Customer support or help documentation"
  Keywords: "help, support, tutorial, guide, how-to"

Output Data

Each output includes:

{
  "selectedBranch": "question",
  "aiDecision": "question",
  "inputText": "How does this product work?",
  "routingReason": "Matched branch: question",
  // ... original input data
}

Compatibility

  • Tested against n8n version 1.0+
  • Requires n8n AI Language Model connections
  • Compatible with OpenAI, Anthropic, and other supported AI providers

Development

To test the node locally:

# Clone the repository
git clone https://github.com/QixYuanmeng/n8n-nodes-airouter.git
cd n8n-nodes-airouter

# Install dependencies
pnpm install

# Build the node
pnpm run build

# Link for local testing
npm link
cd /path/to/your/n8n/installation
npm link n8n-nodes-airouter

Resources

License

MIT

Discussion