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

# OpenAI Platform setup

ConfigView pulls your OpenAI **API organization** — spend, token usage, projects, members, and API keys — through an **Admin API key** created in the OpenAI platform console.

You will end up with **1 secret** in ConfigView (`OPENAI_ADMIN_KEY`) when setup is complete.

> **This is not the same as ChatGPT.** OpenAI splits into two products with two separate consoles, two key types and two ConfigView apps. This page covers **platform.openai.com** — the developer API you are billed for per token. If you want to inventory **ChatGPT Enterprise** seats and workspace activity, that is the [OpenAI ChatGPT](/openai-chatgpt) integration and a different credential entirely. Most organizations that use both will want both apps enabled.

***

## Step 1: Create the Admin API key

1. Sign in to the [OpenAI platform console](https://platform.openai.com/) as an organization **Owner**
2. Go to **Settings** → **Organization** → **Admin keys**
3. Create a new admin key and name it `ConfigView`
4. Copy the key when it is shown. You will not be able to see it again.

> **An admin key is not a project API key.** The usual `sk-proj-...` key you use to call models will authenticate and then return `401` or empty results on every organization endpoint. If ConfigView reports "authenticated but no data", the wrong key type is the first thing to check.

***

## Step 2: Add the secret to ConfigView

1. Go to your ConfigView dashboard: `https://{companyname}.configview.com/admin/secret/`
2. Click **Add Secret**
3. **Secret name:** `OPENAI_ADMIN_KEY`
4. **Secret value:** Paste the admin key from Step 1
5. Click **Save**

***

## Step 3: Enable the OpenAI Platform scripts in ConfigView

1. Go to: `https://{companyname}.configview.com/admin/cron/`
2. You should see **OpenAI Platform** in the list of available apps
3. Select the scripts you want to run:

**Spend and usage**

| Script                         | Notes                                                                                                                |
| ------------------------------ | -------------------------------------------------------------------------------------------------------------------- |
| **Cost Breakdown**             | Spend by line item and project. This is the one that answers "what are we paying for".                               |
| **Completions Usage**          | Token usage for chat/completions, split by model, project, user and API key. Includes cached and audio token counts. |
| **Embeddings Usage**           | Token usage for embeddings.                                                                                          |
| **Images Usage**               | Image generations by model, size and source.                                                                         |
| **Audio Speeches Usage**       | Characters synthesised.                                                                                              |
| **Audio Transcriptions Usage** | Seconds transcribed.                                                                                                 |
| **Moderations Usage**          | Moderation calls.                                                                                                    |
| **Vector Stores Usage**        | Bytes stored per project.                                                                                            |
| **Code Interpreter Usage**     | Code interpreter sessions per project.                                                                               |

**Access and governance**

| Script                       | Notes                                                                           |
| ---------------------------- | ------------------------------------------------------------------------------- |
| **Organization Users**       | Everyone in the org, with their org-level role.                                 |
| **Pending Invites**          | Invitations not yet accepted, with expiry.                                      |
| **Projects**                 | Every project, including archived ones. Start here; three scripts depend on it. |
| **Project Membership**       | Who is in which project, and with what role. **Depends on Projects.**           |
| **Project Service Accounts** | Non-human members of each project. **Depends on Projects.**                     |
| **Admin API Keys**           | Organization-level admin keys, with owner and last-used date.                   |
| **Project API Keys**         | Per-project keys, with owner and last-used date. **Depends on Projects.**       |
| **Audit Logs**               | Org audit events — who changed what, from where.                                |

4. Click **Save**

> **Note:** Project Membership, Project Service Accounts and Project API Keys all depend on Projects. ConfigView wires these dependencies automatically — Projects always runs first.

***

## Step 4: Verify

1. Go to: `https://{companyname}.configview.com/admin/cron/`
2. Run the **OpenAI Platform** health check

If a check fails:

* **`401`** — The key is wrong, revoked, or is a project key rather than an admin key. See the note in Step 1.
* **Usage tables are empty but cost is populated** — Usage endpoints are time-bucketed. A freshly created org, or one with no API traffic in the window queried, legitimately returns nothing.
* **Audit Logs returns `403`** — Audit logging is not available on every OpenAI plan. If your org does not have it, leave that script disabled.

***

## Data Tables

Once the scripts run, the corresponding tables are created in your database. All tables include a `run_at` column for historical tracking.

| Table                               | Source (`/v1/organization/...`)   | Key Columns                                                                                                                          |
| ----------------------------------- | --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| `openai_cost`                       | `costs`                           | starting\_at, ending\_at, line\_item, project\_id, amount, currency                                                                  |
| `openai_usage_completions`          | `usage/completions`               | starting\_at, project\_id, user\_id, api\_key\_id, model, input\_tokens, output\_tokens, input\_cached\_tokens, input\_audio\_tokens |
| `openai_usage_embeddings`           | `usage/embeddings`                | starting\_at, project\_id, model, input\_tokens, num\_model\_requests                                                                |
| `openai_usage_images`               | `usage/images`                    | starting\_at, project\_id, model, size, source, images                                                                               |
| `openai_usage_audio_speeches`       | `usage/audio_speeches`            | starting\_at, project\_id, model, characters                                                                                         |
| `openai_usage_audio_transcriptions` | `usage/audio_transcriptions`      | starting\_at, project\_id, model, seconds                                                                                            |
| `openai_usage_moderations`          | `usage/moderations`               | starting\_at, project\_id, model, input\_tokens                                                                                      |
| `openai_usage_vector_stores`        | `usage/vector_stores`             | starting\_at, project\_id, usage\_bytes                                                                                              |
| `openai_usage_code_interpreter`     | `usage/code_interpreter_sessions` | starting\_at, project\_id, num\_sessions                                                                                             |
| `openai_users`                      | `users`                           | user\_id, email, name, role, added\_at                                                                                               |
| `openai_invites`                    | `invites`                         | invite\_id, email, role, status, invited\_at, expires\_at, accepted\_at                                                              |
| `openai_projects`                   | `projects`                        | project\_id, name, status, created\_at, archived\_at                                                                                 |
| `openai_project_users`              | `projects/{id}/users`             | project\_id, user\_id, email, role, added\_at                                                                                        |
| `openai_project_service_accounts`   | `projects/{id}/service_accounts`  | project\_id, service\_account\_id, name, role, created\_at                                                                           |
| `openai_admin_api_keys`             | `admin_api_keys`                  | api\_key\_id, name, redacted\_value, created\_at, last\_used\_at, owner\_email                                                       |
| `openai_project_api_keys`           | `projects/{id}/api_keys`          | project\_id, api\_key\_id, name, redacted\_value, created\_at, last\_used\_at, owner\_email                                          |
| `openai_audit_logs`                 | `audit_logs`                      | audit\_log\_id, event\_type, effective\_at, actor\_email, actor\_ip, project\_id, details                                            |

***

## Things worth knowing

**Cost and usage are separate questions, and they do not reconcile line for line.** `openai_cost` is what OpenAI bills; the `openai_usage_*` tables are what was consumed. Discounts, minimums, and free tiers live in cost and not in usage, so summing tokens and multiplying by list price will not reproduce your invoice. Use cost for finance and usage for attribution.

**`last_used_at` on API keys is the highest-value column here.** A key that has never been used, or has not been used in months, is the cleanest signal for revocation — and both key tables carry the owner, so you know who to ask before pulling it.

**Usage rows are pre-aggregated buckets, not individual calls.** Each row covers a time window (`starting_at` to `ending_at`) for a given model/project/user combination. You cannot get per-request detail from this API, so questions like "which exact call cost the most" are not answerable here.

**Archived projects still appear.** `openai_projects.status` and `archived_at` tell you which are live. Filtering on them matters for seat and key reporting, or archived projects will inflate your counts.
