AutomationMart
Home/Browse/Track LLM token costs per customer using the Langchain code node
n8n

Track LLM token costs per customer using the Langchain code node

n8nn8n12 modulesv1.0
Google SheetsOpenAI

Note: This template only works for self-hosted n8n. This n8n template demonstrates how to use the Langchain code node to track token usage and cost for every LLM call. This is useful if your templates handle multiple clients or customers and you need a cheap and easy way to capture how much of your AI credits they are using. How it works In our mock AI service, we're offering a data conversion API to convert Resume PDFs into JSON documents. A form trigger is used to allow for PDF upload and th

At a glance

Track LLM token costs per customer using the Langchain code node is a ready-made n8n workflow you import as a workflow JSON file — no build required. It connects Google Sheets, OpenAI. It's free to download. Follow the 5-step import below to go live in minutes.

Platform
n8n
Connects
Google Sheets, OpenAI
Modules
12
Price
Free
Version
v1.0
Track LLM token costs per customer using the Langchain code node workflow diagram

About this workflow

Note: This template only works for self-hosted n8n. This n8n template demonstrates how to use the Langchain code node to track token usage and cost for every LLM call. This is useful if your templates handle multiple clients or customers and you need a cheap and easy way to capture how much of your AI credits they are using. How it works In our mock AI service, we're offering a data conversion API to convert Resume PDFs into JSON documents. A form trigger is used to allow for PDF upload and the file is parsed using the Extract from File node. An Edit Fields node is used to capture additional variables to send to our log. Next, we use the Information Extractor node to organise the Resume data into the given JSON schema. The LLM subnode attached to the Information Extractor is a custom one we've built using the Langchain Code node. With our custom LLM subnode, we're able to capture the usage metadata using lifecycle hooks. We've also attached a Google Sheet tool to our LLM subnode, allowing us to send our usage metadata to a google sheet. Finally, we demonstrate how you can aggregate from the google sheet to understand how much AI tokens/costs your clients are liable for. Check out the example Client Usage Log - 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. The LLM subnode can only be attached to non-"AI agent" nodes; Basic LLM node, Information Extractor, Question & Answer Chain, Sentiment Analysis, Summarization Chain and Text Classifier. Requirements Self-hosted version of n8n OpenAI for LLM Google Sheets to store usage metadata Customising this template Bring the custom LLM subnode into your own templates! In many cases, it can be a drop-in replacement for the regular OpenAI subnode. Not using Google Sheets? Try other databases or a HTTP call to pipe into your CRM.

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

Discover & analyze TikTok influencers with Bright Data, Claude AI & email outreach

Automated TikTok Influencer Discovery & Analysis A complete n8n automation that discovers TikTok influencers using Bright Data, evaluates their fit using Claude AI, and sends personalized outreach emails. Designed for marketing teams and brands that need a scalable, intelligent way to find and connect with relevant creators. --- 📋 Overview This workflow provides a full-service influencer discovery pipeline: it finds TikTok profiles using search keywords, uses AI to assess

Free

Add new incoming emails to a Google Sheets spreadsheet as a new row

This n8n workflow automates the process of capturing and storing incoming email details in a structured spreadsheet format, such as Google Sheets or Excel. Whenever a new email is received, the workflow extracts key details—including the sender’s email, subject, email body, and optional attachments—and logs them as a new row in the spreadsheet. You can customise this workflow to extract additional details, filter emails based on specific criteria, or send notifications when new entries are added

Free

Automate support ticket prioritization with Jotform, Gemini AI, ClickUp tasks

Automated Support Prioritization and AI Task Creation This n8n workflow instantly captures support issues submitted via Jotform and efficiently routes them to the appropriate team and logging system based on the severity level defined by the customer. It then uses an AI Agent (Google Gemini) to transform the raw customer data into a clear, concise, and actionable task for the development team. Workflow Overview 1. Ingestion & Logging: A new support ticket is received via Jotform and immediately

Free

TikTok post scraper via keywords | Bright Data + Sheets integration

TikTok Post Scraper via Keywords | Bright Data + Sheets Integration 📝 Workflow Description Automatically scrapes TikTok posts based on keyword search using Bright Data API and stores comprehensive data in Google Sheets for analysis and monitoring. --- 🔄 How It Works This workflow operates through a simple, automated process: - Keyword Input: User submits search keywords through a web form - Data Scraping: Bright Data API searches TikTok for posts matching the keywords -

Free

Upload files from new Google Sheets spreadsheet rows to Filestage

Every time a new row is added to a Google Sheets spreadsheet, Make will automatically upload a new file to Filestage.

Free

Extract contact information from business cards with Mistral OCR and GPT-4o-mini

Business Card Scanner – Automate Contact Extraction This workflow automates the process of extracting contact details from business cards (PDF or image) and saving them directly into an n8n Data Table. No more manual data entry — just upload a card and let AI do the rest. --- ⚙️ How It Works 1. Upload the business card via a web form (PDF or image). 2. The uploaded file is converted to Base64 for processing.

Free

Food menu update notifier

An intelligent food menu update notification system that automatically detects changes in your restaurant's special menu and sends personalized notifications to customers via multiple channels - WhatsApp, Email, and SMS. This workflow ensures your customers are always informed about new dishes, price changes, and menu availability in real-time. What's the Goal? - Automatically monitor special menu updates from Google Sheets - Detect menu changes and generate alert messages using AI - Send mu

Free

AI-powered lead enrichment with Explorium MCP & Telegram

AI-Powered Lead Enrichment with Explorium MCP & Telegram Who it's for Sales reps, agencies, and growth teams who want to turn basic company info into qualified leads with automated research . Perfect for B2B prospecting. What it does This workflow lets you send a company name or domain via Telegram, and instantly returns: ✅ Enriched company profile (industry, size, tech, pain points) ✅ A clean, structured JSON — ready for your CRM or sales tools How it works 💬 Send company info to your Telegram

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