# Track LLM token spend per workflow with n8n API, data tables, and Slack alerts

> 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 the workflow). How it works 1. Runs every 15 minutes on a schedule. 2. Retrieves the latest active-workflow executions (including execution details) from the n8n API. 3. Extracts each chat model call from the execution run data, reads stored token usage (or estimates), matches the model to a price list, and calculates a USD cost per call. 4. Checks an n8n Data Table to skip LLM calls that have already been logged, then inserts only new usage rows. 5. Reads today’s rows from the Data Table, totals spend per workflow, and identifies workflows that exceed their configured daily budget while ensuring only one alert per workflow per day. 6. Optionally deactivates over-budget workflows via the n8n API, then sends a budget-overrun messag

- **Domain**: `n8n-workflow-21847.n8n.io`
- **Provider**: n8n.io (https://n8n.io)
- **Kind**: workflow
- **Live-responds (last probe)**: None
- **Signed card**: False
- **Streaming**: False
- **Quality score**: 40%

## URLs
- Agent card: https://n8n.io/workflows/21847
- Page (HTML): https://agenstry.com/agents/n8n-workflow-21847.n8n.io
- Documentation: https://n8n.io/workflows/21847
