Skip to main content

OpenAI API Platform integration with Coralogix

OpenAI plan requirements

This integration requires an OpenAI API-Platform organization and an Admin API key.

Overview

Track OpenAI spend and adoption, attribute cost and usage to projects, API keys, and users, and retain a governance and audit trail of your organization. The OpenAI Usage & Cost integration polls the OpenAI Administration APIs and collects the results as metrics in Coralogix.

The integration collects:

  • API usage for every OpenAI service your organization uses: completions, embeddings, images, audio, moderations, vector stores, code interpreter, web search, and file search.
  • Daily cost, broken down by line item, project, API key, and user.
  • The organization directory: users, projects, project members, API keys, service accounts, and invites.
  • Governance state: spend limits and alerts, data retention, mTLS certificates, per-project rate limits, model permissions, hosted-tool permissions, and the full role-based access control (RBAC) inventory of roles and groups.
  • The organization audit feed.

One Admin API key covers the whole organization. Install the integration once per OpenAI organization.

Collection schedule

DataScheduleInitial coverage
Completions usageEvery minuteFrom installation time
Other usage families and costDaily after 01:00 UTCFrom installation time
Directory, governance, and RBAC snapshotsDaily after 01:00 UTCCurrent snapshot
Audit eventsOne closed UTC day per collection, 2 days behind the current day2 days before installation

Coralogix distributes the daily collections across a 30-minute window. Audit collection stays 2 days behind the current day by design: Coralogix collects each UTC day once, after the following UTC day has also ended, to give OpenAI time to add late events.

What you need

  • An OpenAI API-Platform organization and permission to manage its Admin keys.
  • The Coralogix INTEGRATIONS:READCONFIG permission to view integrations and INTEGRATIONS:DEPLOY permission to create or update them. The Data Admin and Platform Admin roles include deployment permission.

Create an OpenAI Admin API key

  1. In the OpenAI Platform console, open your organization settings and select Admin keys.
  2. Select Create admin key, name it, and grant Read access to the API categories. The integration only reads; write access is never required. Leave Compliance logging platform unassigned; the integration does not use it.
  3. Copy the key (sk-admin-...) and store it securely. OpenAI shows it only once.
  4. If the key has an expiry, note the date and rotate the key in the integration before it lapses.

Set up the integration

  1. In Coralogix, select Data Flow, then Integrations.

  2. Search for and select OpenAI Usage & Cost.

  3. Select Connect, then Add New.

  4. Configure the integration:

    FieldDescription
    Integration nameName used to identify this integration instance. The default is OpenAI Usage & Cost.
    Application nameCoralogix application assigned to collected data. The default is openai-integration.
    Subsystem nameOptional. When set, all data ingests under this single subsystem. Leave it empty to route each source to its own subsystem: usage, cost, directory, governance, or audit.
    Admin API keyThe Admin API key for the organization.
  5. Select Create. Coralogix validates the Admin key against the Administration APIs before saving, and reports the failure if OpenAI rejects it.

Collected data

Metrics

All metrics appear in Metrics Explorer under the openai_administration_ prefix. All series are gauges except openai_administration_audit_events_type, a counter that the metrics pipeline exposes with a _total suffix. Monetary values are USD. The integration skips absent source fields rather than reporting them as 0, so a gap is distinguishable from a real zero; governance metrics that describe an on/off state are always emitted, so 0 there means verified-off rather than not-collected.

Metric labels and timestamps

DataCommon labels
Administration dataorganization on every series. Usage adds model, project_id, api_key_id, user_id, and service_tier where the source reports them. Cost adds the grouping dimensions plus resolved project_name and user_email. Usage, cost, and audit series also carry date with the UTC day of the source data.
Governance and RBACproject_id on project-scoped series, plus the dimensions of the object, such as model, role, or group_id.

Usage samples carry the start of their source bucket as the timestamp, and polling an open bucket again overwrites the previous value rather than accumulating. Daily samples use the start of the reported UTC day and snapshots use the collection time. When a sample is too old for normal ingestion, such as audit events behind their 2-day settle, Coralogix moves the sample timestamp forward and the date label keeps the original day.

Limits and behavior

  • The integration does not backfill history. Usage and cost start at installation time, and the audit feed starts 2 days before installation.
  • A missing source field or an empty collection does not produce a zero-valued series. Governance on/off states are the exception: they are always emitted, so 0 means verified-off.
  • Audit collection is silent when a day has no events, which is normal for most organizations. Events for a given UTC day appear shortly after 00:00 UTC 2 days later, once the following UTC day has also ended.
  • Archived projects that reject directory or governance listings are skipped, and the skip is visible as an explicit 0 on the project's info metric. Projects that deny per-project certificate access are skipped the same way.
  • The integration paces itself to 60 requests per minute per Admin API key and honors OpenAI rate-limit responses by rescheduling to the advertised reset time.

Validate the integration

In Metrics Explorer, query a baseline Administration metric such as:

openai_administration_usage_requests

The first completions usage samples typically appear within a few minutes, and the daily directory and governance snapshots within a day.

Troubleshoot missing data

  • If a usage family metric is absent, such as images or moderations, your organization has no activity on that service. The family appears with its first request.
  • If a governance value metric is absent, check its always-emitted companion: spend_limit_configured, data_retention_enabled, or org_mtls_enabled at 0 means the feature is not configured in OpenAI, so there is no value to report.
  • If the audit counter is missing, wait 2 days after the first organization activity; the audit feed intentionally trails by the settle window.
  • If the integration reports Failing, the status message names the failing dataset and the OpenAI error, including the request ID you can quote to OpenAI support.
Last updated on