Templates / Track LLM spend per workflow and send budget alerts via the n8n API

Track LLM spend per workflow and send budget alerts via the n8n API

Ready for 3.0

by Le Thua Phu ✓ · 22 views · created 2026-11-02 · DevOps, AI Summarization

Ready 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.

📬 Weekly n8n 3.0 breakage alerts, free

What 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).

  1. Set configuration (Edit Fields (Set)): sets 12 fields: n8nBaseUrl, pricesPer1M, dailyBudgetUsd…
  2. Read checkpoint (Code): runs custom JavaScript code
  3. Get new executions (HTTP Request): calls an HTTP API
  4. Extract LLM calls and cost (Code): runs custom JavaScript code
  5. Skip calls already logged (Data table): row not exists
  6. Insert usage rows (Data table): uses Data table
  7. Get last 8 days of usage (Data table): get
  8. Analyze usage and find alerts (Code): runs custom JavaScript code
  9. Pause over-budget workflow? (If): checks a condition and branches into true / false
  10. Unpublish workflow (n8n): deactivate

…plus 5 more steps. See the full node list below.

Services it uses

TelegramSlack

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.

Check at runtime on n8n 3.0
  • Code node: the task timeout drops from 300s to 60s. Test with a realistic data volume.
Informational: a static scan can't see the data, so test these on your own instance. Status above is unchanged.

Nodes used (11)

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…

Excerpt from Le Thua Phu's description on n8n.io.

View the original on n8n.io → Check your own copy

Get the weekly “what broke” email

New templates, newly broken ones, and n8n release changes. One short email a week.

Form not loading? Subscribe here.