# OpenAI

> OpenAI API spend, including Codex, by project and line item.

With an OpenAI Admin key, each report adds OpenAI API spend for the last 30 days, from OpenAI's [Costs API](https://platform.openai.com/docs/api-reference/usage/costs).

## Connect

**Settings → OpenAI**, paste a key starting `sk-admin`. Organisation owners create Admin keys in the OpenAI platform under **Organization → Admin keys**; they are a different credential from a project API key. opsen checks the key with one request, stores it with envelope encryption bound to this installation, and uses it read-only once per audit.

## What it shows

| Figure | Source |
| --- | --- |
| Spend | Sum of `amount.value` across daily buckets, last 30 days |
| By project | Grouped by `project_id`, named from `/organization/projects` |
| By line item | Grouped by `line_item`, for example a model's input or output tokens |

Codex used with an API key appears here under the project its key belongs to. Codex used through a ChatGPT plan is billed by ChatGPT and is not returned by the API.
