Use the GitHub Copilot usage integration to collect daily Copilot usage data from your GitHub organization for reporting and analysis in Yarken.
Yarken deploys and maintains the Advanced Integration for your environment. Your organization enables Copilot usage metrics, creates and maintains the required GitHub fine-grained personal access token, authorizes the Advanced Connection, and monitors the resulting data.
What the integration provides
The integration can provide GitHub Copilot usage information by user, day, organization, enterprise, model, and Copilot feature.
-
Daily GitHub Copilot usage by user.
-
Model- and feature-level activity when GitHub provides that detail.
-
AI credit consumption and estimated cost.
-
Input and output token usage where available.
-
User interactions, code generations, and code acceptances.
-
Acceptance rate and usage indicators for supported Copilot surfaces.
Some values are calculated by Yarken because GitHub does not provide every metric at the same level of detail. In particular, GitHub reports AI credits at the user-day level rather than by model.
Roles and responsibilities
|
Activity |
Responsibility |
|---|---|
|
Deploy and maintain the Advanced Integration |
Yarken |
|
Maintain the integration and transformation logic |
Yarken |
|
Enable GitHub Copilot usage metrics |
Your GitHub administrator |
|
Create the fine-grained personal access token |
GitHub organization owner or authorized role |
|
Approve the token request, if required |
GitHub organization owner |
|
Authorize the GitHub connection in Yarken |
Yarken administrator |
|
Rotate the token before expiry |
Your GitHub or Yarken administrator |
|
Run and monitor the Advanced pipeline |
Admin or Cost Model Manager |
|
Review imported usage and cost data |
FinOps and reporting users |
Before you begin
|
Requirement |
Details |
|---|---|
|
GitHub organization |
You need the GitHub organization whose Copilot usage you want to report. |
|
Token owner |
The token creator must be an organization owner or hold a custom organization role with View Organization Copilot Metrics permission. |
|
Copilot usage metrics |
The Copilot usage metrics policy must be enabled for the enterprise or organization. |
|
Fine-grained personal access tokens |
Your GitHub organization must allow fine-grained personal access tokens. |
|
Token approval |
If your organization requires token approval, an organization owner must approve the request before the integration can run successfully. |
|
Yarken access |
You need a Yarken administrator account to authorize the GitHub Advanced Connection. |
|
Secure token storage |
Store the token in an organization-approved secrets manager. |
A fine-grained personal access token cannot have more access than the GitHub account that owns it. Make sure the token owner has the required organization-level access.
Create the GitHub fine-grained personal access token
Complete these steps using the GitHub account that will own the integration token.
Step 1: Open the token settings
-
Sign in to GitHub.
-
Select your profile photo, then select Settings.
-
Select Developer settings.
-
Select Personal access tokens > Fine-grained tokens.
-
Select Generate new token.
Step 2: Configure the token
|
Setting |
What to configure |
|---|---|
|
Token name |
Enter a descriptive name that identifies the Yarken integration and GitHub organization. |
|
Resource owner |
Select the GitHub organization being integrated with Yarken. |
|
Expiration |
Select an expiration period that follows your organization's security policy. Set a reminder to rotate the token before it expires. |
|
Repository access |
Select Public repositories (read-only). |
The GitHub organization must be selected as the token's Resource owner. A token owned by a personal account cannot retrieve the organization's Copilot usage metrics.
Step 3: Configure organization permissions
Under Permissions > Organization permissions, set only the following permissions to Read-only:
|
Permission |
Purpose |
|---|---|
|
Copilot metrics |
Required to retrieve organization Copilot usage reports. |
|
Administration |
Supports organization-level Copilot data used by the integration. |
|
Members |
Supports organization member and team lookups. |
Leave all other organization permissions set to No access.
Step 4: Generate and store the token
-
Select Generate token.
-
If your organization requires approval, generate the token and request access.
-
Copy the token immediately and store it securely.
Fine-grained GitHub personal access tokens begin with github_pat_. GitHub displays the token value only once. Do not include the full token in screenshots, documentation, email, chat, support tickets, or source code.
Step 5: Approve the token, if required
If your organization requires approval:
-
Sign in as a GitHub organization owner.
-
Open the organization.
-
Go to Settings > Personal access tokens > Pending requests.
-
Review the requested permissions.
-
Select Approve.
Authorize the GitHub connection
-
Sign in to Yarken as an administrator.
-
Go to Admin > Pipelines > Connections.
-
Select the ADVANCED tab.
-
Open the GitHub connection.
-
Complete the connection fields.
-
Select Connect.
-
Confirm that the connection status changes from Access requested to Connected.
|
Field |
Requirement |
Value or guidance |
|---|---|---|
|
Connection type |
Required |
Select Cloud when connecting to GitHub.com. |
|
Authentication type |
Required |
Select Personal Access Token. |
|
Host name |
Optional |
Leave blank for GitHub.com. If Yarken has configured this integration for GitHub Enterprise Server, enter the host name provided for your environment. |
|
Personal Access Token |
Required |
Enter the fine-grained PAT created for the GitHub organization. The token begins with |
|
Custom OAuth profile |
Optional |
Leave unselected unless Yarken instructs you otherwise. This integration uses Personal Access Token authentication. |
For the common connection workflow, see Authorize Advanced Connections.
How the integration works
Yarken retrieves daily GitHub Copilot usage reports through the deployed Advanced Integration. You do not configure the underlying API calls or transformation logic.
-
GitHub Copilot provides the daily organization usage report.
-
GitHub Advanced Connection authorizes Yarken using the fine-grained personal access token.
-
Yarken-managed integration workflow retrieves and transforms the report into consistent reporting records.
-
Advanced pipeline runs the integration and records the execution result.
-
Yarken reporting makes the transformed usage and cost data available for analysis.
Where the data appears
The GitHub Copilot Advanced Integration ingests transformed usage and cost data into AI Usage.
After ingestion, review the imported data in Designer > Consumption > AI. Use Analytics > AI Consumption for reporting and analysis.
Source API and raw data
The integration retrieves daily GitHub Copilot user reports through the following API endpoint:
GET /orgs/{org}/copilot/metrics/reports/users-1-day?day=YYYY-MM-DD
The endpoint returns signed download links. The downloaded report contains one JSON object per user for the requested UTC day. You do not configure these API calls in Yarken.
Source records include user and organization identifiers, ai_credits_used, model and feature activity in totals_by_model_feature, and supported token data in totals_by_cli and totals_by_copilot_app.
Source-to-transformed field mapping
Yarken transforms the report into records grouped by user, day, model, and feature. The following table describes the transformed connector output.
|
Transformed field |
Source or transformation |
|---|---|
|
|
MD5 hash of day|user_id|model|feature. |
|
|
Copied from source day. |
|
|
Copied from source user_id. |
|
|
Copied from source user_login. |
|
|
Copied from source organization_id. |
|
|
Copied from source enterprise_id. |
|
|
Model from totals_by_model_feature; blank values become unknown. |
|
|
Feature from totals_by_model_feature; blank values become unknown. |
|
|
Allocated share of the user-day ai_credits_used total. |
|
|
Estimated cost calculated as ai_credits * 0.01. |
|
|
Allocated share of prompt_tokens_sum from totals_by_cli and totals_by_copilot_app. |
|
|
Allocated share of output_tokens_sum from totals_by_cli and totals_by_copilot_app. |
|
|
Sum of allocated input_tokens and output_tokens. |
|
|
JSON string containing activity counts, usage indicators, acceptance rate, and allocation. |
Mapping scope: These are transformed integration output fields. They are not a confirmed one-to-one mapping to the final Yarken data table or Analytics field names.
How usage and cost are represented
GitHub reports several metrics at different levels of detail. Yarken combines these values into consistent user, day, model, and feature records.
How credits and tokens are allocated
GitHub provides ai_credits_used once per user and UTC day. Yarken allocates those credits and supported token totals across model and feature records using the same weighting method.
|
Condition |
Allocation method |
|---|---|
|
One model and feature |
Assign the complete user-day totals ( |
|
Multiple groups with interactions |
Split by |
|
Multiple groups without interactions |
Split by |
|
Multiple groups without interactions or generations |
Split equally ( |
|
Credits or tokens, but no model and feature groups |
Create one record with model and feature set to |
|
No groups, credits, or tokens |
Retain the raw user-day record without creating a transformed record. |
The allocated credit and token shares reconcile to the source user-day totals. Token shares are whole numbers. Credit shares smaller than 0.000000001 are stored as zero. Cost follows the allocated credit amount.
The allocation property in the JSON-formatted tags field identifies the allocation method. Model- and feature-level allocations are calculated values, not GitHub-reported billed amounts.
AI credits and estimated cost
GitHub provides AI credits at the user-day level. Yarken allocates those credits across the model and feature records based on available activity.
Estimated cost is calculated as AI credits × $0.01.
Model-level AI credits are estimates generated from available activity. GitHub does not provide a billed credit amount by model or feature. The estimated cost also does not account for discounts, included allowances, or plan pricing.
Token usage
The integration uses prompt_tokens_sum and output_tokens_sum from the following Copilot sources:
-
Copilot CLI
-
Copilot app
Yarken allocates combined CLI and Copilot app token totals across model and feature records using the allocation rules above. These are not independent model-level token measurements.
Other Copilot activity can therefore show usage and AI credits while reporting zero tokens.
Acceptance rate
Yarken calculates acceptance_rate as code_acceptance_activity_count / code_generation_activity_count. The value is empty when code generations are zero.
Activity and usage tags
The tags field is a JSON-formatted string containing activity counts, usage flags, and the allocation method.
|
Tag |
Description |
|---|---|
|
|
User-initiated interactions for the model and feature group. |
|
|
Code generations for the group. |
|
|
Code acceptances for the group. |
|
|
Code acceptances divided by code generations; empty when generations are zero. |
|
|
Whether GitHub reported chat usage for the user-day. |
|
|
Whether GitHub reported agent usage for the user-day. |
|
|
Whether GitHub reported CLI usage for the user-day. |
|
|
Whether GitHub reported Copilot app usage for the user-day. |
|
|
Whether GitHub reported coding-agent usage for the user-day. |
|
|
Whether GitHub reported cloud-agent usage for the user-day. |
|
|
Method used to allocate credits and tokens. |
Usage indicators: Product flags are copied from the user-day source record. They do not independently measure usage for each model and feature.
Current limitations and data interpretation
Model-level credits are allocated estimates
Do not interpret an individual model-level credit value as an amount directly billed by GitHub. User-day totals remain based on GitHub source data.
Token coverage is partial
Token data covers Copilot CLI and Copilot app activity. Other Copilot features can have usage and AI credits while reporting zero tokens.
Unknown model or feature
The value unknown appears when a model or feature is blank. If a user-day has credits or tokens but no model and feature groups, Yarken creates one record with both fields set to unknown.
Users with no output record
When a user-day has no model or feature groups and both credits and tokens are zero, the record remains in the raw data without creating a transformed output record. This does not necessarily indicate a pipeline failure.
Data availability
-
GitHub Copilot usage reports are available for dates on or after October 10, 2025.
-
Reports are retained for up to one year.
-
A day with no Copilot activity can return no report data.
Data freshness and ingestion delay
GitHub Copilot usage data is not available immediately after activity occurs. GitHub processes usage telemetry before making daily reports available through its API. Recent usage data may take up to three full UTC days to finalize.
During each configured Advanced pipeline run, Yarken retrieves the latest available GitHub Copilot usage data. The connector does not apply a fixed four-day ingestion offset. The reporting date may therefore be several days earlier than the pipeline run date, depending on GitHub's data availability and the pipeline execution schedule.
For example, a pipeline run on October 7 may retrieve usage data for October 3.
Expected reporting delay: A gap of several days does not necessarily indicate an ingestion failure. If expected data remains unavailable, review the ADVANCED pipeline run history and compare the reporting date against the source report in GitHub.
For details about reporting latency, see Reconciling Copilot usage metrics.
Run and monitor the Advanced pipeline
After the GitHub connection shows Connected:
-
Go to Admin > Pipelines > Pipelines.
-
Select the ADVANCED tab.
-
Locate the GitHub Copilot pipeline.
-
Select Run when you need an immediate execution, or keep recurring execution active as configured for your environment.
-
Open the pipeline to review the latest status and run history.
See Manage Advanced pipelines for the common pipeline controls.
Validate the integration
After the first successful run, confirm that:
-
The GitHub connection shows Connected.
-
The fine-grained PAT has not expired.
-
The GitHub organization is the token's Resource owner.
-
Copilot metrics, Administration, and Members are set to Read-only.
-
Copilot usage metrics are enabled.
-
Token approval is complete, if required.
-
Expected GitHub users, models, and features are present.
-
AI credits and estimated cost are populated where GitHub reports AI credit consumption.
-
Input and output tokens are present where GitHub provides Copilot CLI or Copilot app token data.
Reconcile source and transformed records
If source and transformed records are available to you, compare them for the same UTC day:
-
Confirm the expected users, model and feature groups, and
unknownrecords. -
Compare summed
ai_creditswith the sourceai_credits_usedfor each user-day, allowing for credit shares stored as zero. -
Compare summed
input_tokensandoutput_tokenswith available Copilot CLI and Copilot app token totals. -
Verify
cost_usdusesai_credits * 0.01and checktags.allocationto explain how values are distributed.
Troubleshooting
|
Issue |
Likely cause |
What to do |
|---|---|---|
|
Connection remains Access requested |
The connection has not been authorized successfully. |
Verify the token, required permissions, approval status, and Copilot usage metrics policy, then select Connect. |
|
401 response |
The token is invalid or expired. |
Create or rotate the fine-grained PAT and update the GitHub Advanced Connection. |
|
403 response |
A required permission is missing, token approval is pending, or the Copilot usage metrics policy is disabled. |
Review the token permissions, approval status, and Copilot usage metrics policy. |
|
404 response |
The organization is incorrect or the token has the wrong Resource owner. |
Verify the GitHub organization and the token's Resource owner. |
|
No report data for a day |
No qualifying Copilot activity was available for that date. |
Validate a date with known Copilot activity. |
|
Connection succeeds but expected data is missing |
The source report is unavailable or contains no qualifying activity. |
Review the GitHub source period and expected usage. |
|
Tokens are zero but AI credits are present |
The usage came from a Copilot surface that does not provide token data. |
This can be expected. Review the feature and usage type. |
|
Model or feature is unknown |
GitHub did not provide sufficient model or feature attribution. |
Review the source activity for the affected user and period. |
|
Latest Copilot usage data is several days behind |
GitHub needs time to process usage telemetry, and the scheduled Yarken pipeline run may introduce additional delay. |
Check the latest available GitHub report date, review the Advanced pipeline run history, and compare the reported period with GitHub source data. Yarken retrieves the latest available data without a fixed four-day offset. |
Security and credential management
-
Use a fine-grained personal access token rather than broader credentials.
-
Grant only the required organization permissions.
-
Use Read-only access for the required permissions.
-
Set a fixed expiration date and rotate the token before it expires.
-
Store the token in an approved secrets manager.
-
Never include the full token in documents, email, chat, support tickets, screenshots, or source code.
-
After token rotation, update the GitHub Advanced Connection, confirm it returns to Connected, and run the pipeline to validate the integration.
Related content