OpenRouter icon

OpenRouter

Interact with OpenRouter API

Overview

This node interacts with the OpenRouter API to send chat messages to a specified chat model. It is useful for automating conversations, generating responses, or integrating AI chat capabilities into workflows. For example, it can be used to create a customer support chatbot, generate creative writing prompts, or assist with information retrieval based on user input.

Use Case Examples

  1. Sending a user message to an AI chat model and receiving a generated response.
  2. Setting a system prompt to guide the assistant's behavior before sending user messages.
  3. Adjusting parameters like temperature and max tokens to control the creativity and length of the responses.

Properties

Name Meaning
Model Name or ID Specifies the chat model to use for generating responses. Can be selected from a list or provided as an ID.
System Prompt A system message that sets the behavior or context of the assistant before user messages are processed.
Message The user message to send to the chat model for generating a response.
Temperature Controls the randomness of the output. Higher values produce more creative responses.
Additional Fields Optional parameters to fine-tune the chat completion, including frequency penalty, max tokens, presence penalty, and top_p sampling.

Output

JSON

  • response - The generated chat response from the OpenRouter API.

Dependencies

  • Requires an API key credential for OpenRouter API authentication.

Troubleshooting

  • Common issues include invalid or missing API key, resulting in authentication errors.
  • Invalid response format errors may occur if the API response does not contain the expected message content.
  • Network or request errors can happen if the OpenRouter API endpoint is unreachable or returns an error status.

Links

Discussion