{"product_id":"track-ai-agent-costs-with-n8n-workflow-automation","title":"Track AI Agent Costs with n8n Workflow Automation","description":"\u003cp\u003eStop burning money on AI agent costs you can't see. This n8n workflow automatically tracks token usage and calculates exact costs for every AI agent execution, so you know which workflows are quietly draining your budget before your Stripe bill arrives.\u003c\/p\u003e\n\n\u003ch3\u003eWhat this workflow does\u003c\/h3\u003e\n\u003cp\u003eEvery hour, this automation scans all your tagged AI agent workflows and provides complete cost visibility:\u003c\/p\u003e\n\u003cul\u003e\n\u003cli\u003eFetches all workflows tagged with \"agent\" via the n8n API\u003c\/li\u003e\n\u003cli\u003ePulls execution data for each AI agent workflow\u003c\/li\u003e\n\u003cli\u003eExtracts exact token usage per model from each run\u003c\/li\u003e\n\u003cli\u003eCalculates estimated costs in USD for every execution\u003c\/li\u003e\n\u003cli\u003eStores detailed receipts in a DataTable with workflow ID, execution ID, and cost breakdown\u003c\/li\u003e\n\u003cli\u003eTracks usage units and timestamps for historical analysis\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eUse cases\u003c\/h3\u003e\n\u003cp\u003ePerfect for n8n users running multiple AI agents who need cost control and budget planning. Identify which workflows cost $0.002 per run versus those quietly racking up $2.00 each execution. Monitor token consumption patterns across different AI models, set up cost alerts when agents exceed budgets, and optimize expensive workflows before they impact your bottom line. Essential for agencies managing client AI automation costs or SaaS operators scaling AI-powered features.\u003c\/p\u003e\n\n\u003ch3\u003eTechnical details\u003c\/h3\u003e\n\u003cp\u003eBuilt with core n8n nodes including IF conditions, Code nodes for cost calculations, Data Table integration for receipt storage, and Split in Batches for workflow processing. Uses n8n API credentials to access workflow and execution data. Requires a pre-configured DataTable called \"execution_receipts\" with specific columns for workflowid, executionid, receipt, created_at, and units. Workflows must be tagged with \"agent\" for automatic tracking. Includes CSV template for quick DataTable setup and sticky notes for configuration guidance.\u003c\/p\u003e\n\n\u003cp\u003eTake control of your AI agent spending with automated cost tracking that turns invisible token burns into actionable budget insights.\u003c\/p\u003e","brand":"N8N Commerce","offers":[{"title":"Default Title","offer_id":45455061975219,"sku":"N8N-15177","price":38.99,"currency_code":"GBP","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0749\/6279\/6723\/files\/i1xQ7YJ867XB-rEoF5d8C_006d8720aaa04e6597e18704dba1398d.jpg?v=1776757592","url":"https:\/\/buyflowscripts.com\/products\/track-ai-agent-costs-with-n8n-workflow-automation","provider":"N8N Commerce","version":"1.0","type":"link"}