Dynamic AI Model Selector and Configuration Updater - n8n Workflow

A sophisticated n8n workflow that dynamically updates form dropdowns with available AI models using the n8n node for self-configuration, enabling compliant AI chat interfaces.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Advanced n8n users requiring dynamic configuration updates.

  • Developers leveraging AI routing layers (like Requesty.ai) for compliance and model agility.

  • Teams needing persistent state management within an n8n workflow using Google Sheets.

  • Users building custom AI applications based on reusable n8n templates.

Overview

This dynamic n8n workflow provides a robust solution for environments where AI model availability frequently changes or where strict data governance (like GDPR) requires routing through a secure proxy. The core innovation of this n8n template lies in its two-phase operation: a Configuration Phase and an Execution Phase.

The Configuration Phase runs manually (or on a schedule) to fetch the latest list of available models from an external API (Requesty.ai). It then uses the powerful n8n node for self-modification, updating the options available in the primary ‘Model Selection Form’ n8n trigger. This ensures users always see the most current models.

The Execution Phase provides a user-friendly chat interface. When activated, the n8n workflow reads the user's stored model preference from Google Sheets and routes the prompt through the compliant Requesty.ai service, returning the AI generation directly to the user's chat window. This approach ensures maximum flexibility and adherence to corporate compliance standards within a single, powerful n8n workflow.

How it Works

The process is divided into two distinct logical branches within this n8n workflow:

Phase 1: Dynamic Workflow Configuration


  1. Initialize Workflow: The manual n8n trigger starts the update process.

  2. Fetch Available Models: An HTTP Request n8n node connects to Requesty.ai to retrieve the current list of available coding models.

  3. Data Processing: The data is split and the Extract Model IDs n8n node isolates just the model identifier strings.

  4. Self-Retrieval: The Get Current Workflow n8n node fetches the running n8n workflow's JSON definition.

  5. Data Merge and Update: The Merge Data and Update Dropdown Options (Code n8n node) combine the workflow definition and the new model IDs. The code intelligently parses the JSON, locates the specific formTrigger n8n node, and overwrites its dropdown choices.

  6. Update Workflow: The final Update Workflow n8n node saves the modified JSON back to the n8n instance, instantly updating the model selection form.

Phase 2: AI Execution and State Management


  1. Model Selection Form: A user interacts with this n8n trigger, selecting a preferred AI model from the dynamically updated dropdown.

  2. State Persistence: The selected model is saved to a specified Google Sheet (Current_Model) after clearing the previous entry, providing a persistent state for subsequent AI queries.

  3. Chat Interface: The LangChain Chat n8n trigger activates, receiving the user's prompt.

  4. Retrieve State: The n8n workflow reads the currently active model ID from Google Sheets using the Read Current Model n8n node.

  5. AI API Request: The selected model and the user's prompt are sent to the Requesty.ai chat completion endpoint. This ensures the chat is processed using the user's chosen, compliant model.

  6. Format and Output: The response is extracted and formatted by the final Code n8n node, delivering the AI's content back to the Chat Interface n8n trigger.

Installation Guide

To set up this dynamic n8n workflow, follow these steps:


  1. Import: Copy the provided JSON code and import it into your n8n instance as a new n8n workflow.

  2. Credentials: Set up the required credentials:

Requesty API: Configure a Generic Credential (HTTP Header Auth) providing your Requesty API Key for the AI API Request n8n node.
Google Sheets: Configure a Google Sheets credential. Replace the placeholder YOURGOOGLESHEETID in the Save Model Selection, Clear Previous Selection, and Read Current Model n8n node parameters with the ID of your target spreadsheet.

  1. Google Sheet Setup: Ensure your Google Sheet contains a tab named CurrentModel where the workflow can store the selected AI model.

  2. Initial Configuration: Manually execute the Initialize Workflow n8n trigger to run the Configuration Phase. This action will update the Model Selection Form with the available AI models fetched via Requesty.ai.

  3. Activation: Activate the n8n workflow. The Model Selection Form and Chat Interface n8n trigger nodes are now ready for interaction via their respective webhooks.

Node Details

Initialize Workflow (Manual Trigger): The starting point for the workflow configuration process.
Fetch Available Models (HTTP Request n8n node): Calls the external AI routing API (Requesty.ai) to gather a list of potential models, a critical first step for this dynamic n8n workflow.
Get Current Workflow (n8n node): Reads the current state and structure of the running n8n workflow, necessary for self-modification.
Update Dropdown Options (Code n8n node): Contains the core logic for parsing the workflow JSON and injecting the newly fetched model IDs into the settings of the Model Selection Form n8n trigger. This is a key piece of core logic flow control.
Update Workflow (n8n node): Saves the modified workflow definition, finalizing the dynamic configuration update.
Model Selection Form (Form Trigger n8n trigger): The user interface where the dynamic dropdown (updated in Phase 1) is displayed, allowing selection of the preferred AI model.
Google Sheets Nodes (Clear Previous Selection, Save Model Selection, Read Current Model): Used to manage and persist the user's current AI model choice across execution runs of this n8n workflow.
Chat Interface (LangChain Chat Trigger n8n trigger): Serves as the interactive endpoint where users submit prompts.


  • AI API Request (HTTP Request n8n node): Routes the chat prompt to Requesty.ai, using the model dynamically retrieved from Google Sheets and the input from the Chat Interface n8n trigger.

Related n8n Workflows

Free

Nodes: 12 Nodes
Updated: December 26 2025
View all
Created by
Stefan
Stefan

Featured*