Model Selector#
The Model Selector node dynamically selects one of the connected language models during workflow execution based on a set of defined conditions. This enables implementing fallback mechanisms for error handling or choosing the optimal model for specific tasks.
This page covers node parameters for the Model Selector node and includes links to related resources.
Parameter resolution in sub-nodes
Sub-nodes behave differently to other nodes when processing multiple items using an expression.
Most nodes, including root nodes, take any number of items as input, process these items, and output the results. You can use expressions to refer to input items, and the node resolves the expression for each item in turn. For example, given an input of five name
values, the expression {{ $json.name }}
resolves to each name in turn.
In sub-nodes, the expression always resolves to the first item. For example, given an input of five name
values, the expression {{ $json.name }}
always resolves to the first name.
Node parameters#
Number of Inputs#
Specifies the number of input connections available for attaching language models.
Rules#
Each rule defines the model to use when specific conditions match.
The Model Selector node evaluates rules sequentially, starting from the first input, and stops evaluation as soon as it finds a match. This means that if multiple rules would match, n8n will only use the model defined by the first matching rule.
Templates and examples#
Related resources#
View n8n's Advanced AI documentation.