OpenAI admin usage and cleanup

How to report OpenAI Platform (developer API) usage by team member, list projects and API keys for cleanup, and use ChatGPT Team monthly exports to identify unused seats.

Prerequisites

  • OpenAI org owner (or equivalent) API key — required for organization-level endpoints. Stored in 1Password as “Open AI Admin Key” and in repo root .env as OPENAI_ADMIN_API_KEY (script loads from root when run from repo root).

1. Platform: usage by user and projects/keys report

Script: scripts/openai-usage-and-keys-report.ts

From repo root, with OPENAI_ADMIN_API_KEY set (e.g. in root .env):

npx tsx scripts/openai-usage-and-keys-report.ts [--days 30]
  • Usage by user: Calls GET /v1/organization/usage/completions with group_by=user_id for the last N days. Outputs user_id, input/output tokens, and request counts. User IDs are opaque; map to names via project members or Platform UI if needed.
  • Projects and API keys: Lists all org projects and, per project, API keys with last_used_at. Highlights keys that are never used or stale.
  • Org admin keys: Lists organization-level admin API keys and their last_used_at (if the endpoint is available for your org; some accounts may get 404).

Use the report to decide which project keys to delete or which projects to archive. Cleanup is manual (or via script flags in the future); see Platform API reference for DELETE /organization/projects/{project_id}/api_keys/{key_id} and POST /organization/projects/{project_id}/archive.

Ad-hoc dashboard: https://platform.openai.com/usage

2. ChatGPT Team: monthly CSV exports and seat cleanup

ChatGPT Team (chatgpt.com workspace) has no public API for per-user usage. Use the product UI and optional CSV analysis script.

Exporting monthly reports

  1. Go to https://chatgpt.com/admin/usage (workspace owners/admins).
  2. Export monthly user reports (e.g. “BrainforgeAI monthly user report YYYY-MM-01.csv”).
  3. Save exports anywhere (e.g. ~/Downloads/ or knowledge/engineering/openai-team-exports/).

Analyzing exports with the script

Script: scripts/openai-team-csv-report.ts

From repo root:

npx tsx scripts/openai-team-csv-report.ts path/to/monthly-report-2026-01-01.csv path/to/2026-02-01.csv path/to/2026-03-01.csv

Example with multiple files (adjust paths for your shell):

npx tsx scripts/openai-team-csv-report.ts ~/Downloads/BrainforgeAI\ monthly\ user\ report\ 2026-01-01.csv ~/Downloads/BrainforgeAI\ monthly\ user\ report\ 2026-02-01.csv ~/Downloads/BrainforgeAI\ monthly\ user\ report\ 2026-03-01.csv

Output:

  • Zero usage (enabled) — users with user_status=enabled and 0 messages across all supplied files. Prime candidates to remove from the seat count.
  • Low usage — enabled users with ≤30 total messages across files; review whether they still need a seat.
  • Deleted users — list for confirming they are no longer billed as seats.

Reducing seats

  • Add or remove seats in ChatGPT Business billing/settings: Add or remove seats.
  • After removing zero-usage or departed users from the workspace, reduce the seat count in billing to match.

3. Summary

GoalToolNotes
Platform usage by userscripts/openai-usage-and-keys-report.tsNeeds OPENAI_ADMIN_API_KEY in root .env
Platform projects/keysSame scriptReview last_used_at; delete/archive manually
ChatGPT Team seat usagechatgpt.com/admin/usage + CSV exportNo API
ChatGPT Team zero/low usage listscripts/openai-team-csv-report.tsPass one or more monthly CSV paths
Reduce ChatGPT Team seatsChatGPT Business billingAfter removing users from workspace