> ## Documentation Index
> Fetch the complete documentation index at: https://docs.glow.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Codex

> Connect OpenAI to gain visibility into Codex usage, projects, and admin activity

Glow's Codex integration collects organization-wide usage, analytics, and audit data from the OpenAI platform — including activity generated by Codex CLI. It is a single connection authenticated with **one OpenAI organization admin key** that authorizes every `/organization` endpoint.

| Data           | What it collects                                                                                |
| -------------- | ----------------------------------------------------------------------------------------------- |
| **Users**      | Organization members with name, email, role, and date added                                     |
| **Projects**   | Organization projects with name, status, and created/archived timestamps                        |
| **Usage**      | Per-day, per-project, per-user, per-model usage across all OpenAI usage families (see below)    |
| **Audit logs** | Organization activity trail with event type, actor, IP address, user agent, and project context |

The usage data spans every family the Admin API exposes:

* **Completions** — token usage and model requests (Codex CLI activity lands here)
* **Embeddings** — input tokens and model requests
* **Moderations** — input tokens and model requests
* **Images** — image counts and model requests, by source and size
* **Audio speeches** (text-to-speech) — characters and model requests
* **Audio transcriptions** (speech-to-text) — seconds and model requests
* **Vector stores** — storage bytes per project
* **Code interpreter** — session counts per project

## Prerequisites

<Check>An OpenAI organization with **owner** access to the [OpenAI platform](https://platform.openai.com)</Check>
<Check>An organization admin key (only org owners can create one)</Check>

## Setup Instructions

### Create the Admin Key

<Steps>
  <Step title="Open the OpenAI platform as an org owner">
    Log in to the [OpenAI platform](https://platform.openai.com) as an organization **owner**. Only owners can mint admin keys.
  </Step>

  <Step title="Open the Admin keys settings">
    Navigate to [**Settings → Organization → Admin keys**](https://platform.openai.com/settings/organization/admin-keys).
  </Step>

  <Step title="Create the admin key">
    Create a new admin key (the value begins with `sk-admin-`) and give it a descriptive name (e.g., "Glow Integration"). The single key authorizes every `/organization` endpoint Glow reads — users, projects, all usage families, and audit logs.
  </Step>

  <Step title="Copy the key">
    Copy and securely store the key value. It is displayed only once.
  </Step>
</Steps>

### Complete the Integration

<Steps>
  <Step title="Provide the credential">
    Provide the admin key to your Glow representative or enter it in the Glow console.
  </Step>

  <Step title="Connect in the Glow console">
    In the Glow console, open **Integrations → Codex** and enter the admin key in the connection drawer.
  </Step>
</Steps>

## Troubleshooting

<AccordionGroup>
  <Accordion title="The connection fails with an HTTP 401 / unauthorized error">
    The admin key is invalid, has been revoked, or is not an admin key. Confirm the key value begins with `sk-admin-` and was created under **Settings → Organization → Admin keys**. A standard project API key (`sk-...`) cannot read the `/organization` endpoints — re-mint an admin key if needed.
  </Accordion>

  <Accordion title="Why is recent usage data missing?">
    Glow fetches usage over a rolling lookback window and re-fetches it each run to recover any late-arriving records. The most recent day may not be fully populated until OpenAI finishes aggregating it.
  </Accordion>

  <Accordion title="The sync is slow or appears throttled">
    The OpenAI Admin API is rate limited. Glow automatically backs off and retries (honoring the `Retry-After` header) when it hits the limit, so large organizations may take longer to sync on the first run.
  </Accordion>
</AccordionGroup>
