Connect OpenAI
Paste an Admin key of your OpenAI organization, and Costfluent imports its daily API cost by project, line item, API key and user.
Costfluent reads your OpenAI API spend from the organization Costs API, with an Admin key you create for it. One connection is one OpenAI organization, and the cost of every project in it.
How Costfluent connects
Costfluent stores the Admin key encrypted and uses it for two reads: the organization's daily costs, and the API key list of each project those costs name, of which Costfluent keeps each key's ID and name only. OpenAI offers an Admin key no call that names its organization, so Costfluent identifies the connection by the organization OpenAI's answer names, or, when it names none, by a fingerprint of the key itself. The key is only ever used for that connection.
Choose Read only when you create the key, where the OpenAI platform offers it. A key with full permissions can also manage the organization's members, projects and keys.
Prerequisites
- The Owner or Integration owner organization role in Costfluent.
- An Admin key, which an Organization Owner creates on the OpenAI platform under the
organization's Admin keys. It starts with
sk-admin-. A project key (sk-proj-) cannot read cost.
Connect
- Open Settings, then Integrations, select OpenAI, and open the Connect tab.
- Select "Add Admin key", keep the suggested Display name or enter your own, and paste the key into Admin key.
- Select "Test connection" to see each check, or "Connect" to save.
Costfluent reads one day of costs before storing anything, so a connection that saves can read your cost. A connection with the same identity as an existing one is refused.
Connect each organization once, with one key. When OpenAI does not name the organization, two keys of one organization are two identities, and its spend would be counted twice.
Data and freshness
Connecting imports as far back as your plan's backfill reaches, and at most six months (Manage connections), as long as OpenAI reports cost that far back. Older months collected on request reach the whole months of OpenAI's past year. Cost arrives by UTC day, in US dollars, as OpenAI reports it.
Reporting dimensions
- Account is the project. Spend outside any project appears under the connection's identity.
- Service is
OpenAI. - SKU is OpenAI's line item, such as
gpt-4.1-mini-2025-04-14, input, kept whole: OpenAI does not document its format, so Costfluent does not split it into model and operation. - Usage unit is
Tokenswhere OpenAI states a line item's quantity in tokens or in thousands of tokens, counted one by one; any other quantity, such as images, keeps OpenAI's unit. - Resource is the API key, by the name its project's key list gives it, and Resource ID its
ID, shown as
name (id); Resource type isAPI key. A key no list names, such as one deleted since or one in a project whose keys the Admin key may not list, is named by its ID, and so is a key whose name holds an@, which is often a person's email address. Cost without a key has no resource. - Tag
ai:useris the ID of the OpenAI user OpenAI states for the cost. Costfluent keeps the ID only, never a name or an email address. OpenAI groups some organizations' cost by user only for some periods; cost of the other periods carries no user. - Cost imported before Costfluent read API keys and users shows neither until that month is collected again.
- The billing account is the connection's identity, and the billing period is the calendar month.
Update or disconnect
After connecting
The Manage tab lists the connection by its display name, with its Organization ID: the
organization OpenAI named, or key: and the key's fingerprint. Open the gear icon beside it to see
whether the costs are still readable, which workspaces the connection feeds, and which months have
been imported. Run checks runs the checks again on request.
Rotating or removing access
When the connection is identified by the organization, select Update credentials on the connection page and paste a new Admin key of the same organization; then revoke the old key. When it is identified by the key's fingerprint, a new key is a new identity and is refused: remove the connection and connect the new key instead.
To retire the connection, remove it in Costfluent and revoke its key on the OpenAI platform. Removing it erases the cost it imported (Remove a connection).
Troubleshooting
- OpenAI refused this key. The key is not an Admin key, or it was revoked. An Organization Owner creates Admin keys under the organization's settings.
- OpenAI has no costs endpoint for this key's organization. OpenAI answered that the Costs API does not exist for the organization. Check that the key belongs to an organization with API usage.
- This key belongs to another organization. Shown when updating credentials. Connect that organization, or that key, as a new connection.