Track LLM spend per workflow and send budget alerts via the n8n API
Ready for 3.0What this workflow does
This workflow has 16 nodes and runs on a schedule (every 15 minutes). Along the way it connects Telegram and Slack.
How it runs
Trigger: On a schedule (every 15 minutes).
- Set configuration (Edit Fields (Set)): sets 12 fields: n8nBaseUrl, pricesPer1M, dailyBudgetUsd…
- Read checkpoint (Code): runs custom JavaScript code
- Get new executions (HTTP Request): calls an HTTP API
- 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 last 8 days of usage (Data table): get
- Analyze usage and find alerts (Code): runs custom JavaScript code
- Pause over-budget workflow? (If): checks a condition and branches into true / false
- Unpublish workflow (n8n): deactivate
…plus 5 more steps. See the full node list below.
Services it uses
Other Telegram + Slack templates (130)
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.
- Code node: the task timeout drops from 300s to 60s. Test with a realistic data volume.
Nodes used (11)
- Schedule Trigger
n8n-nodes-base.scheduleTrigger - Edit Fields (Set)
n8n-nodes-base.set - Code
n8n-nodes-base.code - HTTP Request
n8n-nodes-base.httpRequest - Data table
n8n-nodes-base.dataTable - If
n8n-nodes-base.if - n8n
n8n-nodes-base.n8n - Switch
n8n-nodes-base.switch - Send Email
n8n-nodes-base.emailSend - Telegram
n8n-nodes-base.telegram - Slack
n8n-nodes-base.slack
From the author
Quick overview This workflow runs every 15 minutes, reads recent n8n executions via the n8n API, extracts LLM token usage from AI and HTTP Request nodes, logs per-call cost into an n8n Data Table, and sends Slack/email/Telegram/webhook alerts for budget…