GenAiHub

Last checked 8 October 2026 — responded normally.

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 cal…

Live
Open / InstallLast updated October 8, 2026

Description

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 The AI Agent executes and then calls a subworkflow to calculate the token usage. The data is stored in Google Sheets 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. An n8n automation workflow template by Solomon.

Community Metrics

Views
1,818
Avg Rating
N/A
Ratings
0
Likes
0
Comments
—

Author

Solomon

Platform

web

Pricing model

free

Categories

  • Automation
  • AI

Tags

  • n8n
  • workflow
  • google-sheets
  • ai-agent
  • anthropic-chat-model
  • openai-chat-model
  • google-gemini-chat-model
  • think-tool

Capabilities

  • 6 nodes
  • 1,818 views

Information

TypeWorkflow
Sourcen8n
AddedJuly 27, 2026

Comments

?

Others in the same category, ranked by how often they are opened.