Library / Monitoring, Ops & Incidents
Monitoring, Ops & Incidents
Track LLM Usage and Cost in Google Sheets
When a form is submitted or on a schedule, a custom LLM subnode logs token usage and cost to Google Sheets and emails summaries via Gmail.
What it does
## 4. Use Custom LLM Subnode to Track Usage & Cost [Learn more about the Langchain Code Node]({{ $env.WEBHOOK_URL }} By creating our custom LLM subnode using the Langchain Code node, we are able to tap into the chat completion's response which contains the token usage metadata for the information extractor request. With this, we can calculate exactly how much the client's request is costing per use! The only remaining step then is to store this data somewhere. Rather than importing more dependencies or hardcoding more credentials, a novel solution can be to attach a tool to our subnode. Here, we've decided to use the Google Sheets tool and append the client's usage metrics to the sheet. Check it out here - [Client Usage Log]( {{ $env.WEBHOOK_URL }}
The steps
- Client Usage Log
- Logging Attributes
- On form submission
- Custom LLM Subnode
- Display JSON Document
- Filter Last Month
- Get Client Logs
- Calculate Totals
- Every End of Month
- Send Invoice
- Parse PDF Upload
- Extract Resume Data
- Error Handler for 8884df86
- Error Handler for 10d95dcb
16 steps in total.
Similar automations
MCP Servers & ToolsAWS Cost and Usage Reports as an MCP Server5 stepsMonitoring, Ops & IncidentsTrack AI Token Usage and Cost in Google Sheets8 stepsMonitoring, Ops & IncidentsTrack AI Token Usage for WhatsApp and Telegram Agents25 stepsReports, Analytics & DashboardsTrack LLM Token Costs per Customer12 steps