AutomationMart
Home/Browse/Track AI agent token usage and estimate costs in Google Sheets
n8n

Track AI agent token usage and estimate costs in Google Sheets

n8nn8n13 modulesv1.0
Google SheetsOpenAIGoogle DriveGemini

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
Track AI agent token usage and estimate costs in Google Sheets workflow diagram

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

n8n

How to import this n8n workflow

  1. 1

    Download the workflow JSON file after purchase.

  2. 2

    Open n8n → click the menu → Import from File.

  3. 3

    Select the downloaded JSON and import.

  4. 4

    Set up credentials for each node that requires them.

  5. 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

Use this template to automatically attach multiple files to an Email message sent when a new Shopify order is created. Please, move the files you want to use to a dedicated Google Drive folder.

Free

Back up contacts from your Apple iOS device to a Google Sheets spreadsheet

Every time you add a new contact to your Apple iOS device, Make will automatically add that contact to a Google Sheets spreadsheet as a new row. The template uses this [example spreadsheet](https://goo.gl/boNvUK).

Free

Trigger Etsy shop receipts and add rows to Google Sheets

Automatically log Etsy shop receipts into Google Sheets. Streamline your sales tracking by adding each receipt as a new row in your spreadsheet.

Free

Generate & edit images with Gemini AI: storage & email delivery pipeline

AI Image Generator with Nano Banana: Automated Creation and Delivery For content creators, agencies, and SaaS developers who need automated AI image generation and editing with professional delivery workflows. Overview This template demonstrates intelligent workflow routing based on user input type, leveraging Google's Gemini 2.5 Flash image model for both generative and editing tasks. The workflow includes complete file handling, cloud storage integration, and professional email notification wi

Free

Autonomous customizable support chatbot on Intercom + Discord thread reports

Click here to access this Workflow for free. --- Connect your own LLM-boosted chatbot to Intercom (f their overly priced FlN Agent), and stay in touch on Discord This workflow connects your Intercom chat system with your own AI Agent and sends a complete log of each conversation to Discord using threads. It allows you to run a fully automated support system while maintaining full visibility of the bot's behavior in real time. For every new conversation in Intercom, a thread is created in a speci

Free

Automate image portfolio organization with GPT-4o Vision, Google Drive and Notion

Overview This template is ideal for photographers, graphic designers, and creative professionals who manage large volumes of visual assets. It is also perfect for Digital Asset Managers looking for a customizable, automated solution to organize files without manual tagging. What it does When a new image is uploaded to a designated "Inbox" folder in Google Drive, the workflow performs the following actions: - AI Analysis: Uses GPT-4o to analyze the image content, generating a descript

Free

Import Odoo product images from Google Drive

Objective This workflow automatically imports product images from Google Drive and associates them with templates and products in Odoo.

Free

Extract LinkedIn search results into a Google Sheet with SourceGeek

How is works This template makes it possible to extract Search Results from LinkedIn and import them into a Google Sheet. It determines from where the url is coming from (LinkedIn Basic, Sales Navigator or Recruiter) and selects which node needs to be used. The node returns a Run ID while in the background the list is being exported. Run going through a loop the workflow waits untill the job is done. When the export is ready, the response is being transformed into a workable object which

Free

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.

Log in to review
Free
No ratings yet

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.

₹2,499/ session
3 hrs · video call
  • Configure live on Google Meet / Zoom
  • Free follow-up if workflow has defects
  • Platform expert assigned to you
Book installation session
Free