Библиотека / Мониторинг, эксплуатация и инциденты
Мониторинг, эксплуатация и инциденты
Ограничение ежедневных расходов на ИИ по каждому workflow с Data Table, Google Sheets и Slack
Вложенный workflow, который ИИ-workflow вызывают до и после каждого запроса к модели: он проверяет и фиксирует расходы относительно дневного бюджета, останавливает неконтролируемое использование и отправляет оповещения в Slack.
Что делает
## Cap daily AI spend per workflow and alert in Slack n8n counts executions, not dollars. A looping agent, an unexpectedly busy day or a prompt that pulls in far more context than you planned can run up a large model bill overnight, and nothing in the platform stops it or tells you. This is a sub-workflow that gives every AI workflow its own daily ceiling. ### How it works An AI workflow calls this twice. Before the model, with action check, it gets back whether the call fits inside today's remaining budget, so a runaway is stopped at the next call rather than found on the invoice. After the model, with action record, it passes the usage object straight through and the call is priced and added to the day's total. Prices sit in a sheet rather than in the code, because they change every few weeks, and a model missing from that sheet is charged at a deliberately pessimistic fallback rate rather than counted as free, which is how budgets quietly stop working. Each workflow gets its own cap and its own Slack channel from a Budgets tab, with one row named default catching everything else. The day boundary follows the offset you set, not UTC midnight. Slack is told once when the warning line is crossed and once when the cap is reached, never on every call after. The next morning, one message reports what each workflow cost and which ones ran into their ceiling. ### Setup Connect Sheets and Slack, create the data table with the columns on the ledger node, and fill the Budgets and Model Prices tabs. ### Note This caps workflows that call it. It cannot police one that does not, so wire it into the expensive ones first.
Шаги
- Called By Your AI Workflow
- Read The Request
- Load Budgets
- Load Model Prices
- Resolve Budget And Day
- Read Today's Ledger Row
- Check Or Record?
- Decide Allow Or Block
- Return The Decision
- Price The Call
- Update The Ledger
- Crossed A Threshold?
- Send The Budget Alert
- Return The New Total
Всего шагов: 19.
Похожие автоматизации
Мониторинг, эксплуатация и инцидентыОтправка уведомлений о сбоях workflow n8n в Discord и запись в Data TableШагов: 7Мониторинг, эксплуатация и инцидентыMonitor Reddit and score leads with Apify, OpenAI, OpenRouter and SlackШагов: 28Мониторинг, эксплуатация и инцидентыПроверка подписанных цен криптовалют через Verity MCP и оповещение в Slack при сбояхШагов: 17Мониторинг, эксплуатация и инцидентыWrite multilingual weather articles with Open-Meteo, Claude, and OpenAIШагов: 57