Copy as Markdown[Open in ChatGPT](https://chatgpt.com/?q=Read%20https%3A%2F%2Fcoralogix.com%2Fdocs%2Fintegrations%2Fai-observability%2Fopenai%2Fapi-platform.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)[Open in Claude](https://claude.ai/new?q=Read%20https%3A%2F%2Fcoralogix.com%2Fdocs%2Fintegrations%2Fai-observability%2Fopenai%2Fapi-platform.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)

# OpenAI API Platform integration with Coralogix

OpenAI plan requirements

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

## Overview[​](#overview "Direct link to 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[​](#collection-schedule "Direct link to Collection schedule")

| Data                                      | Schedule                                                         | Initial coverage           |
| ----------------------------------------- | ---------------------------------------------------------------- | -------------------------- |
| Completions usage                         | Every minute                                                     | From installation time     |
| Other usage families and cost             | Daily after 01:00 UTC                                            | From installation time     |
| Directory, governance, and RBAC snapshots | Daily after 01:00 UTC                                            | Current snapshot           |
| Audit events                              | One closed UTC day per collection, 2 days behind the current day | 2 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[​](#what-you-need "Direct link to 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[​](#create-an-openai-admin-api-key "Direct link to Create an OpenAI Admin API key")

1. In the [OpenAI Platform console](https://platform.openai.com/settings/organization/admin-keys), 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[​](#set-up-the-integration "Direct link to 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:

   | Field                | Description                                                                                                                                                                         |
   | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
   | **Integration name** | Name used to identify this integration instance. The default is `OpenAI Usage & Cost`.                                                                                              |
   | **Application name** | Coralogix application assigned to collected data. The default is `openai-integration`.                                                                                              |
   | **Subsystem name**   | Optional. 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 key**    | The 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[​](#collected-data "Direct link to Collected data")

### Metrics[​](#metrics "Direct link to 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.

Show usage metrics

| Metric                                                            | Description                                                                        |
| ----------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
| `openai_administration_usage_input_tokens`                        | Input tokens for completions, per model, project, API key, user, and service tier. |
| `openai_administration_usage_input_uncached_tokens`               | Uncached input tokens for completions.                                             |
| `openai_administration_usage_input_cached_tokens`                 | Cached input tokens for completions.                                               |
| `openai_administration_usage_input_cache_write_tokens`            | Cache-write input tokens for completions.                                          |
| `openai_administration_usage_input_text_tokens`                   | Text input tokens for completions.                                                 |
| `openai_administration_usage_input_audio_tokens`                  | Audio input tokens for completions.                                                |
| `openai_administration_usage_input_image_tokens`                  | Image input tokens for completions.                                                |
| `openai_administration_usage_input_cached_text_tokens`            | Cached text input tokens for completions.                                          |
| `openai_administration_usage_input_cached_audio_tokens`           | Cached audio input tokens for completions.                                         |
| `openai_administration_usage_input_cached_image_tokens`           | Cached image input tokens for completions.                                         |
| `openai_administration_usage_output_tokens`                       | Output tokens for completions.                                                     |
| `openai_administration_usage_output_text_tokens`                  | Text output tokens for completions.                                                |
| `openai_administration_usage_output_audio_tokens`                 | Audio output tokens for completions.                                               |
| `openai_administration_usage_output_image_tokens`                 | Image output tokens for completions.                                               |
| `openai_administration_usage_requests`                            | Completions model requests.                                                        |
| `openai_administration_usage_embeddings_tokens`                   | Embeddings input tokens.                                                           |
| `openai_administration_usage_embeddings_model_requests`           | Embeddings model requests.                                                         |
| `openai_administration_usage_images`                              | Images generated, per size and source.                                             |
| `openai_administration_usage_images_model_requests`               | Image model requests.                                                              |
| `openai_administration_usage_audio_speeches_characters`           | Text-to-speech characters.                                                         |
| `openai_administration_usage_audio_speeches_model_requests`       | Text-to-speech model requests.                                                     |
| `openai_administration_usage_audio_transcriptions_seconds`        | Transcribed audio seconds.                                                         |
| `openai_administration_usage_audio_transcriptions_model_requests` | Transcription model requests.                                                      |
| `openai_administration_usage_moderations_tokens`                  | Moderation input tokens.                                                           |
| `openai_administration_usage_moderations_model_requests`          | Moderation model requests.                                                         |
| `openai_administration_usage_vector_stores_bytes`                 | Vector-store storage bytes, per project.                                           |
| `openai_administration_usage_code_interpreter_sessions`           | Code-interpreter sessions, per project.                                            |
| `openai_administration_usage_web_search_requests`                 | Web-search requests, per context level.                                            |
| `openai_administration_usage_web_search_model_requests`           | Web-search model requests.                                                         |
| `openai_administration_usage_file_search_requests`                | File-search requests, per vector store.                                            |

Show cost and spend metrics

| Metric                                                 | Description                                                                                                |
| ------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------- |
| `openai_administration_cost_usd`                       | Daily cost in USD. Each sample records which grouping produced it: line item, project, API key, or user.   |
| `openai_administration_cost_quantity`                  | Billed quantity behind a cost row, with the unit as a label.                                               |
| `openai_administration_spend_limit_usd`                | Configured organization spend limit in USD. Present only when a limit is configured.                       |
| `openai_administration_spend_limit_enforcing`          | Whether the organization spend limit is enforcing, as `1` or `0`. Present only when a limit is configured. |
| `openai_administration_spend_limit_configured`         | Whether an organization spend limit exists, as `1` or `0`. Always emitted.                                 |
| `openai_administration_project_spend_limit_usd`        | Configured project spend limit in USD.                                                                     |
| `openai_administration_project_spend_limit_enforcing`  | Whether a project spend limit is enforcing.                                                                |
| `openai_administration_project_spend_limit_configured` | Whether a project spend limit exists, as `1` or `0`. Always emitted per project.                           |
| `openai_administration_spend_alert_threshold_usd`      | Configured spend-alert threshold in USD, for organization and project alerts.                              |
| `openai_administration_spend_alerts`                   | Configured spend alerts, with a value of `1`.                                                              |

Show directory metrics

| Metric                                               | Description                                                     |
| ---------------------------------------------------- | --------------------------------------------------------------- |
| `openai_administration_org_user_info`                | Organization users with identity and role, with a value of `1`. |
| `openai_administration_project_info`                 | Projects with name and status, with a value of `1`.             |
| `openai_administration_project_member_info`          | Project members with identity and role, with a value of `1`.    |
| `openai_administration_project_api_key_info`         | Project API keys with owner identity, with a value of `1`.      |
| `openai_administration_project_service_account_info` | Project service accounts, with a value of `1`.                  |
| `openai_administration_org_invite_info`              | Pending and historical invites, with a value of `1`.            |
| `openai_administration_admin_key_info`               | Organization-level API keys, with a value of `1`.               |

Show governance metrics

| Metric                                                        | Description                                                                                                         |
| ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- |
| `openai_administration_data_retention_enabled`                | Whether a data-retention policy is active, as `1` or `0`. Always emitted.                                           |
| `openai_administration_data_retention_type`                   | The configured retention type. Present only when retention is configured.                                           |
| `openai_administration_data_retention_info`                   | Retention configuration details, with a value of `1`.                                                               |
| `openai_administration_org_mtls_enabled`                      | Whether organization mTLS is enabled, as `1` or `0`. Always emitted.                                                |
| `openai_administration_certificate_info`                      | Uploaded mTLS certificates, with a value of `1`.                                                                    |
| `openai_administration_rate_limit_requests_per_minute`        | Per-project, per-model request-per-minute limit.                                                                    |
| `openai_administration_rate_limit_tokens_per_minute`          | Per-project, per-model token-per-minute limit.                                                                      |
| `openai_administration_rate_limit_images_per_minute`          | Per-project, per-model image-per-minute limit, where the model reports it.                                          |
| `openai_administration_rate_limit_batch_input_tokens_per_day` | Per-project, per-model batch token-per-day limit, where the model reports it.                                       |
| `openai_administration_rate_limit_audio_megabytes_per_minute` | Per-project, per-model audio limit, where the model reports it.                                                     |
| `openai_administration_rate_limit_requests_per_day`           | Per-project, per-model request-per-day limit, where the model reports it.                                           |
| `openai_administration_rate_limit_configured`                 | Whether a project's rate-limit rows exist, as `1` per row, or an explicit `0` for a project whose listing is empty. |
| `openai_administration_model_permissions_configured`          | Whether a project restricts model access, as `1` or `0`. A `0` means every model is callable in that project.       |
| `openai_administration_hosted_tool_enabled`                   | Hosted-tool permission state per project and tool, as `1` or `0`.                                                   |

Show RBAC metrics

| Metric                                         | Description                                                               |
| ---------------------------------------------- | ------------------------------------------------------------------------- |
| `openai_administration_group_role_info`        | Role assignments of organization and project groups, with a value of `1`. |
| `openai_administration_org_role_info`          | Organization role definitions, with a value of `1`.                       |
| `openai_administration_user_role_info`         | Organization-level user role assignments, with a value of `1`.            |
| `openai_administration_project_group_info`     | Groups attached to projects, with a value of `1`.                         |
| `openai_administration_project_role_info`      | Project role definitions, with a value of `1`.                            |
| `openai_administration_project_user_role_info` | Per-project user role assignments, with a value of `1`.                   |

Show audit metrics

| Metric                                    | Description                                                                                                                               |
| ----------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| `openai_administration_audit_events_type` | Counter of audit events by event type, with the event day in a `date` label. Query it as `openai_administration_audit_events_type_total`. |

### Metric labels and timestamps[​](#metric-labels-and-timestamps "Direct link to Metric labels and timestamps")

| Data                | Common labels                                                                                                                                                                                                                                                                                                      |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Administration data | `organization` 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 RBAC | `project_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[​](#limits-and-behavior "Direct link to 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[​](#validate-the-integration "Direct link to 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[​](#troubleshoot-missing-data "Direct link to 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.

## Related resources[​](#related-resources "Direct link to Related resources")

* [OpenAI Administration API reference](https://platform.openai.com/docs/api-reference/administration)
* [OpenAI Admin keys](https://platform.openai.com/settings/organization/admin-keys)
