LLM Node

Custom LLM node with dynamic model options

Actions2

Overview

This node integrates with a large language model (LLM) API to perform two main operations: generating chat completions and processing videos based on prompts. It is useful for automating content generation, natural language understanding, or video analysis tasks that require AI-powered responses.

  • Chat operation: Sends a user prompt to an LLM and receives a text or JSON response generated by the model.
  • Video operation: Sends a prompt along with a video URL to the API for processing, which could involve video analysis or generating video-related insights.

Practical examples:

  • Automatically generate customer support replies or creative writing using the chat operation.
  • Analyze or extract information from videos by providing a video URL and a descriptive prompt.

Properties

Name Meaning
Model Name or ID Select an LLM model from a dynamically loaded list or specify a model ID via expression.
Prompt The input text prompt you want the LLM to respond to or use as context for video processing.

Note: For the "video" operation, only "Prompt" and "Video URL" (not listed in your provided properties but referenced in code) are relevant. The "Model Name or ID" property is hidden for the video operation.

Output

The node outputs an array of items where each item contains a json field with the API response:

  • For the chat operation, the json output contains the LLM-generated response, either as plain text or JSON depending on the jsonResponse setting.
  • For the video operation, the json output contains the processed video data returned by the API, typically including analysis or metadata related to the video and prompt.

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 requests to the API endpoints:
    • https://ai.system.sl/llm-models to load available models.
    • ${domain}/llms for chat completions.
    • ${domain}/process-video for video processing.
  • The domain and API key are obtained from the configured credentials.
  • The node expects the API to return JSON responses.

Troubleshooting

  • No credentials returned!
    This error occurs if the required API key credential is not set up or accessible. Ensure the API key is correctly configured in n8n credentials.

  • Invalid response from API: Expected an array of models.
    Happens when loading models fails or the API returns unexpected data. Check API availability and credentials.

  • API request errors (network issues, invalid parameters)
    The node throws errors if the API call fails. Use "Continue On Fail" option to handle errors gracefully.

  • Missing "videoUrl" parameter for video operation
    Although not explicitly defined in the provided properties, the code expects a videoUrl parameter for the video operation. Make sure to provide this input to avoid runtime errors.

Links and References

  • n8n Expressions Documentation — for using expressions in property values.
  • External API documentation (not provided) for the LLM service at https://ai.system.sl.

If you want me to analyze other operations or resources, or provide details on additional properties, please let me know!

Discussion