OpenRouter Chat Model with Datadog
AI-generatedOverview
This node integrates OpenRouter's chat models with Datadog tracing for advanced AI chain usage. It allows users to generate AI completions using OpenRouter models while simultaneously sending detailed trace data to Datadog for monitoring and debugging. This is beneficial for workflows requiring AI-generated content with observability into the AI request lifecycle, such as tracking performance, debugging, and analyzing usage patterns.
Use Case Examples
- Generating AI chat completions with OpenRouter models while capturing trace data in Datadog for monitoring and troubleshooting.
- Using custom tags and metadata to enrich Datadog traces for better trace grouping and attribution in complex workflows.
Properties
| Name | Meaning |
|---|---|
| Credential | API credentials for OpenRouter and Datadog integration, required for authentication. |
| Datadog Metadata | Collection of optional metadata fields to customize Datadog tracing, including custom tags, debug mode, environment, service name, session ID, user ID, and version. |
| Model | The AI model to use for generating completions, selectable from a list or by specifying an ID. |
| Options | Additional options for the AI request such as base URL, frequency penalty, max retries, max tokens, presence penalty, reasoning effort, response format, temperature, timeout, and top P. |
Output
JSON
response- The instantiated ChatOpenAI model object with active Datadog and internal tracing callbacks.
Dependencies
- OpenRouter API credentials
- Datadog API key and site information
Troubleshooting
- Ensure valid OpenRouter and Datadog credentials are provided to avoid authentication errors.
- If debug mode is enabled, check logs for detailed tracing information to diagnose issues with span creation or flushing.
- When using JSON response format, include the word 'json' in prompts and select compatible models released after November 2023 to avoid format errors.
- Verify the base URL if overriding defaults to ensure compatibility with the selected model and features.
Links
- OpenRouter Models - Information about available OpenRouter AI models.
- n8n OpenRouter Chat Model Documentation - Official documentation for the OpenRouter Chat Model node in n8n.