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 text prompt to an LLM and receives a generated response. This can be used for chatbot interactions, content creation, summarization, or any scenario where you want the AI to generate or complete text.
  • Video operation: Sends a prompt along with a video URL to the API for processing. This could be used for video captioning, analysis, or extracting insights from video content.

Practical examples:

  • Automatically generate customer support replies based on user queries.
  • Create video summaries or extract metadata by providing a video URL and a descriptive prompt.

Properties

Name Meaning
Model Name or ID Select the AI model to use from a dynamically loaded list or specify an 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 these two properties are relevant according to your filter.

Output

The node outputs an array of items, each containing a json field with the API response:

  • For the video operation, the JSON contains the processed video data returned by the API. The exact structure depends on the external service but typically includes analysis results or generated content related to the video.
  • No binary data output is indicated in the code.

Example output structure (simplified):

{
  "json": {
    "result": "...",
    "metadata": { ... }
  }
}

If an error occurs during execution and "Continue On Fail" is enabled, the output item will contain an error message inside the json field.

Dependencies

  • Requires an API key credential for authentication with the external AI service.
  • The node makes HTTP requests to the service domain specified in the credentials.
  • The API endpoints used are:
    • /process-video for video processing.
    • /llms for chat completions (not relevant here since operation is "video").
  • The node expects the API to accept and return JSON-formatted data.

Troubleshooting

  • No credentials returned!
    This error indicates missing or misconfigured API credentials. Ensure the API key credential is set up correctly in n8n.

  • Error loading models (not directly relevant for video operation but part of the node):
    Could occur if the API endpoint for fetching models is unreachable or returns invalid data.

  • API request failures:
    Network issues, invalid API keys, or malformed requests may cause errors. Check the API key validity, network connectivity, and property values.

  • If the node throws errors during execution, enabling "Continue On Fail" allows the workflow to continue and provides error details in the output for debugging.

Links and References

  • n8n Expressions Documentation — for using expressions in property fields like Model Name or ID.
  • External API documentation (not provided in source) would be needed for detailed info on /process-video endpoint and expected response formats.

Discussion