75일차 답 추가: 실습 정답 문서 · VIBE-A · 정답 워크플로우와 25단계 실행 기록 · tcost

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mcchaeandClaude Opus 5.5 committed 2026-10-29 09:57:32 +09:00
1 parent 01dc892303
commit ebff58c72e
79 files changed
+18753

No files matched your search

@@ -0,0 +1,127 @@
{
"name": "75 Cost report (answer)",
"nodes": [
{
"name": "Report webhook",
"type": "n8n-nodes-base.webhook",
"typeVersion": 2,
"parameters": {
"httpMethod": "POST",
"path": "my-cost-report",
"responseMode": "responseNode",
"options": {}
},
"position": [
0,
300
],
"id": "45dddbe3-765d-5071-8c44-f1406634465b",
"webhookId": "49a4308f-5df9-5973-963a-3d7f6bbeb9b7"
},
{
"name": "Get summary",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"parameters": {
"url": "http://data-api:8800/usage/summary",
"options": {}
},
"position": [
220,
300
],
"id": "cf6e061b-9073-57ea-a564-1769eec23afd"
},
{
"name": "Get budget",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"parameters": {
"url": "http://data-api:8800/budget",
"options": {}
},
"position": [
440,
300
],
"id": "fb9bdc4e-453a-5261-9b27-f913533bebb5"
},
{
"name": "Make report",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"parameters": {
"jsCode": "const s = $('Get summary').first().json;\nconst b = $('Get budget').first().json;\nconst body = $('Report webhook').first().json.body ?? {};\nconst perDay = Number(body.requests_per_day ?? s.requests);\nconst workdays = Number(body.workdays ?? 22);\nconst avg = s.requests ? s.cost_usd / s.requests : 0;\nconst round = (v) => Math.round(v * 1e6) / 1e6;\nconst users = Object.entries(s.by_user).sort((a, b2) => b2[1].cost_usd - a[1].cost_usd);\nconst models = Object.fromEntries(Object.entries(s.by_model).map(([k, v]) => [k, round(v.cost_usd)]));\nconst result = { requests: s.requests, calls: s.calls, cost_usd: round(s.cost_usd), avg_usd: round(avg),\n by_model: models, top_user: users.length ? users[0][0] : null,\n projected_month_usd: round(avg * perDay * workdays), daily_budget_usd: b.daily_usd, remaining_usd: round(b.remaining_usd), over_budget: b.over };\nreturn [{ json: result }];"
},
"position": [
880,
300
],
"id": "ee73c6a8-12a8-57fc-ab34-81fd258667cc"
},
{
"name": "Send report",
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1.1,
"parameters": {
"respondWith": "json",
"responseBody": "={{ $json }}",
"options": {}
},
"position": [
1100,
300
],
"id": "c124f9d7-3b8c-5134-8343-936873621946"
}
],
"connections": {
"Report webhook": {
"main": [
[
{
"node": "Get summary",
"type": "main",
"index": 0
}
]
]
},
"Get summary": {
"main": [
[
{
"node": "Get budget",
"type": "main",
"index": 0
}
]
]
},
"Get budget": {
"main": [
[
{
"node": "Make report",
"type": "main",
"index": 0
}
]
]
},
"Make report": {
"main": [
[
{
"node": "Send report",
"type": "main",
"index": 0
}
]
]
}
},
"settings": {
"executionOrder": "v1"
}
}