Track OpenAI Token Usage and AI Agent Metrics with Google Sheets Dashboard
What it does Captures token usage and cost from your AI Agent/LLM. Logs model, tokens, cost, tool use, and conversation I/O to Google Sheets for simple observability and billing.
Perfect for Developers adding usage monitoring to AI agents. Teams needing cost transparency in prototypes.
How it works
Chat Trigger collects user input for the AI Agent. A Set node injects metadata like workflow, execution, and client IDs. LangChain Code node returns a configured Chat model with a callback that reads usage metadata. The callback computes input, output, and total costs based on per‑million token prices you define. It appends token metrics to a Google Sheet via the Google Sheets Tool. The Agent records intermediate tool calls. An If node checks whether a tool was used. When tools are used, the workflow logs input, output, tool name, and metadata to an Observability sheet.
How to use SELF-HOSTED N8N ONLY - the Langchain Code node is only available in the self-hosted version of n8n. It is not available in n8n cloud.
Requirements Self-hosted version of n8n
If you have any questions in running the workflow, see the attached video: https://youtu.be/JSulRS128MA
Related Templates
Lookup IP Geolocation Details with IP-API.com via Webhook
This n8n template enables you to instantly retrieve detailed geolocation information for any given IP address by simply ...
Send Hourly Crypto Market Analysis from Binance to Telegram
📈 Daily Crypto Market Summary Bot (Binance to Telegram) This workflow fetches 24h price change data from Binance for s...
Capture Website Screenshots with Bright Data Web Unlocker and Save to Disk
Who is this for? The Capture Website Screenshots with Bright Data Web Unlocker and Save to Disk workflow is built for au...
🔒 Please log in to import templates to n8n and favorite templates
Workflow Visualization
Loading...
Preparing workflow renderer
Comments (0)
Login to post comments