Image Generated with ideoGener8r
n8n workflow template
This workflow is ideal for AI engineers, automation specialists, and business analysts who use OpenAI, Anthropic, or other token-based large language models (LLMs) in their n8n workflows and want to track their usage and accuratley estimate associated costs.
Whether you're prototyping workflows or deploying in production, this tool gives you insight into how many tokens you're using and what that translates to in actual dollars.
n8n users running AI-based workflows often struggle to track how many tokens were used per execution and how much those tokens cost. Without visibility into usage, it’s easy to lose track of API spending.
This workflow solves that problem by:
This template allows you to analyze the token usage and cost of any workflow in n8n. It uses an Execute Workflow
node to call the Token Estim8r
utility, which:
Create Google Sheet: Copy and paste the CSV template below into a .csv
file and upload to Google Sheets:
timestamp, Total Tokens, Prompt Tokens, Completion Tokens, Models Used, Tools Used, Total Cost, Json Array
Set up pricing (optional): In the Get AI Pricing
node, add your Jina API Auth Header if you want live pricing.
Select the correct Google Sheet: Ensure your workflow is pointing to the imported sheet.
Attach to your target workflow: Add an Execute Workflow
node to the end of your target workflow.
Point to this Token Estim8r: Choose this template as the executed workflow and send {{ $execution.id }}
as the input.
Run and view results: Trigger the target workflow and see your token usage and cost data populate in the sheet.
This utility workflow works across all n8n deployment types and uses only built-in nodes.