> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://help.sigmacomputing.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://help.sigmacomputing.com/_mcp/server.

# OpenAI spend template

> Monitor your organization's OpenAI API spend with an executive cost overview showing total spend, trend, and the line items, projects, and people driving it.

You can use the OpenAI spend template to monitor your organization's OpenAI API spend. If your OpenAI usage and cost data is stored in a data platform connected to Sigma, you can use the OpenAI spend template to review an executive cost overview — total spend, trend, and the line items, projects, and people driving it.

The template is set up with sample data, so you can explore the analysis before you connect your own data.

## System and user requirements

The ability to use the OpenAI spend template requires the following:

* You must be assigned an account type with the **Create, edit, and publish workbooks** permission enabled.
* To use your own data, your organization must be connected to a data platform containing your OpenAI usage and cost tables (see [Data sources](#data-sources)). Otherwise, you can use the template with the provided sample data.
* To use the department views, you must supply a users table that maps each user to a department.

## Data sources

The template expects your organization's OpenAI usage and cost data. The template uses sample tables in the Sigma Sample Connection, but you can change the source to your organization's own data if it exists in your data platform.

Download the relevant data from the <a href="https://developers.openai.com/api/reference/overview" target="_blank">OpenAI API</a>, then load it into your data platform:

* Retrieve the usage data from the <a href="https://developers.openai.com/api/reference/resources/admin/subresources/organization/subresources/usage/methods/costs" target="_blank">Costs endpoint</a>.
* Retrieve the user data from the <a href="https://developers.openai.com/api/reference/resources/admin/subresources/organization/subresources/users/methods/list" target="_blank">List users endpoint</a>.

The OpenAI usage and cost data doesn't <a href="https://developers.openai.com/api/reference/resources/admin/subresources/organization/subresources/usage/methods/costs" target="_blank">distinguish spend by product</a>, such as ChatGPT versus Codex.

The OpenAI spend template expects the data in the following structure:

| Table                | Details                                                                                                                                                                                                  |
| -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `OPENAI_USAGE_COSTS` | One cost line per project, user, line item, and time bucket — spend (`AMOUNT_USD`), metered quantity, line item, project, user email, and date. Used for every spend KPI, the trend, and the breakdowns. |
| `OPENAI_ORG_USERS`   | Your OpenAI organization roster (user name, email, and role), joined to the cost data on email to add names and roles to per-user spend.                                                                 |
| Your users table     | Maps each user to a department. Replaces the sample users table to power the spend-by-department view.<sup>1</sup>                                                                                       |

<p class="footnote">
  1

  OpenAI identifies users but does not provide department or org-structure data. The cost and roster tables give you spend by user email, name, and role — but no department or team. To power the <strong>By department</strong> breakdown and department attribution, replace the sample users table in the template with a users table of your own. You can change the source to your table, or load your users into an <a href="/docs/intro-to-input-tables">input table</a> with the same shape, keeping the column names identical so the join and elements continue to work.
</p>

## Create a workbook from the template

To create a workbook from this template:

1. Go to **Home** > **Templates**, then select the **OpenAI Spend** template to review its details.
2. Click **Use template**. The template opens as an [exploration](/docs/ad-hoc-data-explorations) named after the template using sample data.
3. To use your own data, click **Change sources**:

   In the **Swap data sources overview** modal, Sigma attempts to match each source to your own tables. Because the column names match the OpenAI export, most sources match automatically.

   1. To replace a matched source, select the source drop-down menu, then select a new source.
   2. Match the sample users table to your own users table.
   3. Click **Swap now**, then explore the changes to confirm your data looks correct.
4. In the **Filters** menu, set the **Date Range** to scope the page to the period you care about.
5. To create an editable, publishable document, in the document header, click **Save as**, then name and save the workbook.

For more details, see [Create documents from templates](/docs/create-workbooks-from-templates).

## About this template

The template contains an Executive overview page, plus a hidden **Data** page for source data. The template also includes a README file to document the purpose of the template, source tables, and setup steps.

### Executive overview

This page answers "How much are we spending on OpenAI?" and includes:

* **Monthly Spend**, **Cost Per User**, and **Monthly Active Users** KPIs, each with the period-over-period change
* A stacked bar chart of monthly spend by department
* **Top 5 Line Items by Spend**, with a **Show** control for the number of results and a **Spend By** toggle for **Line Item**, **Project**, **Department**, or **User**
* **User Spend Details**, a table of spend by individual user, including email, name, job title, and department

## Related resources

* [Claude spend template](/docs/claude-spend-template)
* [Snowflake AI spend template](/docs/snowflake-ai-spend-template)
* [Get started with templates](/docs/get-started-with-templates)
* [Create documents from templates](/docs/create-workbooks-from-templates)
* [Create and edit document templates](/docs/create-and-edit-workbook-templates)