Use this advanced n8n workflow to automatically track your OpenAI Admin API token usage, project costs, and API key metrics, logging all relevant financial data instantly to Google Sheets for transparent billing and analysis.
Download this n8n workflow template and start using it instantly.
Finance and Operations Teams: Who need accurate, granular tracking of AI resource consumption for chargebacks and budgeting.
Cloud Administrators: Responsible for monitoring large-scale deployments of OpenAI services.
Developers using n8n: Looking for a complex example of merging parallel HTTP requests and custom data transformation within an n8n workflow.
Anyone needing transparent AI billing: Seeking a fully automated, customizable solution that utilizes n8n templates for observability.
Managing API consumption across multiple projects and API keys can be complex, especially for large organizations utilizing OpenAI services. This n8n workflow solves the problem of manual tracking by creating a fully automated pipeline for billing and usage transparency. Using the built-in schedule n8n trigger, the system regularly queries the OpenAI Admin API for comprehensive usage and cost data. The core value of this n8n template lies in its ability to correlate token usage reports with corresponding cost metrics, and then enrich that data with human-readable API key names and project details, ensuring that every record appended to Google Sheets is complete and ready for analysis. This robust n8n workflow ensures billing compliance and provides immediate visibility into your AI spending.
This comprehensive n8n workflow executes based on a defined schedule n8n trigger, typically running once daily or hourly.
Merge token and usage). This combined stream is then merged with the retrieved project data (Merge token, usage, projects).Add Project name in cost and usage objects) performs final transformations, integrating the project names into the cost and usage items.To install and utilize this high-value n8n template, follow these steps:
Append Usage to GSheets and Append Cost to GSheets).Add api_key name to token usage) to ensure the input field references match your data structure, especially if the OpenAI API responses change slightly. Schedule Trigger (n8n trigger): Initiates the entire n8n workflow on a recurring schedule (e.g., every hour or day). This is the starting n8n node.
OpenAI Admin - get token usage (HTTP Request n8n node): Calls the OpenAI Admin API to retrieve raw token usage statistics.
OpenAI Admin - Get cost (HTTP Request n8n node): Calls the OpenAI Admin API to retrieve cost data associated with usage.
OpenAI Admin - Get API Key details (HTTP Request n8n node): Fetches metadata about the API keys, enabling the correlation of cryptic key IDs with meaningful names.
Set apikey and project ids / Set apikey id and name (Set n8n node): Used extensively for structuring, renaming, and selecting specific data fields necessary for subsequent merging and Google Sheets output.
Add api_key name to token usage (Code n8n node): Custom scripting used to map and merge API key names found in the API key details response into the corresponding token usage records.
Merge token and usage / Merge token, usage, projects (Merge n8n node): Critical flow control n8n node used to systematically combine data streams from the parallel API calls and project lookups.
Split Out Usage / Split Out Cost (Split Out n8n node): Separates the combined dataset back into discrete Cost and Usage streams for final, customized formatting before writing to Google Sheets.
Identify new search queries (keywords) in Google Search Console that previously had zero impressions. This powerful n8n workflow uses advanced filtering logic to categorize zero-click opportunities and immediate traffic drivers.

Use this powerful n8n workflow to track P&L across all your investment brokers automatically. Securely receive scheduled or on-demand portfolio summaries via Telegram. Explore more n8n templates today.

Automate marketing performance tracking with this robust n8n workflow. Fetch HighLevel won deals, calculate lead source metrics, and report instantly via Google Sheets and Slack.

Use this powerful n8n workflow to track OpenAI token consumption, calculate costs, and monitor AI agent observability metrics, logging all data automatically to Google Sheets. Ideal for cost management.

Capture Partnerstack affiliate events using an n8n trigger, automatically log details to Google Sheets, and send instant alerts via Telegram. A powerful n8n workflow for partnership management.

We are a product studio that helps organizations leverage no-code and generative AI to automate internal processes and launch new digital products. LinkedIn: https://www.linkedin.com/in/baptistej/







































