This n8n workflow enables clients to upload PDF resumes for data extraction while tracking AI token usage and costs for billing purposes. It streamlines the process of offering a resume parsing service, records usage metrics in Google Sheets, and generates monthly invoices automatically.
**Workflow Overview:**
1. **Client Submission:** The process begins with a form trigger where clients upload a PDF resume and acknowledge terms.
2. **PDF Extraction:** The uploaded PDF is extracted using the ‘Extract from File’ node to obtain raw text.
3. **Data Parsing:** The text data is fed into a custom Langchain-based information extractor, converting the resume into a structured JSON format.
4. **Token Usage Logging:** A specialized Langchain code node uses a custom LLM to perform the data extraction while capturing token usage and associated costs. This metadata is then appended to a Google Sheets log for record-keeping.
5. **Display Results:** The parsed JSON data is displayed in a form for review.
6. **Monthly Cost Analysis:** The workflow filters logs from the past month, sums up total tokens and costs, and summarizes usage.
7. **Automated Billing:** At the end of each month, an invoice email is generated with detailed usage information and sent to the client.
**Use Cases:**
This workflow is ideal for SaaS companies providing resume parsing services or any AI application that needs to track API usage for billing or optimization purposes.
