{"product_id":"n8n-llm-token-cost-tracking-w-api-data-tables-slack-alerts","title":"n8n LLM Token Cost Tracking w\/ API, Data Tables \u0026 Slack Alerts","description":"\u003ch3\u003eTrack LLM spend automatically in n8n—per token, per workflow, with Slack alerts\u003c\/h3\u003e\n\u003cp\u003eThis n8n workflow runs every 15 minutes to pull recent executions from the n8n API, calculate per-call LLM token costs, store them in an n8n Data Table, and notify your team in Slack when any workflow exceeds its daily budget (optionally deactivating it).\u003c\/p\u003e\n\n\u003ch3\u003eWhat this workflow does\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eScheduled monitoring:\u003c\/strong\u003e Executes on a 15-minute schedule.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eFetches execution data via API:\u003c\/strong\u003e Retrieves the latest active-workflow executions (including execution details) from the \u003cstrong\u003en8n API\u003c\/strong\u003e.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eExtracts LLM calls and calculates costs:\u003c\/strong\u003e Reads each chat model call from the execution run data, obtains token usage (or estimates where stored token usage is unavailable), matches the model to a configured price list, and computes \u003cstrong\u003eUSD cost per call\u003c\/strong\u003e.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003ePrevents duplicate logging:\u003c\/strong\u003e Checks an \u003cstrong\u003en8n Data Table\u003c\/strong\u003e to skip LLM calls already logged, then inserts only new usage rows.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eEnforces daily budget limits:\u003c\/strong\u003e Totals today’s rows per workflow, identifies workflows that exceed their configured \u003cstrong\u003edailyBudgetUsd\u003c\/strong\u003e, and ensures only \u003cstrong\u003eone alert per workflow per day\u003c\/strong\u003e.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eOptional safety action:\u003c\/strong\u003e Can deactivate over-budget workflows via the \u003cstrong\u003en8n API\u003c\/strong\u003e, then sends a budget-overrun message to \u003cstrong\u003eSlack\u003c\/strong\u003e.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eUse cases\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003eSaaS operators needing \u003cstrong\u003eLLM token cost tracking\u003c\/strong\u003e to prevent runaway spending from automation.\u003c\/li\u003e\n  \u003cli\u003eAutomation engineers wanting visibility into which \u003cstrong\u003en8n workflows\u003c\/strong\u003e drive the most tokens and cost.\u003c\/li\u003e\n  \u003cli\u003eTeams that want real-time governance: Slack alerts and optional auto-deactivation when daily budgets are exceeded.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eTechnical details\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eIntegrations \/ nodes:\u003c\/strong\u003e if, set, code, n8n, Slack, Data Table\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eData storage:\u003c\/strong\u003e An n8n Data Table with columns such as \u003cem\u003ecallKey\u003c\/em\u003e, \u003cem\u003eworkflowId\u003c\/em\u003e, token counts, \u003cem\u003ecostUsd\u003c\/em\u003e, and \u003cem\u003efinishedAt\u003c\/em\u003e.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eConfiguration:\u003c\/strong\u003e Set \u003cem\u003epricesPer1M\u003c\/em\u003e, \u003cem\u003edailyBudgetUsd\u003c\/em\u003e, and budget overrun behavior; connect Slack credentials and target channel.\u003c\/li\u003e\n\u003c\/ul\u003e","brand":"N8N Commerce","offers":[{"title":"Default Title","offer_id":46326517203123,"sku":"N8N-21847","price":8.99,"currency_code":"GBP","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0749\/6279\/6723\/files\/46cbMkyqxBQaWLsrsbjaY_pt5U1M4l.png?v=1793350947","url":"https:\/\/buyflowscripts.com\/products\/n8n-llm-token-cost-tracking-w-api-data-tables-slack-alerts","provider":"N8N Commerce","version":"1.0","type":"link"}