LLM Node

Custom LLM node with dynamic model options

Actions2

Overview

This node provides an interface to interact with large language models (LLMs) via a customizable chat operation. It allows users to send prompts to selected LLM models and receive generated text responses. This is useful for automating content generation, answering questions, drafting messages, or any scenario where natural language understanding and generation are needed.

For example, you can use this node to:

  • Generate creative writing based on a prompt.
  • Automate customer support replies.
  • Summarize or rephrase text.
  • Build conversational agents or chatbots.

Properties

Name Meaning
Model Name or ID Select the LLM model to use from a dynamically loaded list or specify a custom model ID.
Prompt The input text prompt that you want the LLM to respond to.
Temperature Controls randomness in response generation; higher values produce more diverse outputs.
Max Tokens Maximum length of the generated response in tokens.
Top P Nucleus sampling parameter controlling token selection breadth (probability mass).
Top K Limits token selection to the top K most likely tokens at each step.
Saftey Settings : Hate Block Level of filtering for hate speech content: None, Low, Medium, High (only for certain Gemini models).
Saftey Settings : Harrasment Block Level of filtering for harassment content: None, Low, Medium, High (only for certain Gemini models).
Saftey Settings : Sexual Block Level of filtering for sexual content: None, Low, Medium, High (only for certain Gemini models).
Saftey Settings : Dangerous Content Block Level of filtering for dangerous content: None, Low, Medium, High (only for certain Gemini models).
JSON Response Option to receive the raw JSON response from the API instead of a simplified output (available for select models).

Output

The node outputs an array with one item per input. Each output item contains a json field with at least the following structure:

{
  "operation": "chat",
  "modelType": "selected-model-id"
}

The actual generated text response from the LLM is not explicitly shown in the provided code snippet, but typically it would be included in the output JSON under a relevant key (e.g., response or similar) after execution. If the "JSON Response" option is enabled for supported models, the output will include the full raw JSON returned by the LLM API.

No binary data output is indicated in the source code.

Dependencies

  • Requires an API key credential for authentication with the external LLM service.
  • Makes HTTP GET requests to https://ai.system.sl/llm-models to load available models dynamically.
  • The node depends on the external LLM API hosted at ai.system.sl.
  • Proper configuration of the API key credential in n8n is necessary for operation.

Troubleshooting

  • No credentials returned!: This error occurs if the API key credential is missing or invalid. Ensure the API key is correctly configured in n8n.
  • Invalid response from API: If the model list endpoint does not return an array, the node will fail to load models. Check network connectivity and API availability.
  • Error loading models: Network issues or incorrect API keys can cause failure to fetch model options. Verify credentials and internet access.
  • If the node returns errors during execution, enabling "Continue On Fail" can allow partial processing of multiple inputs.
  • Make sure to select compatible safety settings only for supported models (models/gemini-1.5-flash and models/gemini-1.5-pro).

Links and References

Discussion