Use the OpenAI AI Consumption integration to collect OpenAI API Platform usage and cost data and load it into AI Usage Data in Yarken.
Yarken deploys and maintains the Advanced Integration for your environment. Your organization creates the required OpenAI Admin API key, authorizes the Advanced Connection, and monitors the resulting data.
Current scope
This integration currently supports usage and cost data from your OpenAI API Platform organization.
ChatGPT Workspace usage is available through a separate Advanced Integration. This OpenAI API Platform connection collects API Platform usage and costs only. It does not collect ChatGPT Business or Enterprise workspace activity or seat subscription fees. For daily ChatGPT and Codex workspace usage, see ChatGPT Workspace AI cost and usage integration.
What the integration provides
The integration retrieves supported OpenAI API Platform usage and cost data for reporting and analysis in Yarken.
-
OpenAI usage cost.
-
Input token usage.
-
Output token usage.
-
Cached token usage, where OpenAI provides it.
-
Project or sub-account information, where available.
-
User or service-account attribution, where available.
-
Daily usage information.
Where the data appears
After ingestion:
-
Review the imported OpenAI usage data in Designer > Consumption > AI.
-
Use Analytics > AI Consumption for reporting and analysis.
Roles and responsibilities
|
Activity |
Responsibility |
|---|---|
|
Deploy and maintain the Advanced Integration |
Yarken |
|
Maintain connector logic and data transformation |
Yarken |
|
Create and maintain the OpenAI Admin API key |
OpenAI API Platform Organization Owner |
|
Authorize the OpenAI connection in Yarken |
Yarken administrator |
|
Run and monitor the Advanced pipeline |
Admin or Cost Model Manager |
|
Review imported AI Consumption data |
FinOps and reporting users |
Before you begin
|
Requirement |
Details |
|---|---|
|
OpenAI API Platform organization |
Identify the API Platform organization whose usage and spend you want to report. |
|
Organization Owner access |
Only an API Platform Organization Owner can create the Admin API key required by this integration. |
|
Admin API key |
Create the key in the same API Platform organization whose usage and cost data you want to retrieve. The key must begin with |
|
Permissions |
Use Read only permissions. If your organization requires narrower access, use Restricted with read access to the Usage API and Organization Administration. |
|
Yarken access |
You need a Yarken administrator account to authorize the OpenAI Advanced Connection. |
|
Secure secret storage |
Store the Admin API key in an organization-approved secrets manager. |
Do not use a project API key beginning with sk-proj- or a ChatGPT workspace Admin key. These credentials do not provide access to the API Platform organization usage and cost endpoints.
Create the OpenAI Admin API key
Complete these steps as an OpenAI API Platform Organization Owner:
-
Sign in to
platform.openai.com. -
Go to Organization settings > Admin keys.
-
Select + Create new admin key.
-
Enter a descriptive name for the key.
-
Set Permissions to Read only.
-
If your organization requires restricted access, set the required Usage API and Organization Administration permissions to read access.
-
Select Create admin key.
-
Copy the secret immediately and store it securely.
The Admin API key is displayed only once and begins with sk-admin-.
Every time you create an Admin API key, OpenAI creates a separate credential. Revoke unsuccessful, duplicate, or obsolete keys so you can clearly identify the active key.
Optional: Verify the Admin API key
You can verify the credential before configuring Yarken.
curl -i "https://api.openai.com/v1/organization/usage/completions?start_time=<UNIX_SECONDS>&bucket_width=1d&limit=1" \
-H "Authorization: Bearer <YOUR_ADMIN_KEY>" \
-H "Content-Type: application/json"
An HTTP 200 response confirms that the Admin API key can access the organization usage endpoint. The key uses an Authorization: Bearer header.
Authorize the OpenAI connection
-
Sign in to Yarken as an administrator.
-
Go to Admin > Pipelines > Connections.
-
Select the ADVANCED tab.
-
Open the OpenAI connection.
-
Complete the required connection fields.
OpenAI Advanced Connection -
Select Connect.
-
Confirm that the connection status changes to Connected.
|
Field |
Requirement |
Value or guidance |
|---|---|---|
|
Base URI |
Required |
Default: |
|
Admin API key |
Required |
Enter the API Platform organization Admin API key. It must begin with |
|
Billing account ID override |
Optional |
Leave blank to use the |
|
Billing account name override |
Optional |
Leave blank to use the |
|
Usage pool / plan type |
Optional |
Enter your usage pool or plan type when required for reporting, for example |
|
Collector source |
Configured |
The connection displays OpenAI Admin API. The configured value is written to |
For the general authorization workflow, see Authorize Advanced Connections.
How the integration works
The OpenAI Advanced Integration uses the API Platform organization Admin API key to retrieve supported OpenAI usage and cost data. You do not configure the underlying API requests or transformation logic.
-
OpenAI API Platform provides organization usage and cost information.
-
The OpenAI Advanced Connection authorizes Yarken using the Admin API key.
-
The Yarken-managed Advanced Integration retrieves and processes the supported records.
-
The Advanced pipeline runs the integration and records execution activity.
-
AI Usage Data stores the normalized usage and cost records.
-
Analytics > AI Consumption provides reporting and analysis.
Data collected
|
Data |
Behavior |
|---|---|
|
Cost |
OpenAI usage cost where returned by the source. |
|
Input tokens |
Input token consumption for supported API usage. |
|
Output tokens |
Output token consumption for supported API usage. |
|
Cached tokens |
Cached token usage where OpenAI provides it. |
|
Provider |
OpenAI. |
|
Project or sub-account |
Project or sub-account information where available. |
|
User or service account |
Attribution where OpenAI provides enough source information. |
|
Usage period |
Source usage can be reported at daily granularity. |
Billing account overrides
Normally, Yarken uses the organization details returned by the OpenAI costs API.
Use Billing account ID override or Billing account name override only when you intentionally want a different reporting value. Leave the fields blank to use the organization ID and organization name returned by OpenAI.
Usage pool / plan type
OpenAI does not provide the usage pool or plan type through the API used by this connection.
If required for reporting, enter the value manually in Usage pool / plan type, for example Pay-as-you-go or Prepaid.
Important data interpretation guidance
API Platform and ChatGPT Workspace use separate connections
OpenAI API Platform usage and ChatGPT Workspace Analytics are separate data sources. Each requires its own Advanced Connection and Admin key, even though both key types begin with sk-admin-.
The Admin API key configured on this page retrieves API Platform organization usage and cost data; it does not retrieve ChatGPT workspace activity. To collect daily ChatGPT, Codex, and Agents usage from a ChatGPT Business or Enterprise workspace, see ChatGPT Workspace AI cost and usage integration.
Service-account attribution
Some OpenAI usage can be generated by non-human service accounts. In those cases, usage and cost may not map cleanly to a named user.
Review the available project, sub-account, and service-account information when performing user-level allocation or chargeback.
Run and monitor the Advanced pipeline
After the OpenAI connection shows Connected:
-
Go to Admin > Pipelines > Pipelines.
-
Select the ADVANCED tab.
-
Locate the OpenAI pipeline.
-
Select Run when you need an immediate execution, or keep recurring execution active as configured for your environment.
-
Open the pipeline to review the latest status and run history.
See Manage Advanced pipelines for the common pipeline controls.
Validate the integration
After the first successful run:
-
Confirm the OpenAI connection shows Connected.
-
Confirm the Admin API key begins with
sk-admin-. -
Confirm the key belongs to the API Platform organization whose spend you expect to report.
-
Confirm the Advanced pipeline completed successfully.
-
Review the imported data in Designer > Consumption > AI.
-
Confirm expected OpenAI costs and token usage appear in Analytics > AI Consumption.
-
Review project, sub-account, user, and service-account attribution where expected.
-
Confirm billing account overrides are populated only when you intentionally configured them.
Current limitations
ChatGPT Workspace usage and seat licences
This OpenAI API Platform connection collects API Platform usage and cost data. ChatGPT Workspace usage is supported through the separate ChatGPT Workspace Advanced Integration, which retrieves workspace credits, tokens, and usage-based costs and loads the records into AI Usage Data. It does not ingest ChatGPT seat subscription charges.
Yarken separately supports automated OpenAI seat and licence-assignment collection through the ChatGPT Enterprise Seats Advanced pipeline. The pipeline uses the provider's Advanced Integration connection, but runs separately from API Platform usage and cost collection. It loads seat records into AI License Register for reporting in Analytics > License Usage.
-
OpenAI API Platform usage and cost: Collected by the usage pipeline described on this page and reported through AI Consumption.
-
ChatGPT Enterprise seats: Collected through the separate ChatGPT Enterprise Seats pipeline and reported through License Usage.
-
ChatGPT workspace usage activity: Collected by the separate ChatGPT Workspace Advanced Integration and reported through AI Consumption. See ChatGPT Workspace AI cost and usage integration.
Note: Do not replace a working OpenAI API Platform Admin API key with a ChatGPT Workspace Admin key. The two integrations require separate credentials and Advanced Connections. Seat collection remains a separate pipeline; confirm its required permissions before modifying the existing seat collector.
For seat-pipeline management steps, see AI License Register.
Troubleshooting
|
Issue |
Likely cause |
What to do |
|---|---|---|
|
Connection remains Access requested |
The connection has not been authorized successfully. |
Verify the required fields and select Connect. |
|
Admin API key is rejected |
The credential is not an API Platform organization Admin API key. |
Confirm the key was created in Organization settings > Admin keys and begins with |
|
|
Project key, ChatGPT workspace Admin key, incomplete secret, or revoked key. |
Confirm the key type and prefix. Re-copy the full secret or create a replacement if the key was revoked. |
|
|
A Restricted Admin API key does not have the required Usage API permission. |
Create or replace the key with Read only permissions, or grant the required read scopes. |
|
Usage or cost data is missing |
The key belongs to a different API Platform organization. |
Confirm the key was created in the organization whose usage and spend you want to retrieve. |
|
ChatGPT Workspace usage is missing |
The OpenAI API Platform connection does not collect ChatGPT workspace activity. A separate ChatGPT Workspace Advanced Connection and pipeline are required. |
Keep the API Platform Admin key for this integration. Configure and run the separate ChatGPT Workspace AI cost and usage integration, then validate records in Designer > Consumption > AI. |
|
Cost cannot be attributed to a named user |
Usage was generated by a service account or another non-human identity. |
Review the available project, sub-account, and service-account information before allocating the cost. |
Security and credential management
-
Store the Admin API key in an approved secrets manager.
-
Do not expose the full key in screenshots, documentation, email, chat, support tickets, or source code.
-
Revoke unsuccessful, duplicate, or obsolete Admin API keys.
-
Rotate the key according to your organization's security policy.
-
After replacing the key, update the OpenAI Advanced Connection and confirm that it returns to Connected.
-
Run the OpenAI Advanced pipeline after credential rotation to validate the integration.
Related content