Back to Nodes

OpenRouter Chat Model with Datadog

Last updated Nov 17, 2025

n8n community node: Datadog LLM Observability + OpenRouter LLM provider

3 Weekly Downloads
537 Monthly Downloads

Included Nodes

OpenRouter Chat Model with Datadog

Description

n8n-nodes-openrouter-datadog

n8n community node for OpenRouter LLM provider with Datadog LLM Observability integration.

Example Workflow

Features

  • Support for OpenRouter chat models (e.g., openai/gpt-4o-mini, anthropic/claude-3-opus)
  • Automatic Datadog LLM Observability tracing for every LLM request and response
  • Custom metadata injection: sessionId, userId, and structured tags for trace enrichment
  • Access to 100+ models from various providers through OpenRouter
  • Full LangChain compatibility for use in AI chains and agents

Datadog LLM Observability Trace

n8n is a fair-code licensed workflow automation platform.

Installation
Credentials
Operations
Compatibility
Development
Resources

Installation

Follow the installation guide in the official n8n documentation for community nodes.

Community Nodes (Recommended)

For n8n v0.187+, install directly from the UI:

  1. Go to Settings → Community Nodes
  2. Click Install
  3. Enter @wdaan/n8n-nodes-openrouter-datadog in Enter npm package name
  4. Agree to the risks of using community nodes
  5. Select Install

Note: If using GitHub Packages, you may need to configure npm authentication first (see Manual Installation section).

Manual Installation

For a standard installation:

# Go to your n8n installation directory
cd ~/.n8n 
# Install the node from GitHub Packages
npm install @wdaan/n8n-nodes-openrouter-datadog
# Restart n8n to apply the node
n8n start

Note: If installing from GitHub Packages, you may need to configure npm to authenticate with GitHub Packages. Create or update your ~/.npmrc file:

@wdaan:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=YOUR_GITHUB_TOKEN

Credentials

This credential is used to:

  • Authenticate your OpenRouter API endpoint
  • Configure Datadog LLM Observability tracing to send structured request/response data to your Datadog instance

Credential Setup

OpenRouter Settings

Field Name Description Example
OpenRouter API Key Your API key for accessing the OpenRouter endpoint sk-or-v1-xxx...
OpenRouter Base URL Full URL to your OpenRouter endpoint default: https://openrouter.ai/api/v1

Datadog Settings

Field Name Description Example
Datadog API Key Your Datadog API key used for sending traces xxx...
Datadog Site Your Datadog site datadoghq.com, us3.datadoghq.com, us5.datadoghq.com, eu.datadoghq.com
Datadog Service Name Service name for Datadog traces default: n8n-openrouter
Datadog Environment Environment name for Datadog traces default: production

🔑 How to find your API keys:
OpenRouter: Get your API key from OpenRouter Keys
Datadog: Log in to your Datadog dashboard, then go to:
Organization Settings → API Keys to retrieve your API key.

✅ After saving the credential, you're ready to use the node and see traces in your Datadog LLM Observability dashboard.

Operations

This node lets you inject Datadog-compatible metadata into your OpenRouter LLM requests.
You can trace every run with context such as sessionId, userId, and any custom tags.

Supported Fields

Field Type Description
serviceName string Override service name for Datadog traces (defaults to credential value)
environment string Override environment for Datadog traces (defaults to credential value)
version string Version identifier for Datadog traces
sessionId string Logical session ID to group related runs (mapped to dd.session_id tag)
userId string ID representing the end user making the request (mapped to dd.user_id tag)
customTags object Custom JSON object with additional context (e.g., project, workflow, team)

Example Setup

Input Field Example Value
Service Name my-n8n-service
Environment production
Version 1.0.0
Session ID {{$json.sessionId}}
User ID user-123
Custom Tags (JSON) See example below

Custom Tags Example:

{
  "project": "test-project",
  "workflow": "main-flow",
  "team": "ai-team"
}

Model Selection

The node supports both:

  • List mode: Browse and search available OpenRouter models
  • ID mode: Manually specify a model ID (e.g., openai/gpt-4o-mini, anthropic/claude-3-opus)

OpenRouter model IDs follow the format provider/model-name (e.g., openai/gpt-4, anthropic/claude-3-sonnet).

Viewing Traces

After making LLM requests through this node:

  1. Go to your Datadog dashboard
  2. Navigate to LLM ObservabilityTraces
  3. Filter by your service name, environment, or custom tags
  4. View detailed request/response data, token usage, and performance metrics

Compatibility

  • Requires n8n version 1.0.0 or later
  • Node.js 20.15 or higher
  • Compatible with:
    • OpenRouter API (https://openrouter.ai)
    • All models available through OpenRouter (OpenAI, Anthropic, Google, Meta, Mistral, etc.)
    • Datadog Cloud (all sites: US1, US3, US5, EU)
    • Datadog LLM Observability (requires Datadog API key)
    • LangChain AI chains and agents

Development

Setup

# Clone the repository
git clone https://github.com/wdaan/n8n-nodes-openrouter-datadog.git
cd n8n-nodes-openrouter-datadog

# Install dependencies with pnpm
pnpm install

Testing with Docker

You can test the node locally using Docker without installing n8n on your machine. This provides an isolated environment that matches production behavior.

Quick Start

# 1. Build the package first
pnpm run build

# 2. Start n8n with your node
docker-compose up --build

The n8n instance will be available at http://localhost:5678 with:

  • Username: admin
  • Password: admin

Development Workflow

When making changes to the node, follow this workflow:

# 1. Make your code changes in the source files

# 2. Build the TypeScript code
pnpm build

# 3. Install production dependencies in the dist folder
cd dist && npm i --omit=dev && cd ..

# 4. Restart n8n with the new changes
docker-compose up --build
# Or if the container is already running:
docker-compose restart n8n

Optional: For continuous development, you can run the TypeScript compiler in watch mode in a separate terminal:

# Terminal 1: Watch for TypeScript changes (auto-compiles on save)
pnpm run dev

# Terminal 2: After changes, install deps and restart
cd dist && npm i --omit=dev && cd .. && docker-compose restart n8n

What's Included

The Docker setup:

  • ✅ Installs your local node package automatically
  • ✅ Provides isolated n8n environment
  • ✅ Persists n8n data in a Docker volume
  • ✅ Easy to reset (just rebuild the container)
  • ✅ Matches production behavior

Accessing n8n

  1. Open http://localhost:5678 in your browser
  2. Log in with admin / admin
  3. Create a new workflow
  4. Look for "OpenRouter Chat Model with Datadog" in the node list
  5. Add the node and configure your credentials

Stopping Docker

# Stop the container
docker-compose down

# Stop and remove volumes (clean slate)
docker-compose down -v

Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/my-feature
  3. Make your changes
  4. Run tests and linter: pnpm run test && pnpm run lint
  5. Commit your changes: git commit -am 'feat: add new feature'
  6. Push to the branch: git push origin feature/my-feature
  7. Submit a pull request

Testing

The project includes a comprehensive test suite:

  • ✅ Unit tests for all utility functions
  • ✅ Integration tests for the main node
  • ✅ Tests for Datadog and n8n tracing callbacks
  • ✅ Credential validation tests
  • ✅ Model loading and filtering tests

Coverage thresholds: 70% for branches, functions, lines, and statements.

Resources