Chat Completion
AI-generatedSummary
Send a chat completion request to a specified OpenRouter model with a customizable conversation history and sampling parameters, returning the model's generated response content along with usage details and metadata.
Inputs
- Model (required) — Specify the OpenRouter model ID to use for the chat completion (e.g., openai/gpt-4o-mini).
- Messages (required) — Provide a list of messages forming the conversation history to send to the model; each message includes the author's role (system, user, assistant) and content.
- Options — Optional parameters to customize the chat completion including temperature (0-2), max tokens to generate, JSON output mode toggle, top_p nucleus sampling (0-1), frequency penalty (-2 to 2), and presence penalty (-2 to 2).
Output shape
a single JSON object containing the completion content, model used, finish reason, usage token counts, response id, and the original input data.
If the OpenRouter API returns an error, the node throws an error unless 'continue on fail' is enabled, in which case the error message returns per item. The response includes telemetry logged asynchronously. The 'content' field holds the main textual completion output from the model.