{
  "id": "PVfawKc-BR04OwQzI8987",
  "name": "AI Cost Intelligence and Optimization Coordination System",
  "tags": [],
  "nodes": [
    {
      "id": "0bfe849a-e411-42b7-b15a-b0e37a8d9143",
      "name": "Schedule Trigger - Every 15 Minutes",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -64,
        400
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "minutes",
              "minutesInterval": 15
            }
          ]
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "e10edf10-9250-4437-b5d9-cb8f704fa1ea",
      "name": "Workflow Configuration",
      "type": "n8n-nodes-base.set",
      "position": [
        160,
        400
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "id-1",
              "name": "budgetThresholdUSD",
              "type": "number",
              "value": 1000
            },
            {
              "id": "id-2",
              "name": "warningThresholdUSD",
              "type": "number",
              "value": 500
            },
            {
              "id": "id-3",
              "name": "slackCriticalChannel",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Slack Channel ID for Critical Alerts__>"
            },
            {
              "id": "id-4",
              "name": "slackWarningChannel",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Slack Channel ID for Warning Alerts__>"
            },
            {
              "id": "id-5",
              "name": "executiveEmail",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Executive Email Address__>"
            },
            {
              "id": "id-6",
              "name": "costPerMillionTokens",
              "type": "number",
              "value": 15
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "75041e34-8185-457b-b39c-f00b18237302",
      "name": "Generate Mock AI Metrics Data",
      "type": "n8n-nodes-base.code",
      "position": [
        384,
        400
      ],
      "parameters": {
        "jsCode": "// Generate mock AI metrics data for multiple inference endpoints\nconst endpoints = [\n  { name: 'gpt-4-turbo', provider: 'OpenAI', costPerToken: 0.00003 },\n  { name: 'claude-3-opus', provider: 'Anthropic', costPerToken: 0.000015 },\n  { name: 'claude-3-sonnet', provider: 'Anthropic', costPerToken: 0.000003 },\n  { name: 'gpt-3.5-turbo', provider: 'OpenAI', costPerToken: 0.0000015 },\n  { name: 'llama-2-70b', provider: 'Meta', costPerToken: 0.000001 }\n];\n\nconst mockData = [];\nconst now = new Date();\n\n// Generate data for the last 24 hours with hourly intervals\nfor (let i = 0; i < 24; i++) {\n  const timestamp = new Date(now.getTime() - (i * 60 * 60 * 1000));\n  \n  endpoints.forEach(endpoint => {\n    // Generate random metrics\n    const inputTokens = Math.floor(Math.random() * 5000) + 500;\n    const outputTokens = Math.floor(Math.random() * 2000) + 200;\n    const totalTokens = inputTokens + outputTokens;\n    const requestCount = Math.floor(Math.random() * 100) + 10;\n    const latencyMs = Math.floor(Math.random() * 3000) + 200;\n    const errorRate = Math.random() * 0.05; // 0-5% error rate\n    const cost = totalTokens * endpoint.costPerToken * requestCount;\n    \n    mockData.push({\n      timestamp: timestamp.toISOString(),\n      modelName: endpoint.name,\n      provider: endpoint.provider,\n      inputTokens: inputTokens,\n      outputTokens: outputTokens,\n      totalTokens: totalTokens,\n      requestCount: requestCount,\n      latencyMs: latencyMs,\n      errorRate: parseFloat(errorRate.toFixed(4)),\n      costPerToken: endpoint.costPerToken,\n      totalCost: parseFloat(cost.toFixed(4)),\n      avgTokensPerRequest: Math.floor(totalTokens / requestCount),\n      throughput: parseFloat((requestCount / 3600).toFixed(2)), // requests per second\n      cacheHitRate: parseFloat((Math.random() * 0.3).toFixed(2)) // 0-30% cache hit rate\n    });\n  });\n}\n\n// Calculate summary statistics\nconst totalCost = mockData.reduce((sum, item) => sum + item.totalCost, 0);\nconst totalRequests = mockData.reduce((sum, item) => sum + item.requestCount, 0);\nconst avgLatency = mockData.reduce((sum, item) => sum + item.latencyMs, 0) / mockData.length;\n\nreturn [\n  {\n    json: {\n      metrics: mockData,\n      summary: {\n        totalCost: parseFloat(totalCost.toFixed(2)),\n        totalRequests: totalRequests,\n        avgLatency: parseFloat(avgLatency.toFixed(2)),\n        timeRange: '24h',\n        endpointCount: endpoints.length,\n        generatedAt: now.toISOString()\n      }\n    }\n  }\n];"
      },
      "typeVersion": 2
    },
    {
      "id": "440d8159-0638-46aa-880a-d3b300ae8fe0",
      "name": "Cost Intelligence Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        640,
        592
      ],
      "parameters": {
        "text": "=AI Metrics Data: {{ JSON.stringify($json.metrics) }}",
        "options": {
          "systemMessage": "You are a Cost Intelligence Agent specialized in analyzing AI infrastructure metrics.\n\nYour task is to:\n1. Analyze structured token usage, latency, and workload metrics from AI inference endpoints\n2. Calculate total token consumption and estimated costs based on pricing\n3. Identify cost anomalies and usage patterns\n4. Detect performance bottlenecks (high latency, low throughput)\n5. Calculate cost efficiency metrics (cost per request, tokens per second)\n6. Identify top cost drivers by model and endpoint\n7. Detect unusual workload patterns that may indicate inefficiency\n8. Return structured analysis with cost breakdown, anomalies, and efficiency metrics\n\nFocus on actionable insights without modifying production inference paths."
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 3.1
    },
    {
      "id": "32d6ceb0-2071-4c82-8b63-f61dec527c44",
      "name": "Anthropic Model - Cost Intelligence",
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "position": [
        608,
        816
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "claude-sonnet-4-5-20250929",
          "cachedResultName": "Claude Sonnet 4.5"
        },
        "options": {}
      },
      "credentials": {
        "anthropicApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "1cd7b8e0-3011-4742-b2b8-03f0fe82046e",
      "name": "Structured Output Parser - Cost Analysis",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        784,
        816
      ],
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n  \"type\": \"object\",\n  \"properties\": {\n    \"totalCostUSD\": {\n      \"type\": \"number\",\n      \"description\": \"Total cost in USD\"\n    },\n    \"totalTokens\": {\n      \"type\": \"number\",\n      \"description\": \"Total number of tokens processed\"\n    },\n    \"averageLatencyMs\": {\n      \"type\": \"number\",\n      \"description\": \"Average latency in milliseconds\"\n    },\n    \"costByModel\": {\n      \"type\": \"array\",\n      \"description\": \"Cost breakdown by model\",\n      \"items\": {\n        \"type\": \"object\"\n      }\n    },\n    \"anomalies\": {\n      \"type\": \"array\",\n      \"description\": \"Detected anomalies\",\n      \"items\": {\n        \"type\": \"object\"\n      }\n    },\n    \"topCostDrivers\": {\n      \"type\": \"array\",\n      \"description\": \"Top cost drivers\",\n      \"items\": {\n        \"type\": \"object\"\n      }\n    },\n    \"efficiencyScore\": {\n      \"type\": \"number\",\n      \"description\": \"Efficiency score from 0 to 100\",\n      \"minimum\": 0,\n      \"maximum\": 100\n    },\n    \"recommendations\": {\n      \"type\": \"array\",\n      \"description\": \"Optimization recommendations\",\n      \"items\": {\n        \"type\": \"object\"\n      }\n    }\n  },\n  \"required\": [\"totalCostUSD\", \"totalTokens\", \"averageLatencyMs\", \"costByModel\", \"anomalies\", \"topCostDrivers\", \"efficiencyScore\", \"recommendations\"]\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "b20d11f8-d030-4619-99cf-f9ad91d035de",
      "name": "Optimization Coordinator Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1120,
        288
      ],
      "parameters": {
        "text": "=Cost Analysis: {{ JSON.stringify($json.output) }}",
        "options": {
          "systemMessage": "You are an Optimization Coordinator Agent that coordinates budget alerts, routing recommendations, and executive reporting.\n\nYour task is to:\n1. Review the cost analysis from the Cost Intelligence Agent\n2. Determine alert severity based on budget thresholds (critical, warning, info)\n3. Use the Budget Alert Tool to check if budget thresholds are exceeded\n4. Use the Routing Recommendation Tool to generate model routing optimizations\n5. Generate executive summary with key metrics and recommendations\n6. Return structured output with alertLevel, budgetStatus, routingRecommendations, and executiveSummary\n\nYou coordinate actions but do NOT modify production inference paths - only provide recommendations."
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 3.1
    },
    {
      "id": "a45a057e-35cc-431e-a721-1c85e0451ba1",
      "name": "Anthropic Model - Optimization",
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "position": [
        992,
        512
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "claude-sonnet-4-5-20250929",
          "cachedResultName": "Claude Sonnet 4.5"
        },
        "options": {}
      },
      "credentials": {
        "anthropicApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "1dffaf34-46d0-4001-9b70-a86bef7665fc",
      "name": "Structured Output Parser - Optimization",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1408,
        512
      ],
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n  \"type\": \"object\",\n  \"properties\": {\n    \"alertLevel\": {\n      \"type\": \"string\",\n      \"enum\": [\"critical\", \"warning\", \"info\"],\n      \"description\": \"The severity level of the alert\"\n    },\n    \"budgetStatus\": {\n      \"type\": \"object\",\n      \"properties\": {\n        \"exceeded\": {\n          \"type\": \"boolean\"\n        },\n        \"remaining\": {\n          \"type\": \"number\"\n        },\n        \"percentUsed\": {\n          \"type\": \"number\"\n        }\n      },\n      \"required\": [\"exceeded\", \"remaining\", \"percentUsed\"]\n    },\n    \"routingRecommendations\": {\n      \"type\": \"array\",\n      \"items\": {\n        \"type\": \"object\"\n      }\n    },\n    \"executiveSummary\": {\n      \"type\": \"string\"\n    },\n    \"actionRequired\": {\n      \"type\": \"boolean\"\n    }\n  },\n  \"required\": [\"alertLevel\", \"budgetStatus\", \"routingRecommendations\", \"executiveSummary\", \"actionRequired\"]\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "652d24a4-cc1f-4d99-86c9-b6ab39fc34f9",
      "name": "Budget Alert Tool",
      "type": "@n8n/n8n-nodes-langchain.toolCode",
      "position": [
        1136,
        512
      ],
      "parameters": {
        "jsCode": "// Check if current costs exceed budget thresholds\n// Access workflow configuration and cost data from previous nodes\nconst workflowConfig = $('Workflow Configuration').item.json;\nconst costData = $('Cost Intelligence Agent').item.json;\n\n// Extract budget threshold and current costs\nconst budgetThreshold = workflowConfig.budgetThreshold || 1000;\nconst currentCosts = costData.totalCost || 0;\n\n// Calculate budget metrics\nconst remainingBudget = budgetThreshold - currentCosts;\nconst percentUsed = (currentCosts / budgetThreshold) * 100;\nconst exceeded = currentCosts > budgetThreshold;\n\n// Return budget status\nconst status = {\n  exceeded: exceeded,\n  remainingBudget: remainingBudget.toFixed(2),\n  percentUsed: percentUsed.toFixed(2),\n  currentCosts: currentCosts.toFixed(2),\n  budgetThreshold: budgetThreshold.toFixed(2),\n  status: exceeded ? 'OVER BUDGET' : (percentUsed > 80 ? 'WARNING' : 'OK')\n};\n\nreturn JSON.stringify(status);",
        "description": "Checks if current costs exceed budget thresholds and returns budget status"
      },
      "typeVersion": 1.3
    },
    {
      "id": "8cb75373-6a4e-46a4-88fb-69eeef529aef",
      "name": "Routing Recommendation Tool",
      "type": "@n8n/n8n-nodes-langchain.toolCode",
      "position": [
        1264,
        528
      ],
      "parameters": {
        "jsCode": "// Analyze cost per model and latency to recommend routing optimizations\n// Input: query should contain cost and performance metrics\n\n// Parse the query to extract metrics (assuming JSON format)\nlet metrics;\ntry {\n  metrics = typeof query === 'string' ? JSON.parse(query) : query;\n} catch (e) {\n  return 'Error: Invalid input format. Please provide cost and performance metrics in JSON format.';\n}\n\n// Extract model metrics\nconst models = metrics.models || [];\n\nif (models.length === 0) {\n  return 'No model data available for analysis.';\n}\n\n// Analyze each model's cost-effectiveness\nconst analysis = models.map(model => {\n  const costPerRequest = model.totalCost / model.requestCount;\n  const avgLatency = model.avgLatency || 0;\n  \n  return {\n    modelName: model.name,\n    costPerRequest: costPerRequest,\n    avgLatency: avgLatency,\n    requestCount: model.requestCount,\n    costEfficiencyScore: avgLatency > 0 ? (1 / costPerRequest) * (1000 / avgLatency) : 0\n  };\n});\n\n// Sort by cost efficiency\nanalysis.sort((a, b) => b.costEfficiencyScore - a.costEfficiencyScore);\n\n// Generate recommendations\nconst recommendations = [];\n\nconst mostExpensive = analysis.reduce((max, m) => m.costPerRequest > max.costPerRequest ? m : max, analysis[0]);\nconst cheapest = analysis.reduce((min, m) => m.costPerRequest < min.costPerRequest ? m : min, analysis[0]);\nconst fastest = analysis.reduce((min, m) => m.avgLatency < min.avgLatency ? m : min, analysis[0]);\n\n// Recommendation 1: Route non-critical workloads to cheaper models\nif (mostExpensive.costPerRequest > cheapest.costPerRequest * 2) {\n  recommendations.push({\n    type: 'cost_optimization',\n    priority: 'high',\n    recommendation: `Switch non-critical workloads from ${mostExpensive.modelName} to ${cheapest.modelName}`,\n    potentialSavings: `${((mostExpensive.costPerRequest - cheapest.costPerRequest) / mostExpensive.costPerRequest * 100).toFixed(1)}% cost reduction`,\n    details: `${mostExpensive.modelName} costs $${mostExpensive.costPerRequest.toFixed(4)} per request vs ${cheapest.modelName} at $${cheapest.costPerRequest.toFixed(4)}`\n  });\n}\n\n// Recommendation 2: Balance latency and cost\nanalysis.forEach(model => {\n  if (model.avgLatency > fastest.avgLatency * 2 && model.costPerRequest > cheapest.costPerRequest * 1.5) {\n    recommendations.push({\n      type: 'performance_cost_balance',\n      priority: 'medium',\n      recommendation: `Consider replacing ${model.modelName} - high latency and high cost`,\n      details: `Latency: ${model.avgLatency}ms, Cost: $${model.costPerRequest.toFixed(4)} per request`\n    });\n  }\n});\n\n// Recommendation 3: Optimize high-volume routes\nconst highVolumeModels = analysis.filter(m => m.requestCount > (metrics.totalRequests || 0) * 0.3);\nhighVolumeModels.forEach(model => {\n  if (model.costPerRequest > cheapest.costPerRequest * 1.3) {\n    recommendations.push({\n      type: 'high_volume_optimization',\n      priority: 'high',\n      recommendation: `Optimize ${model.modelName} routing - high volume with above-average cost`,\n      potentialSavings: `Estimated ${((model.costPerRequest - cheapest.costPerRequest) * model.requestCount).toFixed(2)} in savings`,\n      details: `${model.requestCount} requests at $${model.costPerRequest.toFixed(4)} per request`\n    });\n  }\n});\n\n// Format output\nconst output = {\n  summary: `Analyzed ${models.length} models, generated ${recommendations.length} recommendations`,\n  mostCostEffective: cheapest.modelName,\n  fastestModel: fastest.modelName,\n  recommendations: recommendations,\n  modelAnalysis: analysis\n};\n\nreturn JSON.stringify(output, null, 2);",
        "description": "Generates model routing recommendations based on cost and performance analysis"
      },
      "typeVersion": 1.3
    },
    {
      "id": "cf5f3438-d7c1-4033-89e1-eb01eab9decb",
      "name": "Route by Alert Level",
      "type": "n8n-nodes-base.switch",
      "position": [
        1568,
        304
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "Critical",
              "conditions": {
                "options": {
                  "leftValue": "",
                  "caseSensitive": false,
                  "typeValidation": "loose"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.alertLevel }}",
                    "rightValue": "critical"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Warning",
              "conditions": {
                "options": {
                  "leftValue": "",
                  "caseSensitive": false,
                  "typeValidation": "loose"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.alertLevel }}",
                    "rightValue": "warning"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Info",
              "conditions": {
                "options": {
                  "leftValue": "",
                  "caseSensitive": false,
                  "typeValidation": "loose"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.alertLevel }}",
                    "rightValue": "info"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {
          "fallbackOutput": "extra"
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "7ecf725e-3aba-46c5-9204-2134b0ddbc41",
      "name": "Slack - Critical Alert",
      "type": "n8n-nodes-base.slack",
      "position": [
        2064,
        640
      ],
      "parameters": {
        "text": "=CRITICAL ALERT: AI Cost Budget Exceeded\n\nTotal Cost: ${{ $json.output.budgetStatus.totalCost }}\nBudget: ${{ $('Workflow Configuration').first().json.budgetThresholdUSD }}\nPercent Used: {{ $json.output.budgetStatus.percentUsed }}%\n\nTop Cost Drivers:\n{{ $json.output.routingRecommendations.slice(0,3).map(r => `- ${r}`).join(\"\\n\") }}\n\nAction Required: {{ $json.output.actionRequired }}",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Workflow Configuration').first().json.slackCriticalChannel }}"
        },
        "otherOptions": {},
        "authentication": "oAuth2"
      },
      "credentials": {
        "slackOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.4
    },
    {
      "id": "4fc3e49e-e8e7-46b1-b329-19f900cd7b6f",
      "name": "Slack - Warning Alert",
      "type": "n8n-nodes-base.slack",
      "position": [
        2064,
        256
      ],
      "parameters": {
        "text": "=WARNING: AI Cost Approaching Budget\n\nTotal Cost: ${{ $json.output.budgetStatus.totalCost }}\nBudget: ${{ $('Workflow Configuration').first().json.budgetThresholdUSD }}\nPercent Used: {{ $json.output.budgetStatus.percentUsed }}%\n\nRecommendations:\n{{ $json.output.routingRecommendations.slice(0,5).map(r => `- ${r}`).join(\"\\n\") }}",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Workflow Configuration').first().json.slackWarningChannel }}"
        },
        "otherOptions": {},
        "authentication": "oAuth2"
      },
      "credentials": {
        "slackOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.4
    },
    {
      "id": "6032ec2f-0183-4356-acdb-612d7daae71f",
      "name": "Email - Executive Report",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        2064,
        448
      ],
      "parameters": {
        "html": "=<h2>AI Cost Intelligence Report</h2><h3>Executive Summary</h3><p>{{ $json.output.executiveSummary }}</p><h3>Budget Status</h3><ul><li>Total Cost: ${{ $json.output.budgetStatus.totalCost }}</li><li>Budget Threshold: ${{ $('Workflow Configuration').first().json.budgetThresholdUSD }}</li><li>Percent Used: {{ $json.output.budgetStatus.percentUsed }}%</li><li>Remaining: ${{ $json.output.budgetStatus.remaining }}</li></ul><h3>Routing Recommendations</h3><ul>{{ $json.output.routingRecommendations.map(r => `<li>${r}</li>`).join(\"\") }}</ul><p>Generated: {{ $now.toISO() }}</p>",
        "options": {},
        "subject": "=AI Cost Intelligence Executive Report - {{ $now.toFormat(\"yyyy-MM-dd\") }}",
        "toEmail": "={{ $('Workflow Configuration').first().json.executiveEmail }}",
        "fromEmail": "<__PLACEHOLDER_VALUE__Sender Email Address__>"
      },
      "typeVersion": 2.1
    },
    {
      "id": "b4092c30-56ec-4495-987d-a5a08c7fc180",
      "name": "Store Cost Analysis History",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        1792,
        800
      ],
      "parameters": {
        "columns": {
          "value": null,
          "mappingMode": "autoMapInputData"
        },
        "options": {},
        "dataTableId": {
          "__rl": true,
          "mode": "name",
          "value": "cost_analysis_history"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "c429be7e-eaef-40b1-b419-42c8a20d7320",
      "name": "Store Optimization Recommendations",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        1792,
        608
      ],
      "parameters": {
        "columns": {
          "value": null,
          "mappingMode": "autoMapInputData"
        },
        "options": {},
        "dataTableId": {
          "__rl": true,
          "mode": "name",
          "value": "optimization_recommendations"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "2d1dd1b2-d39c-4d32-9527-113ff56258df",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        976,
        -256
      ],
      "parameters": {
        "color": 6,
        "width": 560,
        "height": 352,
        "content": "## Prerequisites\nClaude API access, NVIDIA API credentials, Gmail/Google Workspace account, Slack workspace integration\n## Use Cases\nMulti-department budget variance analysis, cloud cost optimization, procurement pattern detection\n## Customization\nIntegrate ERP systems, add department-specific rules, customize alert thresholds by category\n## Benefits\nReduces overruns 40% through early detection, identifies 15-20% monthly savings"
      },
      "typeVersion": 1
    },
    {
      "id": "d2c26a46-601f-4e5b-bf86-785596ac3dee",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        528,
        -208
      ],
      "parameters": {
        "width": 432,
        "height": 272,
        "content": "## Setup Steps\n1. Configure Schedule Trigger for 15-minute intervals\n2. Add Claude API credentials in Workflow Configuration and Budget Alert Tool nodes\n3. Set up NVIDIA API keys in Cost Intelligence Agent and Structured Output Parser nodes\n4. Connect Gmail authentication and configure finance team distribution lists\n5. Integrate Slack workspace credentials and specify budget alert channels\n6. Configure storage endpoints in cost history nodes with database connections"
      },
      "typeVersion": 1
    },
    {
      "id": "3d58a392-4ae6-4969-80aa-76103779de38",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        32,
        -288
      ],
      "parameters": {
        "width": 464,
        "height": 400,
        "content": "## How It Works\nThis workflow automates cost analysis and budget optimization for enterprises managing complex operational expenses. Designed for CFOs, finance teams, and operations managers, it addresses the challenge of identifying cost inefficiencies and generating actionable recommendations in real-time. The system runs every 15 minutes, monitoring cost metrics and generating AI performance data. The Cost Intelligence Agent aggregates financial data before routing to parallel AI processing. Claude AI executes budget optimization analysis while a specialized cost model identifies spending patterns. Routing engines evaluate optimization strategies, with NVIDIA parsers ensuring standardized outputs. The Optimization Coordinator consolidates insights and routes by severity: critical overruns trigger executive alerts via email and Slack, warnings generate management notifications, while routine optimizations proceed to documentation and historical storage for trend analysis."
      },
      "typeVersion": 1
    },
    {
      "id": "30414027-f4e9-4a70-81a5-02a52e223b35",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1744,
        128
      ],
      "parameters": {
        "color": 7,
        "width": 512,
        "height": 832,
        "content": "## Historical Analysis Storage & Reporting\n**Why:** Maintains spending patterns for predictive analytics and documents optimization decisions for audit trails and data-driven planning."
      },
      "typeVersion": 1
    },
    {
      "id": "3894101b-2877-4fc4-8dc5-eac4136a1790",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        576,
        128
      ],
      "parameters": {
        "color": 7,
        "width": 1152,
        "height": 848,
        "content": "## Severity-Based Alert Routing\n**Why:** Prioritizes critical budget issues for immediate leadership attention while managing routine optimizations efficiently, preventing alert fatigue."
      },
      "typeVersion": 1
    },
    {
      "id": "fcd81ac1-3ee6-48e8-a53d-2afbcb6e2983",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -96,
        224
      ],
      "parameters": {
        "color": 7,
        "width": 640,
        "height": 640,
        "content": "## Automated Cost Monitoring\n**Why:** Enables continuous financial oversight instead of monthly reviews, catching budget deviations before they impact quarterly results through parallel AI analysis."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "availableInMCP": false,
    "executionOrder": "v1"
  },
  "versionId": "ab2ef3b9-3942-423d-bfbe-e2f0d1bc9894",
  "connections": {
    "Budget Alert Tool": {
      "ai_tool": [
        [
          {
            "node": "Optimization Coordinator Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Route by Alert Level": {
      "main": [
        [
          {
            "node": "Slack - Critical Alert",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Slack - Warning Alert",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Email - Executive Report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Workflow Configuration": {
      "main": [
        [
          {
            "node": "Generate Mock AI Metrics Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Cost Intelligence Agent": {
      "main": [
        [
          {
            "node": "Optimization Coordinator Agent",
            "type": "main",
            "index": 0
          },
          {
            "node": "Store Cost Analysis History",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Routing Recommendation Tool": {
      "ai_tool": [
        [
          {
            "node": "Optimization Coordinator Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Generate Mock AI Metrics Data": {
      "main": [
        [
          {
            "node": "Cost Intelligence Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Anthropic Model - Optimization": {
      "ai_languageModel": [
        [
          {
            "node": "Optimization Coordinator Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Optimization Coordinator Agent": {
      "main": [
        [
          {
            "node": "Route by Alert Level",
            "type": "main",
            "index": 0
          },
          {
            "node": "Store Optimization Recommendations",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Anthropic Model - Cost Intelligence": {
      "ai_languageModel": [
        [
          {
            "node": "Cost Intelligence Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger - Every 15 Minutes": {
      "main": [
        [
          {
            "node": "Workflow Configuration",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser - Optimization": {
      "ai_outputParser": [
        [
          {
            "node": "Optimization Coordinator Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser - Cost Analysis": {
      "ai_outputParser": [
        [
          {
            "node": "Cost Intelligence Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    }
  }
}