Copilot Usage#
Open Analytics → Copilot Usage to review GitHub Copilot seats, usage, adoption, AI Credits, and costs.
GitHub Copilot data reaches OptScale AI in three ways. The figures are shown side by side and are not added together.
| Scenario | What OptScale AI receives | Required |
|---|---|---|
| GitHub Connection | Seats, usage reports, adoption, AI Credits, budgets, and cost from the GitHub REST API. OptScale AI reads GitHub every hour. See Connect GitHub. | Yes |
| Add-on A. Capture Copilot telemetry (optional) | One trace for each Copilot chat or agent turn: prompt, answer, model, tokens, and the developer's GitHub login. Turns stay on GitHub's models. See Add-on A. Capture Copilot telemetry. | Optional |
| Add-on B. Route Copilot Chat through the AI Gateway (optional) | VS Code Copilot Chat routed through your model providers and recorded under the developer's virtual key, with tokens and cost. GitHub spends no AI Credits on routed calls. See Add-on B. Route Copilot Chat through the AI Gateway. | Optional |
On the diagram, Quick Start is the GitHub connection, Add-on A is Copilot telemetry, and Add-on B is VS Code Copilot Chat routed through the AI Gateway.
Requirements#
Before connecting GitHub, confirm that:
- The GitHub Copilot plan is Business or Enterprise. Individual plans have no usage API.
- In GitHub, the token owner is an organization owner. For an enterprise, the token owner is an enterprise owner or billing manager.
- In OptScale AI, the user is an Administrator, or a user with AI governance management.
Telemetry and linking GitHub accounts to employees have additional access requirements. Those requirements are stated in the sections below.
Connect GitHub#
Enable Copilot usage metrics#
- Open the Copilot policies in GitHub:
- Enterprise: AI controls → Copilot. In the older layout, open Policies → Copilot.
- Standalone organization: Organization settings → Copilot → Policies.
- Set Copilot usage metrics to Enabled. For an enterprise, set it to Enabled everywhere.
Open the connection#
-
Go to Analytics → Copilot Usage. Select Connect GitHub in the notice, or Configuration at the top of the page.

-
The Connections tab opens and shows Not connected. On the GitHub Connection card, select Set up.

-
Set the scope and the GitHub name:
Field Value Scope Organization, or Enterprise to read the whole enterprise Organization / Enterprise The name from the GitHub URL. github.com/acmeisacme.github.com/enterprises/acme-corpisacme-corp.
Create a GitHub token#
- In the form, select Create a classic token. GitHub opens with the required scopes already selected:
- Organization scope:
read:org,manage_billing:copilot, andread:audit_log. - Enterprise scope:
manage_billing:enterprise,read:audit_log, andread:org.
- Organization scope:
- Name the token
OptScale AI Copilot Usageand choose an expiration. - Select Generate token and copy the token.
- If the organization uses SAML single sign-on, select Configure SSO → Authorize next to the token.
To create a fine-grained token instead, see Create a fine-grained token. Which token fits each GitHub setup is covered in Token options.
Save and verify the connection#
- Paste the token into GitHub token.
- Turn on Read Copilot reports from GitHub. It is off for a new connection.
- Leave the other fields at their defaults and select Save.
The GitHub Connection card then shows Reading GitHub: On and GitHub token: Stored · Accepted.
If the token is not accepted, select Test below the card. Test reports Seat roster, Usage reports, and AI Credit billing. Each item is marked readable, or the result shows why GitHub refused it.
The first read of GitHub starts after the token is saved. When it finishes, the Sync card shows Usage reports and Credits and seats as Completed, and the tiles show Connection: Connected and Result: OK.
To read GitHub again at any time, select Sync now on the Sync card.
The checklist shows the remaining setup before the token is saved.

