Automated Client Usage Logging with AI
detail.loadingPreview
This n8n workflow automatically logs client usage data, including token counts and associated costs, directly into a Google Sheet. It's designed for services that leverage AI models and require detailed tracking for billing or analysis.
About This Workflow
This n8n workflow provides a robust solution for automatically tracking and logging client usage of AI-powered services. Upon form submission, it captures essential details like client ID, workflow execution, and importantly, the input and output token counts and their corresponding costs from an AI model (specifically configured for OpenAI's models like GPT-4o-mini). This data is then meticulously appended to a designated Google Sheet, creating a comprehensive audit trail for billing, cost analysis, and service optimization. The workflow ensures accurate and transparent record-keeping, simplifying financial reconciliation and providing valuable insights into resource consumption.
Key Features
- Automated Usage Tracking: Captures detailed usage metrics for AI service consumption.
- Cost Calculation: Logs input, output, and total token costs for accurate billing.
- Seamless Google Sheets Integration: Automatically appends data to a pre-defined spreadsheet.
- Form-Based Trigger: Initiates the logging process via a user-friendly form submission.
- Customizable AI Model Configuration: Easily adapt to different AI models and pricing structures.
How To Use
- Configure Form Trigger: Set up the 'On form submission' node with your desired form title, description, and fields (e.g., file upload for CV parsing). Set the response mode to 'lastNode'.
- Define Logging Attributes: Use the 'Logging Attributes' node to set static or dynamic values for
workflow_id,execution_id, andclient_id. - Integrate with AI Model: Configure the 'Custom LLM Subnode' by setting your OpenAI API key, desired model, and the cost per token for inputs and outputs. Ensure the
client_id,workflow_id, andexecution_idare correctly passed from the previous node. - Log to Google Sheets: Configure the 'Client Usage Log' node with your Google Sheets credentials, the Document ID and Sheet Name of your target spreadsheet. Ensure the column mappings match the attributes defined in the 'Logging Attributes' and generated by the LLM subnode.
Apps Used
Workflow JSON
{
"id": "26d456ff-d89b-4025-a1b5-ca94110f6329",
"name": "Automated Client Usage Logging with AI",
"nodes": 28,
"category": "Operations",
"status": "active",
"version": "1.0.0"
}Note: This is a sample preview. The full workflow JSON contains node configurations, credentials placeholders, and execution logic.
Get This Workflow
ID: 26d456ff-d89b...
About the Author
N8N_Community_Pick
Curator
Hand-picked high quality workflows from the global community.
Statistics
Related Workflows
Discover more workflows you might like
Universal CSV to JSON API Converter
Effortlessly transform CSV data into structured JSON with this versatile n8n workflow. Integrate it into any application as a custom API endpoint, supporting various input methods including file uploads and raw text.
Google Sheets to Icypeas: Automated Bulk Domain Scanning
This workflow streamlines the process of performing bulk domain scans by integrating your Google Sheets data directly with the Icypeas platform. Automate the submission of company names from your spreadsheet to Icypeas for comprehensive domain information, saving valuable time and effort.
Instant WooCommerce Order Notifications via Telegram
When a new order is placed on your WooCommerce store, instantly receive detailed notifications directly to your Telegram chat. Stay on top of your e-commerce operations with real-time alerts, including order specifics and a direct link to view the order.