# Track OpenAI Admin API usage and costs with Google Sheets: n8n workflow

> Started by a clock, and works across Google Sheets. 26 steps: large, and worth reading before you trust it with anything live.

Source: https://millionrounds.com/workflow/track-openai-admin-api-usage-and-costs-with-google-sheets (Millionrounds; every figure on the page links to its filing or article)

[Automation library](https://millionrounds.com/workflows) · [Data collection](https://millionrounds.com/workflows?category=Data+collection#library)

# Track OpenAI Admin API usage and costs with Google Sheets

Started by a clock, and works across Google Sheets. 26 steps: large, and worth reading before you trust it with anything live.

Large

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Ftrack-openai-admin-api-usage-and-costs-with-google-sheets)

**26 steps** Large: read it before trusting it with anything live

**0** Branches: places the flow splits

**0** Loops or waits

**1** Service it connects to

## The flow

Starts it 1 Logic 19 Service 6

The steps in the order they run, from what starts it.

- 1 **Schedule Trigger** Schedule trigger *Starts it*
- 2 **OpenAI Admin - Get cost** Http Request *Service*
- 3 **OpenAI Admin - get token usage** Http Request *Service*
- 4 **Merge token and usage** Merge *Logic*
- 5 **Set api_key and project ids** Set *Logic*
- 6 **Merge Usage data** Merge *Logic*
- 7 **Get project_ids** Code *Logic*
- 8 **Merge token, usage, projects** Merge *Logic*
- 9 **Split Out api_key and project** Split Out *Logic*
- 10 **Add api_key name to token usage** Code *Logic*
- 11 **OpenAI Admin - Get Project details** Http Request *Service*
- 12 **Structure usage, cost, projects** Set *Logic*
- 13 **OpenAI Admin - Get API Key details** Http Request *Service*
- 14 **Add Project name in cost and usage objects** Code *Logic*
- 15 **Set api_key id and name** Set *Logic*
- 16 **Split Out Usage** Split Out *Logic*
- 17 **Split Out Cost** Split Out *Logic*
- 18 **Remove Duplicates** Remove Duplicates *Logic*
- 19 **Structure Usage data** Set *Logic*
- 20 **Structure Cost data** Set *Logic*
- 21 **Split Out Usage Results** Split Out *Logic*
- 22 **Split Out Cost results** Split Out *Logic*
- 23 **Set Usage data for Gsheets** Set *Logic*
- 24 **Set Cost data for Gsheets** Set *Logic*
- 25 **Append Usage to GSheets** Google Sheets *Service*
- 26 **Append Cost to GSheets** Google Sheets *Service*

## How it's built

- **Starts on:** A clock
- **Steps:** 26
- **Size:** Large: read it before trusting it with anything live
- **Connects to:** Google Sheets
- **Model:** None. This is plumbing, not judgement

## Questions

What does it need to run?

An n8n account, plus your own Google Sheets account. You connect your own accounts after importing it; none are included.

What starts it?

It starts on a clock.

Does it use AI?

No. Every step is fixed logic or a call to a service, so it does the same thing every time.

How long does it take to set up?

Take your time. At 26 steps it is large: read it before trusting it with anything live.

How do I import it?

Copy the workflow, open a new workflow in n8n and paste. The steps appear on the canvas, ready for your own accounts.

**Before you run it**

Nothing here has been tested by us. It is somebody's working automation, read and described from its own steps. Treat the connections it wants as a list of accounts it will touch, and read the 26 steps before you point it at anything that matters.

## Run it in n8n

- **Create your n8n account** Free to start. n8n is where the workflow runs. [Create an n8n account ↗](https://millionrounds.com/n8n)
- **Download the workflow** Free with a Millionrounds account. [Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Ftrack-openai-admin-api-usage-and-costs-with-google-sheets)
- **Paste it into n8n** Open a new workflow in n8n and paste. Then connect your own accounts.

Stored with the author's traces removed: canvas notes, instance identifiers, saved credential names and any live document they had left behind.

## Connects to

Each opens the other workflows that use it.

[Google Sheets](https://millionrounds.com/workflows?service=Google+Sheets#library)

## Workflows like it

Also data collection, with the same services where possible, closest in size first.

- [**CSV to HubSpot Uploader with Google Sheets Integration** 26 steps · Google Sheets](https://millionrounds.com/workflow/csv-to-hubspot-uploader-with-google-sheets-integration)
- [**Prepare Whisk AI product image briefs with Google Sheets** 26 steps · Google Drive, Google Sheets](https://millionrounds.com/workflow/prepare-whisk-ai-product-image-briefs-with-google-sheets)
- [**Recover unclaimed credits from Gmail with OpenRouter** 26 steps · Gmail, Google Sheets](https://millionrounds.com/workflow/recover-unclaimed-credits-from-gmail-with-openrouter)
- [**Track employee onboarding forms with Google Sheets and Gmail** 26 steps · Gmail, Google Sheets](https://millionrounds.com/workflow/track-employee-onboarding-forms-with-google-sheets-and-gmail)
- [**AI-powered Reddit brand promotion with Claude** 26 steps · calls a model · Google Sheets, Reddit](https://millionrounds.com/workflow/ai-powered-reddit-brand-promotion-with-claude)
- [**PPC: automate ad scraping and editing with OpenAI** 26 steps · calls a model · Google Drive, Google Sheets](https://millionrounds.com/workflow/ppc-automate-ad-scraping-and-editing-with-openai)
