Track AI agent token usage and estimate costs in Google Sheets
This n8n template demonstrates how to obtain token usage from AI Agents and places the data into a spreadsheet that calculates the estimated cost of the execution. Obtaining the token usage from AI Agents is tricky, because it doesn't provide all the data from tool calls. This workflow taps into the workflow execution metadata to extract token usage information. Works well with OpenAI, Google and Anthropic. Other LLM providers might need small tweaks. How it
At a glance
Track AI agent token usage and estimate costs in Google Sheets is a ready-made n8n workflow you import as a workflow JSON file — no build required. It connects Google Sheets, OpenAI, Google Drive, Gemini. It's free to download. Follow the 5-step import below to go live in minutes.
- Platform
- n8n
- Connects
- Google Sheets, OpenAI, Google Drive, Gemini
- Modules
- 13
- Price
- Free
- Version
- v1.0

About this workflow
This n8n template demonstrates how to obtain token usage from AI Agents and places the data into a spreadsheet that calculates the estimated cost of the execution. Obtaining the token usage from AI Agents is tricky, because it doesn't provide all the data from tool calls. This workflow taps into the workflow execution metadata to extract token usage information. Works well with OpenAI, Google and Anthropic. Other LLM providers might need small tweaks. How it works 1. The AI Agent executes and then calls a subworkflow to calculate the token usage. 2. The data is stored in Google Sheets 3. The spreadsheet has formulas to calculate the estimated cost of the execution. How to use - The AI Agent is used as an example. Feel free to replace this with other agents you have. - Call the subworkflow AFTER all the other branches have finished executing. Requirements - LLM account (OpenAI, Gemini...) for API usage. - Google Drive and Sheets credentials - n8n API key of your instance
How to import this n8n workflow
- 1
Download the workflow JSON file after purchase.
- 2
Open n8n → click the menu → Import from File.
- 3
Select the downloaded JSON and import.
- 4
Set up credentials for each node that requires them.
- 5
Click Execute Workflow to test, then activate.
Setup guide
Setup guide included
Purchase to unlock the full step-by-step guide
Related N8n workflows
Send confirmation Email with multiple attachments for a new Shopify order
Back up contacts from your Apple iOS device to a Google Sheets spreadsheet
Trigger Etsy shop receipts and add rows to Google Sheets
Generate & edit images with Gemini AI: storage & email delivery pipeline
Autonomous customizable support chatbot on Intercom + Discord thread reports
Automate image portfolio organization with GPT-4o Vision, Google Drive and Notion
Import Odoo product images from Google Drive
Extract LinkedIn search results into a Google Sheet with SourceGeek
Reviews
No reviews yet
Be the first to buy and share your experience.
Leave a review
Sign in to share your experience with this workflow.
Create a free account to purchase workflows.
- JSON blueprint — instant download
- Setup guide PDF included
- 5 downloads · valid 30 days
- Works with n8n
Need help setting this up?
Book a 3-hour live setup session with an Agility consultant.
- Configure live on Google Meet / Zoom
- Free follow-up if workflow has defects
- Platform expert assigned to you