Перейти к содержанию
НОВОЕМаркетплейс и ваша команда: продавайте то, что создали, и получайте планы и изменения, проверенные до того, как вы их увидите. Что нового

Библиотека / Мониторинг, эксплуатация и инциденты

Мониторинг, эксплуатация и инциденты

Ограничение ежедневных расходов на ИИ по каждому 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.

Шаги

  1. Called By Your AI Workflow
  2. Read The Request
  3. Load Budgets
  4. Load Model Prices
  5. Resolve Budget And Day
  6. Read Today's Ledger Row
  7. Check Or Record?
  8. Decide Allow Or Block
  9. Return The Decision
  10. Price The Call
  11. Update The Ledger
  12. Crossed A Threshold?
  13. Send The Budget Alert
  14. Return The New Total

Всего шагов: 19.

Похожие автоматизации