{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "ea1905e6-aabf-48ff-ab1b-3f4ecb21dd6d",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -800,
        112
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "df3d4b4d-4cae-4508-b8f2-88823d201948",
      "name": "OpenAI Admin - get token usage",
      "type": "n8n-nodes-base.httpRequest",
      "maxTries": 3,
      "position": [
        -320,
        -96
      ],
      "parameters": {},
      "retryOnFail": true,
      "typeVersion": 4.2,
      "waitBetweenTries": 5000
    },
    {
      "id": "5a850732-7368-44d2-b63f-47aed33a7070",
      "name": "OpenAI Admin - Get cost",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -320,
        304
      ],
      "parameters": {},
      "retryOnFail": true,
      "typeVersion": 4.2,
      "waitBetweenTries": 5000
    },
    {
      "id": "c2fff19f-9f6d-40b6-87c6-87fb21cb7c9d",
      "name": "Remove Duplicates",
      "type": "n8n-nodes-base.removeDuplicates",
      "position": [
        912,
        80
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "57ad4169-a0e2-48f0-b410-288ec78072fb",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3168,
        -64
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "15eb4f9b-4de0-43d2-a4df-769d985a6e3b",
      "name": "Set api_key and project ids",
      "type": "n8n-nodes-base.set",
      "position": [
        32,
        80
      ],
      "parameters": {},
      "executeOnce": true,
      "typeVersion": 3.4
    },
    {
      "id": "9d05d42d-67bd-4c82-a94b-4f8a5c996136",
      "name": "Set api_key id and name",
      "type": "n8n-nodes-base.set",
      "position": [
        688,
        80
      ],
      "parameters": {},
      "executeOnce": false,
      "typeVersion": 3.4
    },
    {
      "id": "ae1e9985-90e8-432e-8b78-5107987adc33",
      "name": "Add api_key name to token usage",
      "type": "n8n-nodes-base.code",
      "position": [
        1440,
        32
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "f9d890d1-a7e1-45bf-8d1b-dfb6d7c6d098",
      "name": "Get project_ids",
      "type": "n8n-nodes-base.code",
      "position": [
        1888,
        512
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "1b331a96-7dd6-4c29-a54b-54e710fb2b70",
      "name": "Merge token, usage, projects",
      "type": "n8n-nodes-base.merge",
      "position": [
        2320,
        304
      ],
      "parameters": {},
      "typeVersion": 3.2
    },
    {
      "id": "263244a9-fae0-446c-b45d-df09722f6185",
      "name": "Merge token and usage",
      "type": "n8n-nodes-base.merge",
      "position": [
        1648,
        288
      ],
      "parameters": {},
      "typeVersion": 3.2
    },
    {
      "id": "1d061f4f-38e6-41f9-a851-dabb74a5fc08",
      "name": "Structure usage, cost, projects",
      "type": "n8n-nodes-base.set",
      "position": [
        2544,
        304
      ],
      "parameters": {},
      "executeOnce": true,
      "typeVersion": 3.4
    },
    {
      "id": "5b6e1d90-5a17-4bed-aac7-db843f2b37f0",
      "name": "Split Out api_key and project",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        240,
        80
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "272f552c-69bf-4998-8d88-0a2f80f1239c",
      "name": "Split Out Usage",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        3200,
        128
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "a3004d76-aa2c-47c5-ba87-ee2befda7c4e",
      "name": "Split Out Cost",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        3200,
        544
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "cafb9389-9bcc-4664-813f-e4897c105a86",
      "name": "Split Out Usage Results",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        3632,
        128
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "6612c578-8e9a-4fdd-bfc7-35244d15f40d",
      "name": "Split Out Cost results",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        3632,
        544
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "0988b8be-e008-4faa-bbda-2d5fdbd08382",
      "name": "Structure Usage data",
      "type": "n8n-nodes-base.set",
      "position": [
        3424,
        128
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "6dc6199b-240f-4a2a-a5ec-d32b5c1248ec",
      "name": "Structure Cost data",
      "type": "n8n-nodes-base.set",
      "position": [
        3424,
        544
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "92220f1d-7ff6-4562-8c65-2204ae759ab1",
      "name": "Append Usage to GSheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        4128,
        128
      ],
      "parameters": {},
      "typeVersion": 4.6
    },
    {
      "id": "ffbe0137-09de-4737-8b37-a08ddedcf1d6",
      "name": "Append Cost to GSheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        4128,
        544
      ],
      "parameters": {},
      "typeVersion": 4.6
    },
    {
      "id": "53d5b39d-a774-4281-933c-c67ad9680742",
      "name": "Set Usage data for Gsheets",
      "type": "n8n-nodes-base.set",
      "position": [
        3840,
        128
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "a5520165-7ab1-43f7-91d0-07ab3f7373a6",
      "name": "Set Cost data for Gsheets",
      "type": "n8n-nodes-base.set",
      "position": [
        3840,
        544
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "8b2c2e16-96a6-41e8-8f78-5b2173c2ddf7",
      "name": "Sticky Note12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1968,
        -560
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "26d52319-9853-4b94-a7f0-194ce70adef4",
      "name": "Sticky Note13",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1968,
        -240
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "bca3e1be-2213-4c9b-b12e-633c06152332",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -896,
        -64
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "d7c06d42-7e84-4903-91fb-13ea22cbbea5",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -400,
        -288
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "30f65492-21c5-4349-9239-8584f9820e56",
      "name": "Merge Usage data",
      "type": "n8n-nodes-base.merge",
      "position": [
        1184,
        -80
      ],
      "parameters": {},
      "typeVersion": 3.2
    },
    {
      "id": "abeefaff-86fc-402e-bac6-d5a0633d3707",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -48,
        -16
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "62221c80-5440-407c-9902-6d5700358407",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1360,
        -80
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "e7a0c559-3716-4540-a697-7717b6a2e156",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1840,
        400
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "d5fd06ba-eba6-4e2f-9f2e-f3df7160f50c",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2512,
        224
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "f1e13d16-d1f8-4297-9a30-dd040c7b8153",
      "name": "Add Project name in cost and usage objects",
      "type": "n8n-nodes-base.code",
      "position": [
        2768,
        304
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "316b5098-6f85-4252-8c95-68b936aaf177",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        4048,
        -64
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "78223c42-fbc1-41cd-8512-b6d7bf4a9f14",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3168,
        368
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "252fe581-58e8-4772-81dc-e345c4d19fed",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        4048,
        368
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "35f629c1-74ea-418a-a55f-49f2c76f7d08",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        4048,
        -176
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "5834e857-66c1-4aed-a1f1-b2ece21c77c2",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1968,
        880
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "057f2407-27be-4756-961e-ce8c48d1a538",
      "name": "OpenAI Admin - Get Project details",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2064,
        512
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "bdb8a453-b5b1-447d-af78-f5b0a6ee3c27",
      "name": "OpenAI Admin - Get API Key details",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        464,
        80
      ],
      "parameters": {},
      "retryOnFail": true,
      "typeVersion": 4.2,
      "waitBetweenTries": 5000
    }
  ],
  "connections": {
    "Split Out Cost": {
      "main": [
        [
          {
            "node": "Structure Cost data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get project_ids": {
      "main": [
        [
          {
            "node": "OpenAI Admin - Get Project details",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out Usage": {
      "main": [
        [
          {
            "node": "Structure Usage data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Usage data": {
      "main": [
        [
          {
            "node": "Add api_key name to token usage",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "OpenAI Admin - Get cost",
            "type": "main",
            "index": 0
          },
          {
            "node": "OpenAI Admin - get token usage",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Remove Duplicates": {
      "main": [
        [
          {
            "node": "Merge Usage data",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Structure Cost data": {
      "main": [
        [
          {
            "node": "Split Out Cost results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structure Usage data": {
      "main": [
        [
          {
            "node": "Split Out Usage Results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge token and usage": {
      "main": [
        [
          {
            "node": "Get project_ids",
            "type": "main",
            "index": 0
          },
          {
            "node": "Merge token, usage, projects",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out Cost results": {
      "main": [
        [
          {
            "node": "Set Cost data for Gsheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Admin - Get cost": {
      "main": [
        [
          {
            "node": "Merge token and usage",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Set api_key id and name": {
      "main": [
        [
          {
            "node": "Remove Duplicates",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out Usage Results": {
      "main": [
        [
          {
            "node": "Set Usage data for Gsheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Cost data for Gsheets": {
      "main": [
        [
          {
            "node": "Append Cost to GSheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Usage data for Gsheets": {
      "main": [
        [
          {
            "node": "Append Usage to GSheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set api_key and project ids": {
      "main": [
        [
          {
            "node": "Split Out api_key and project",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge token, usage, projects": {
      "main": [
        [
          {
            "node": "Structure usage, cost, projects",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out api_key and project": {
      "main": [
        [
          {
            "node": "OpenAI Admin - Get API Key details",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Admin - get token usage": {
      "main": [
        [
          {
            "node": "Set api_key and project ids",
            "type": "main",
            "index": 0
          },
          {
            "node": "Merge Usage data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add api_key name to token usage": {
      "main": [
        [
          {
            "node": "Merge token and usage",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structure usage, cost, projects": {
      "main": [
        [
          {
            "node": "Add Project name in cost and usage objects",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Admin - Get API Key details": {
      "main": [
        [
          {
            "node": "Set api_key id and name",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Admin - Get Project details": {
      "main": [
        [
          {
            "node": "Merge token, usage, projects",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Add Project name in cost and usage objects": {
      "main": [
        [
          {
            "node": "Split Out Usage",
            "type": "main",
            "index": 0
          },
          {
            "node": "Split Out Cost",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}