Note
Turning Read Copilot reports from GitHub off later keeps the data already stored.
Link GitHub accounts#
Linking GitHub accounts requires people analytics access.
- Open the People tab, or select Link people in the checklist.
- Select Match now. Each GitHub account gets a status:
- Linked — matched by SAML identity or email.
- Suggested — matched on the profile name only.
- Not matched — no match was found.
- Select Confirm suggestions to link the suggested accounts that have a single candidate.
- Link the remaining accounts with the link icon in Actions.
- Optional: turn on Link GitHub accounts automatically, so new accounts are linked without a manual match.
Review synced usage#
Open Analytics → Copilot Usage → Overview.
OptScale AI reads GitHub every hour. The first sync also reads GitHub history, so it takes longer. Data through is normally 2–3 days behind the current day, because GitHub publishes each day 2–3 days after that day ends.
Read again after (days) is a separate setting. It controls how long OptScale AI keeps re-reading a day, because GitHub can still complete that day after it ends. The default is 3 days. See Connection settings.
Enable per-person views#
Per-person views require both of the following:
- Select Edit on the GitHub connection and turn on Read the per-user report. This adds the GitHub login on each row and shows per-person AI Credits.
- In Impact Configuration → General, turn on Enable individual performance analytics. See Minimum group size.
Add-on A. Capture Copilot telemetry (optional)#
Copilot telemetry records one trace for each Copilot chat or agent turn: the prompt, the answer, the model, the tokens, and the developer's GitHub login. Turns still run on GitHub's models. Telemetry does not change where requests are sent.
These traces are shown next to the GitHub usage figures and are not added to them.
Creating the source requires AI platform management. The source key also requires credential management.
Create the telemetry source#
-
In Configuration → Connections, select Connect on the Copilot Telemetry card, or select Connect source in the checklist.

