Stack SpendDocs

OpenAI

Connect your OpenAI account to track API costs in real time, broken down by project and model.

What StackSpend tracks

Once connected, StackSpend pulls cost and usage data directly from the OpenAI usage API. You get:

  • Real-time API costs as they accrue
  • Project-level cost breakdown across all your OpenAI projects
  • Model-level usage — gpt-4o, gpt-4, gpt-3.5-turbo, and more
  • Full historical data imported on first sync
MetricDetail
LatencyReal-time
Historical dataFull history
Setup time~2 minutes

Prerequisites

  • An OpenAI account with billing enabled
  • Admin or billing access on the organization
  • Your Organization ID (starts with org-)

Setup

API key permissions.The API key must have billing access. A key scoped to model access only will not return cost data. Create the key with no scope restrictions, or explicitly grant it billing scope.
1

Get your API key

  1. Go to the OpenAI Dashboard → API Keys.
  2. Click Create new secret key.
  3. Give it a descriptive name such as StackSpend.
  4. Copy the key immediately — it is only shown once. Store it somewhere safe until you paste it into StackSpend.
2

Get your Organization ID

  1. In the OpenAI Dashboard, go to Settings → Organization.
  2. Copy the Organization ID. It begins with org-.
3

Add to StackSpend

Go to Providers → Add provider → OpenAI and fill in both fields:

Add OpenAI provider

••••••••••••••••••••

Starts with sk-...

org-...

Find in OpenAI Settings → Organization → Organization ID

ProvidersAdd providerOpenAI
4

Verify sync

After saving, an initial sync starts automatically. Cost data typically appears within a few minutes. To confirm everything is working, return to the Providers page and check the Last synced timestamp next to the OpenAI entry.

Frequently asked questions

What access does StackSpend need to connect OpenAI?

StackSpend needs a read-only OpenAI Admin API key plus your Organization ID (which starts with org-). The key must have billing access; a key scoped to model access only will not return cost data.

Is the connection read-only?

Yes. StackSpend only reads cost and usage data from the OpenAI usage API and never writes to your OpenAI account. It pulls project-level and model-level breakdowns for models like gpt-4o, gpt-4, and gpt-3.5-turbo.

How long does setup take and how much history loads?

Setup takes about 2 minutes. On the first sync, StackSpend imports your full available OpenAI usage history and then keeps costs current in real time as they accrue.

Why don't I see any cost data yet?

The initial sync runs automatically after you save and data usually appears within a few minutes. If nothing shows, confirm the API key has billing scope (not model-access only) and that the Organization ID is correct, then check the Last synced timestamp on the Providers page.

Connect OpenAI to StackSpend — StackSpend Docs