🤖 n8n AI Workflow Dashboard Template
Overview
This template is designed to collect execution data from your AI workflows and generate an interactive dashboard for easy monitoring. It's compatible with any AI Agent or RAG workflow in n8n.
Main Objectives
💾 Collect Execution Data
- Track messages, tokens used (prompt/completion), session IDs, model names, and compute costs
- Designed to plug into any AI agent or RAG workflow in n8n
📊 Generate an Interactive Dashboard
- Visualize KPIs like total messages, unique sessions, tokens used, and costs
- Display daily charts, including stacked bars for prompt vs completion tokens
- Monitor AI activity, analyze usage, and track costs at a glance
✨ Key Features
💬 Conversation Data Collection
Messages sent to the AI agent are recorded with:
sessionId
chatInput
output
promptTokens
, completionTokens
, totalTokens
globalCost
and modelName
This allows detailed tracking of AI interactions across sessions.
💰 Model Pricing Management
- A sub-workflow with a Set node provides token prices for LLMs
- Data is stored in the Model price table for cost calculations
🗄️ Data Storage via n8n Data Tables
Two tables need to be created:
Model price
{
"id": 20,
"createdAt": "2025-10-11T12:16:47.338Z",
"updatedAt": "2025-10-11T12:16:47.338Z",
"name": "claude-4.5-sonnet",
"promptTokensPrice": 0.000003,
"completionTokensPrice": 0.000015
}
Messages
[
{
"id": 20,
"createdAt": "2025-10-11T15:28:00.358Z",
"updatedAt": "2025-10-11T15:31:28.112Z",
"sessionId": "c297cdd4-7026-43f8-b409-11eb943a2518",
"action": "sendMessage",
"output": "Hey! \nHow's it going?",
"chatInput": "yo",
"completionTokens": 6,
"promptTokens": 139,
"totalTokens": 139,
"globalCost": null,
"modelName": "gpt-4.1-mini",
"executionId": 245
}
]
These tables store conversation data and pricing info to feed the dashboard and calculations.
📈 Interactive Dashboard
- KPIs Generated: total messages, unique sessions, total/average tokens, total/average cost 💸
- Charts Included: daily messages, tokens used per day (prompt vs completion, stacked bar)
- Provides a visual summary of AI workflow performance
⚙️ Installation & Setup
Follow these steps to set up and run the workflow in n8n:
1. Import the Workflow
Download or copy the JSON workflow and import it into n8n.
2. Create the Data Tables
- Model price table: stores token prices per model
- Messages table: stores messages generated by the AI agent
3. Configure the Webhook
- The workflow is triggered via a webhook
- Use the webhook URL to send conversation data
4. Set Up the Pricing Sub-workflow
- Automatically generates price data for the models used
- Connect it to your main workflow to enrich cost calculations
5. Dashboard Visualization
- The workflow returns HTML code rendering the dashboard
- View it in a browser or embed it in your interface 🌐
Once configured, your workflow tracks AI usage and costs in real-time, providing a live dashboard for quick insights.
🔧 Adaptability
- The template is modular and can be adapted to any AI agent or RAG workflow
- KPIs, charts, colors, and metrics can be customized in the HTML rendering
- Ideal for monitoring, cost tracking, and reporting AI workflow performance