-
When the source exists, the card shows Status: Connected and a GitHub Copilot link to the source page.
- On the source page, select How to Connect at the top right. Copy the snippets from that page. They already contain the endpoint and key for this organization. The examples below show only the shape of the settings.
Export telemetry for the enterprise (recommended)#
To cover every developer, an enterprise owner adds the following block to copilot/managed-settings.json.
The file is in the enterprise organization's .github-private repository, the repository chosen as the source of client governance in AI controls.
The settings apply to VS Code, Copilot CLI, and JetBrains. Clients pick them up within about an hour.
{
"telemetry": {
"enabled": true,
"endpoint": "https://<your-host>/llm_proxy/<organization-id>/api/shadow/otlp",
"protocol": "http/protobuf",
"headers": {
"x-osai-vk": "<telemetry source key>",
"x-osai-installation": "github-copilot"
},
"captureContent": true,
"capture": { "identity": true, "prompts": true, "responses": true }
}
}
Export telemetry from VS Code#
One developer can export telemetry from VS Code 1.140 or later.
The github.copilot.chat.otel.* settings cover Local chats. The chat.agentHost.otel.* settings cover Copilot sessions.
- Add the settings below to the user
settings.json. - Replace
<github-login>in both endpoints with the login VS Code is signed in with. - Quit VS Code completely and start it again.
{
"github.copilot.chat.otel.enabled": true,
"github.copilot.chat.otel.exporterType": "otlp-http",
"github.copilot.chat.otel.otlpEndpoint": "https://<your-host>/llm_proxy/<organization-id>/api/shadow/otlp/source/github-copilot/<telemetry source key>/user/<github-login>",
"github.copilot.chat.otel.protocol": "http/protobuf",
"github.copilot.chat.otel.captureContent": true,
"github.copilot.chat.otel.captureIdentity": true,
"github.copilot.chat.otel.maxAttributeSizeChars": 65536,
"chat.agentHost.otel.enabled": true,
"chat.agentHost.otel.exporterType": "otlp-http",
"chat.agentHost.otel.otlpEndpoint": "https://<your-host>/llm_proxy/<organization-id>/api/shadow/otlp/source/github-copilot/<telemetry source key>/user/<github-login>/v1/traces",
"chat.agentHost.otel.captureContent": true
}
Export telemetry from Copilot CLI#
One developer can export telemetry from Copilot CLI 1.0.4 or later. Set these variables before running copilot:
export COPILOT_OTEL_ENABLED=true
export OTEL_EXPORTER_OTLP_ENDPOINT=https://<your-host>/llm_proxy/<organization-id>/api/shadow/otlp
export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
export OTEL_EXPORTER_OTLP_HEADERS="x-osai-vk=<telemetry source key>,x-osai-installation=github-copilot"
export OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true
export OTEL_RESOURCE_ATTRIBUTES="user.name=<github-login>"
Replace <github-login> with the GitHub login used for Copilot CLI.
Verify telemetry#
Ask Copilot something in agent mode and wait about a minute. Open Analytics → Traces and filter by the GitHub Copilot source.
The trace shows the turn with its prompt, answer, and developer.
Telemetry limits#
Inline completions, next edit suggestions, Visual Studio, Xcode, Eclipse, and the Copilot cloud agent do not send telemetry.
Replace the telemetry key#
- Regenerate the key on the source page under Config → Shadow AI Capture.
- Update the managed settings, or the developers' settings, immediately.
The previous key stops working immediately.
Add-on B. Route Copilot Chat through the AI Gateway (optional)#
Each chat call is billed by your model provider and recorded under the developer's virtual key, with tokens and cost. GitHub spends no AI Credits on routed calls.
These calls are shown next to the GitHub usage figures and are not added to them.
In GitHub, keep the Bring Your Own Language Model Key in VS Code policy enabled.
Copy connection values#
Copy these three values:
- Base URL, for example
https://<your-host>/llm_proxy/<organization-id>/v1 - API key, the virtual key
- Model name,
<provider>/<model>
Where to copy them depends on the key:
- A developer's own key: select Getting started (the rocket icon in the page header), then Choose how to send a request → Show me the code.
- An agent account's key: open How to Use → API & Agents, select the agent, provider, and model, then open the OpenAI-compatible tab.
Add the custom endpoint#
In VS Code, run Command Palette → Manage Language Models → Custom Endpoint and answer the prompts:
- Group name:
optscale - Display name:
OptScale AI - API key: the virtual key
- API type: Chat Completions
VS Code opens chatLanguageModels.json. Set the model and save the file:
idis the Model name.urlis the Base URL followed by/chat/completions.
[
{
"name": "OptScale AI",
"vendor": "customendpoint",
"apiKey": "${input:optscaleVirtualKey}",
"apiType": "chat-completions",
"models": [
{
"id": "<provider>/<model>",
"name": "My model (OptScale AI)",
"url": "https://<your-host>/llm_proxy/<organization-id>/v1/chat/completions",
"toolCalling": true,
"vision": true,
"maxInputTokens": 128000,
"maxOutputTokens": 16384
}
]
}
]
Leave apiKey set to ${input:optscaleVirtualKey}. Do not paste the virtual key into chatLanguageModels.json.
Select the model in the chat model picker. To route background calls as well, set chat.utilityModel, chat.utilitySmallModel, and inlineChat.defaultModel to the same model.
For a deployment that uses a self-signed certificate, see Self-signed certificates.
Verify routed chat#
Send a chat message. Open Analytics → Traces and filter by the virtual key.
The trace shows the call with its model, tokens, and cost.
What stays on GitHub#
Inline completions, semantic search, and embeddings stay on GitHub, so developers keep their Copilot seat.
Token options#
| GitHub setup | Scope in OptScale AI | Token |
|---|---|---|
| Standalone organization | Organization | Fine-grained token (least privilege), or a classic token of an organization owner |
| Organization inside an enterprise | Organization | Classic token of an enterprise owner or billing manager |
| Whole enterprise | Enterprise | Classic token of an enterprise owner or billing manager. GitHub has no fine-grained token for enterprise billing. |
What each token can read#
| Data | Fine-grained | Classic, organization owner | Classic, enterprise owner or billing manager |
|---|---|---|---|
| Seats, usage reports, AI Credits, budgets | Yes | Yes | Yes, plus cost centers for Enterprise scope |
| Per-person AI Credits | Standalone organization only | Standalone organization only | Yes |
| Copilot cloud agent tasks | Yes, with Agent tasks: Read | No | No. The agent's pull requests are still counted. |
Create a fine-grained token#
- Open the fine-grained token page, or select Create a fine-grained token in the form.
- Set Resource owner to the organization.
- Set Repository access to Public repositories.
- Set these Organization permissions to Read-only:
- Administration — seats, billing, budgets, and the audit log.
- Copilot metrics — usage reports.
- Members — linking logins to employees.
- Optional: to read cloud agent tasks, choose All repositories and set the repository permission Agent tasks to Read-only.
- If the organization requires approval, an owner approves the token under Organization settings → Personal access tokens → Pending requests.
Replace a GitHub token#
- Create a new token.
- On the GitHub Connection card, select Edit, paste the new token, and select Save.
- Confirm that GitHub token shows Accepted. If it does not, select Test.
- Delete the old token in GitHub.
Connection settings#
| Field | Default | Notes |
|---|---|---|
| GitHub Enterprise Server API address | Blank (github.com) | For GitHub Enterprise Server, for example https://github.example.com/api/v3. The address must be allowed by the OptScale AI deployment. |
| Read Copilot reports from GitHub | Off for a new connection | Must be on to sync. Turning it off later keeps the stored data. |
| Read the per-user report | Off | Adds the GitHub login on each row and per-person AI Credits. |
| Read again after (days) | 3 | GitHub can still complete a day after it ends. |
| Pool shares to warn at (%) | 80, 100 | Credit warnings appear only in Copilot Usage. OptScale AI does not send them by email. |
| Budget share to warn at (%) | 90 | 0 turns budget warnings off. |
| Warn when the pool runs out early | On | Warns at the current pace, before the month ends. |
Troubleshooting#
| Symptom | What to do |
|---|---|
| GitHub rejected the token | The token expired, was revoked, or was mistyped. Create a new token, then select Edit, paste it, select Save, and select Test. |
| Usage reports: refused, or not found for this scope | Turn on Copilot usage metrics. Check the organization or enterprise name. A fine-grained token needs Copilot metrics. |
| Seat roster or AI Credit billing: refused | A classic token needs manage_billing:copilot for an organization, or manage_billing:enterprise for an enterprise. A fine-grained token needs Administration. |
| No per-person AI Credits for an organization inside an enterprise | Use an enterprise owner's classic token with Scope set to Organization. |
| A fine-grained token does nothing | It may still be waiting for an owner's approval, or the organization may block fine-grained tokens. Approve it, or use a classic token. |
| A classic token is refused with an SSO message | Select Configure SSO → Authorize next to the token in GitHub. |
| Per-person views are empty | Turn on Read the per-user report, and turn on Enable individual performance analytics in Impact Configuration → General. |
| The Cloud Agent Tasks card is empty | Use a fine-grained token with Agent tasks set to Read-only on all repositories. |
| No telemetry from Local chats | View → Output → GitHub Copilot Chat shows [OTel] Span export failed. Correct the endpoint and key, then reload the window. |
| No telemetry from Copilot sessions | agenthost.log (Developer: Open Logs Folder) shows HTTP 401 when the key is wrong, or 400 when <github-login> is still in the endpoint. Correct it, then quit VS Code and start it again. |
| Custom Endpoint is missing in VS Code | Enable the Bring Your Own Language Model Key in VS Code policy in GitHub. |
See also#
- Minimum group size — Turn on individual performance analytics for per-person views.
- Self-signed certificates — Trust an internal certificate before using the VS Code custom endpoint.
- Usage and Cost — Review gateway token usage and spend.
- Connect VS Code — Custom endpoint settings for VS Code.