Track LLM token spend per workflow with n8n API, data tables, and Slack alerts
Ready for 3.0Ready for 3.0. This template uses no nodes that n8n 3.0 removes. No removed nodes, versions or helpers found. Static check, last run 2026-12-01.
What this workflow does
This workflow has 11 nodes and runs on a schedule (every 15 minutes). Along the way it connects Slack.
How it runs
Trigger: On a schedule (every 15 minutes).
- Set configuration (Edit Fields (Set)): sets 4 fields: pricesPer1M, dailyBudgetUsd, budgetOverrides…
- Get recent executions (n8n): work with execution
- Extract LLM calls and cost (Code): runs custom JavaScript code
- Skip calls already logged (Data table): row not exists
- Insert usage rows (Data table): uses Data table
- Get today's usage (Data table): get
- Find workflows over budget (Code): runs custom JavaScript code
- Pause over-budget workflows? (If): checks a condition and branches into true / false
- Unpublish workflow (n8n): deactivate
- Send budget alert to Slack (Slack): uses Slack
Services it uses
Before you upgrade to n8n 3.0
Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.
Nodes used (7)
- Schedule Trigger
n8n-nodes-base.scheduleTrigger - Edit Fields (Set)
n8n-nodes-base.set - n8n
n8n-nodes-base.n8n - Code
n8n-nodes-base.code - Data table
n8n-nodes-base.dataTable - If
n8n-nodes-base.if - Slack
n8n-nodes-base.slack
From the author
Quick overview This workflow runs every 15 minutes, pulls recent n8n executions via the n8n API, calculates per-call LLM token costs, stores them in an n8n Data Table, and posts a Slack alert when any workflow exceeds its daily budget (optionally deactivating…