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

# GitHub Copilot Billing Setup

> Connect GitHub Enterprise billing and Copilot usage to Costory, with cost per user and per model, and team labels from organization installs.

Connect GitHub Enterprise Cloud so Costory imports the GitHub bill and Copilot usage. You see each GitHub username, each model, and how much of that usage sat inside the included pool versus what GitHub invoiced.

GitHub Enterprise Cloud is required. Enterprise Server and GHE.com are out of scope. A personal access token cannot call the billing usage export.

## Prerequisites

* An enterprise owner who can install a GitHub App on the enterprise.
* For organization team labels, an owner of each organization who can approve the same App on that organization.
* The enterprise **Copilot usage metrics** policy set to **Enabled everywhere** if you want user ids and enterprise team labels. The bill still imports when that policy is off. Labels stay empty until GitHub publishes the file for that day. Each organization also needs Copilot metrics enabled, or its team labels stay empty.
* Read access on the Costory GitHub App for **Enterprise billing**, **Enterprise Copilot metrics**, and **Organization Copilot metrics**. Costory keeps the App id and private key. You do not create an App or paste a key.

## Connect GitHub

**1. Open the GitHub billing form**

Go to [Integrations](https://app.costory.io/integration), click **+ Add integration**, then choose **GitHub** under **Billing**.

**2. Install the Costory GitHub App on the enterprise**

Click **Install the Costory GitHub App**. Sign in as someone who can access the enterprise installation, and select the enterprise. GitHub redirects back to this Costory organization and fills **Installation ID** and **Enterprise slug**.

The enterprise install reads the bill and enterprise Copilot metrics. Organization team files need a separate install, in the next step.

**3. Install the App on each organization**

Choose **Team scope** first. **Organization teams** is the default. **Install on an organization** is available for **Organization teams** and **Organization and enterprise teams**.

Click **Install on an organization** and select the organization on GitHub. An owner of that organization approves the App. After GitHub redirects back, the login appears under **Installed organizations**. Repeat for each organization whose teams you want.

**Enterprise and business teams** hides that button and ignores organization installs. With the other two scopes, save requires at least one organization. The message is: install the Costory GitHub App on at least one organization, or choose Enterprise teams.

An organization you add later needs a new connection.

**4. Confirm the enterprise slug**

**Enterprise slug** is filled from the enterprise install. It is the slug in `github.com/enterprises/your-slug`.

**5. Validate and save**

Click validate. A success message means the App can read this enterprise's billing reports. Then save. The first sync requests GitHub usage exports. An empty **Start date** imports from the start of the month 13 months ago. GitHub only serves exports for the last 24 months. Copilot AI-credit rows start on 1 June 2026.

> [!NOTE]
>
> The install link expires after 10 minutes and can be used once. If GitHub says the link is no longer valid, start the install again from this page.

## Team scope

Team labels do not change the dollar amount. Spend stays on one row per user. Filtering a team that shares members with another team double-counts those people. The invoice total is the sum of rows, ignoring the team label.

| Team scope | What GitHub returns |
| - | - |
| Organization teams | Organization teams for each organization on the bill. Default. |
| Enterprise and business teams | Enterprise teams and business teams from the enterprise file. |
| Organization and enterprise teams | Both. Slugs are prefixed with `org:` or `enterprise:`. |

The enterprise installation grants enterprise permissions. **Organization Copilot metrics** comes from the install on that organization. GitHub lists the accounts you can administer on the install screen, so an enterprise owner still installs the App once per organization.

Teams with fewer than five seated Copilot users are absent from GitHub's file, so those users stay unlabeled.

**Enterprise and business teams** uses the enterprise permission from the first install. Choose it when organization team labels are unnecessary.

On later syncs, an organization on the bill with no claimed install is skipped. Those users keep their username and get an empty organization team label. A 401 or 403 on an organization that is installed keeps the previous team label for that day.

## What the rows contain

Costory maps the GitHub export onto [standard columns](https://docs.costory.io/docs/standard-columns.md). Provider and invoice issuer are **GitHub**. Currency is USD.

| What you want | Column |
| - | - |
| GitHub username | **Resource name** (`github_user`) and the `username` label |
| Model | **Charge description** and the `model` label |
| Usage inside the included pool | [List cost](https://docs.costory.io/docs/cost-metrics) minus [Billed cost](https://docs.costory.io/docs/cost-metrics) |
| Usage GitHub invoiced | **Billed cost** |
| Token direction | **Subcategory** (`Input Tokens`, `Cached Input Tokens`, `Cache Write Tokens`, `Output Tokens`, `Long Context`) |
| Organization | **Sub account id** |
| Team | `github_teams` label. Organization slugs, enterprise slugs, or both with an `org:` or `enterprise:` prefix |
| Repository and workflow | `repository` and `workflow_path` labels |

Copilot AI credits, Cloud Agent, and Copilot code review are **AI Productivity**. Actions, Packages, and Codespaces are **Developer Tools**. Seat SKUs such as `copilot_for_business` are **Other** and have no model.

A user who is still inside the pool has a positive list cost and a billed cost of 0 on that user and model. A user who exceeds the pool keeps the same user and model, and billed cost is the invoiced part. One row is one day, one user, one model, and one token type. Group **Resource name** and **Charge description** to roll that up.

When a detailed row has a username, **Resource name** is that user. The repository stays on the `repository` label. A row with no username and a repository uses `organization/repository` as **Resource name**.

## What Costory does not include

* A separate column for the monthly quota. The pool size is not on the row. Compare list cost and billed cost.
* Copilot activity that is not a charge: acceptance rate, IDE, and lines of code.
* Per-pull-request cost. Code review AI credits are per person and model. Actions minutes for the review agent stay on the repository.
* Self-hosted runner infrastructure. That stays on the AWS or GCP datasource.

## Troubleshooting

> [accordion] GitHub asked an owner to approve the organization
>
> The form says an owner of the organization must approve the Costory GitHub App. Ask that owner to approve it, then click **Install on an organization** again from this page.

> [accordion] Save asks for an organization install
>
> **Team scope** is **Organization teams** or **Organization and enterprise teams**, and **Installed organizations** is empty. Install the App on at least one organization, or set **Team scope** to **Enterprise and business teams**.

> [accordion] Organization team labels are missing
>
> Install the Costory GitHub App on that organization from this page, with **Organization Copilot metrics: Read**. The enterprise installation cannot read organization team files. An organization on the bill that is missing from **Installed organizations** is skipped, and those users have an empty team label. If validation says the App cannot read Copilot metrics in that organization, the install is missing that permission. Enable Copilot metrics on the organization, or the team label stays empty after a successful install.

> [accordion] User id and team are empty on a day that has spend
>
> GitHub publishes the metrics files separately from the bill. The day the **Copilot usage metrics** policy is enabled, those files can still be empty. The username from the bill is still on **Resource name**.

> [accordion] Billed cost is 0 while list cost is not
>
> That usage was covered by the included pool. Billed cost rises on the same user and model when GitHub invoices usage past the pool.

## Related

* [Billing data](https://docs.costory.io/setup/billing)
* [Cost metrics](https://docs.costory.io/docs/cost-metrics)
* [Standard columns](https://docs.costory.io/docs/standard-columns.md)
* [LLM cost allocation](https://docs.costory.io/use-cases/llm-ai-cost.md)
* [Cost Explorer](https://docs.costory.io/features/cost-explorer.md)

Last checked 27 November 2026.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.