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

# GitHub Copilot

> Connect GitHub Copilot to see your Copilot seats and AI credit spend

Glow's GitHub Copilot integration reads one GitHub organization's Copilot seats, its Copilot billing settings, and its AI credit spend through the GitHub REST API. It authenticates with **one classic personal access token** created by an **owner of the organization**.

| Data | What it collects |
| - | - |
| **Seats** | One row per seat holder: GitHub username, plan (Business or Enterprise), the team that assigned the seat, when they last used Copilot and in which editor, and any pending cancellation |
| **Organization billing** | Your Copilot settings and the seat breakdown for the billing cycle: total, active, inactive, pending cancellation, and pending invitation seats |
| **AI credit spend** | GitHub's daily AI credit report per product and model: the gross amount, the credits included with your seats, and the net amount billed. Where GitHub allows it, also per seat holder |

In AI Spend, seats are priced at GitHub's list price (\$19 a month for Business, \$39 for Enterprise), and AI credits add the net amount billed beyond what your seats include.

## Prerequisites

> [!TIP]
>
> A GitHub organization on **Copilot Business** or **Copilot Enterprise**

> [!TIP]
>
> An **owner of that organization** to create the token. GitHub shows Copilot seats and billing to organization owners only, so a token from anyone else is refused, including an enterprise admin who is not an owner of the organization

> [!TIP]
>
> Optional, for AI credit spend per person when your organization belongs to a GitHub enterprise: the enterprise's name from its GitHub URL, and a token owner who is also an **enterprise owner or billing manager**. See [Enterprise-owned organizations](#enterprise-owned-organizations)

## Setup Instructions

> [!TIP]
>
> **Does your organization belong to a GitHub enterprise?** If it does and you want AI credit spend per person, read [Enterprise-owned organizations](#enterprise-owned-organizations) before you create the token, because the token then needs one more scope. If you are not sure, continue without it. Glow still collects your seats and total spend, and you can add the enterprise later.

### Create the Token

**1. Sign in as an organization owner**

Sign in to GitHub as an **owner** of the organization that holds the Copilot subscription.

**2. Create a classic personal access token**

Open the [new classic token form](https://github.com/settings/tokens/new?scopes=manage_billing:copilot,read:org\&description=Glow%20GitHub%20Copilot), which opens with the right scopes already selected. You can also reach it from **Settings → Developer settings → Personal access tokens → Tokens (classic) → Generate new token (classic)**.

* **Note**: something you will recognize later, such as "Glow GitHub Copilot".
* **Expiration**: whatever fits your policy. When the token expires, Glow stops syncing until you give it a new one, so note the date.
* **Scopes**: `manage_billing:copilot` and `read:org`. Add `manage_billing:enterprise` only if you will fill in **Enterprise** below.

**3. Copy the token**

Click **Generate token**, then copy the value and keep it somewhere safe. GitHub shows it only once.

**4. Authorize the token for single sign-on**

Skip this step if your organization does not use SAML single sign-on. Otherwise, open [your tokens](https://github.com/settings/tokens), click **Configure SSO** next to the new token, and click **Authorize** for your organization. Until you do, GitHub refuses the token's requests for the organization.

### Complete the Integration

**1. Open the connection drawer**

In the Glow console, open **Integrations → Add integration → GitHub Copilot**.

**2. Fill in the fields**

* **Organization**: your organization's name as it appears in its GitHub URL, for example `acme` for `github.com/acme`.
* **Enterprise** (optional): your enterprise's name as it appears in its GitHub URL, for example `acme` for `github.com/enterprises/acme`. Fill it in only if your organization belongs to an enterprise and the token has `manage_billing:enterprise`. Otherwise leave it empty.
* **Personal Access Token**: the token you just created.

**3. Test the connection**

Click **Test Connection**. Glow tries each of the three checks against your organization: **Get organization Copilot billing**, **Get Copilot seats**, and **Get AI credit usage**. A mistyped organization, a missing scope, or a token from someone who is not an owner shows up here, before anything is saved. If a check fails, see [Troubleshooting](#troubleshooting).

**4. Save**

Save the integration. The first sync starts within a few minutes.

### What happens next

* Your seats and spend appear in AI Spend within about half an hour of the first sync.
* Glow syncs every 4 hours. Each sync re-reads the last 7 days of AI credit usage, so late corrections from GitHub land.
* Over the first syncs, Glow also backfills up to 90 days of AI credit history.

## Enterprise-owned organizations

When your organization belongs to a GitHub enterprise, GitHub reports the organization's AI credit total but refuses to break it down per person on the organization report, whatever scopes the token has. Glow keeps the organization total, so your spend stays complete, but AI credit spend is not tied to people.

To see AI credit spend per person, fill in **Enterprise** on the integration. Glow then reads AI credit usage from your enterprise's billing report, which GitHub does break down per person. That report needs two things:

* the `manage_billing:enterprise` scope on the token, in addition to `manage_billing:copilot` and `read:org`
* a token created by someone who is an **enterprise owner or billing manager** and is also an **owner of the organization**

If the person who created your current token holds both roles, you don't need a new token: open it under [your tokens](https://github.com/settings/tokens), tick `manage_billing:enterprise`, and click **Update token**. The token value stays the same. Otherwise, create a new token as someone who holds both roles and paste it into the integration.

> [!NOTE]
>
> The enterprise report gives each person's usage across every organization in the enterprise. For someone with a seat in one organization, that is the same number.

## Limitations

* **Matching spend to people needs an email.** Glow ties seats and spend to people, and through them to departments, by email address. GitHub only shares a seat holder's email when they have made it public on their GitHub profile, so seats and spend for other seat holders are not tied to a person or department.
* **AI credit usage arrives a day later.** Glow reads GitHub's report one complete day at a time, so today's usage appears tomorrow.
* **One integration covers one organization.** If your enterprise has several organizations with Copilot, connect each one separately.

## Troubleshooting

> **Every check fails with an HTTP 401 error**
>
> The token is invalid, expired, or revoked. Make sure you copied the whole value, check its expiration under [your tokens](https://github.com/settings/tokens), and create a new one if needed.

> **Get Copilot seats or Get organization Copilot billing fails with an HTTP 403 error**
>
> Either the person who created the token is not an owner of the organization, or your organization uses SAML single sign-on and the token is not authorized for it. Click **Configure SSO** next to the token under [your tokens](https://github.com/settings/tokens) and authorize it, or create the token as an organization owner.

> **Any check fails with an HTTP 404 error**
>
> Check that **Organization** is the name from your organization's GitHub URL, not its display name. If you filled in **Enterprise**, check that it is the name from your enterprise's GitHub URL, and that the token has `manage_billing:enterprise` and was created by an enterprise owner or billing manager.

> **AI Spend shows Copilot spend, but not tied to people**
>
> If your organization belongs to an enterprise, fill in **Enterprise** as described in [Enterprise-owned organizations](#enterprise-owned-organizations). If you already have, or your organization is not part of an enterprise, your seat holders have no public email on GitHub, so Glow cannot match them to people in your directory.

> **Syncs are slow, or per-person spend fills in over several syncs**
>
> GitHub limits each token to 5,000 requests an hour, shared with anything else that uses the same token. Glow always fetches your organization's totals first and leaves room in that limit, so totals stay complete while the per-person breakdown fills in over the next syncs. A token used only for Glow avoids the issue.
