GitHub Copilot metrics
Port's GitHub Copilot integration allows you to ingest organization-level and enterprise-level GitHub Copilot usage metrics into your software catalog.
Prerequisites
GitHub token
Port's GitHub Copilot integration requires a classic GitHub token generated by organization owners or parent enterprise owners and billing managers with at least one of the following scopes enabled:
manage_billing:copilotread:orgread:enterprise
In addition, the Copilot Metrics API access policy must be enabled for the organization within GitHub settings.
Setup
Choose one of the following installation methods: Not sure which method is right for your use case? Check the available installation methods.
The prerequisites required for installation are listed below.
-
Go to the GitHub Copilot Connectors page in Port.
-
Under
Select your installation method, chooseHosted by Port. -
Configure the
Installation parametersandAdvanced configurationas you wish (see below for details).
Installation parameters
Each integration requires specific parameters (such as an API token, a URL, etc.), as seen in Port's UI when installing it. Hover over the ⓘ icon next to each parameter to see more details about it.
Advanced configuration
- During the installation process each integration may have additional settings under the
Advanced configurationsection in Port's UI. Additionally, each integration has one or more settings that can be configured after installation. To do so, click on the integration's name in the Connectors page and navigate to theSettingtab. Hover over the ⓘ icon next to each setting to see more details about it.
Port secrets
Some integration settings require sensitive pieces of data, such as tokens. For these settings, Port secrets will be used, ensuring that your sensitive data is encrypted and secure.
When filling in such a setting, its value will be obscured (shown as ••••••••).
For each such setting, Port will automatically create a secret in your organization.
To see all secrets in your organization, follow these steps.
Port source IP addresses
When using this installation method, Port will make outbound calls to your 3rd-party applications from static IP addresses. You may need to add these addresses to your allowlist, in order to allow Port to interact with the integrated service:
- Europe (EU):
54.73.167.226,63.33.143.237,54.76.185.219 - United States (US):
3.234.37.33,54.225.172.136,3.225.234.99
-
Go to the GitHub Copilot Connectors page in your portal.
-
Select the
Self-hostedmethod. -
A
helmcommand will be displayed, with default values already filled out (e.g. your Port client ID, client secret, etc). Copy the command, replace the placeholders with your values, then run it in your terminal to install the integration.
Live event support
Currently, live events are not supported for this integration.
Resyncs will be performed periodically (with a configurable interval), or manually triggered by you via Port's UI.
Therefore, real-time events (including GitOps) will not be ingested into Port immediately.
Live events support for this integration is WIP and will be supported in the near future.
The resync interval can be configured using the scheduledResyncInterval parameter. See the optional parameters section below for more details.
Required parameters:
port.clientId- Your Port client ID.port.clientSecret- Your Port client secret.port.baseUrl- Your Port API URL (https://api.port.iofor EU,https://api.us.port.iofor US).integration.identifier- A unique identifier for your integration.integration.type- The integration to be installed.integration.eventListener.type- The event listener type. Read more about event listeners.integration.secrets.githubToken- GitHub token used to query the GitHub API.integration.config.githubHost- The host of the GitHub API instance.integration.config.githubEnterpriseName- GitHub Enterprise account slug used for enterprise-level Copilot usage metrics endpoints. This is optional for organization level metrics.
Optional parameters (click to expand)
scheduledResyncInterval- The number of minutes between each resync. When not set the integration will resync for each event listener resync event.initializePortResources- Whentrue, the integration will create default blueprints and the Port App config mapping.sendRawDataExamples- Whentrue, sends raw data examples from the third-party API to Port for testing and managing the integration mapping.
- GitHub
- Jenkins
- Azure DevOps
- GitLab
- Go to the GitHub Copilot Connectors page in your portal.
- Under Select your installation method, choose your desired CI/CD platform.
- Copy the workflow and replace the placeholders with your values.
Below are the available parameters and their descriptions.
| Parameter | Description | Required? | Secret?Store this value as a GitHub Actions secret |
|---|---|---|---|
port_client_id | Your Port client ID (How to get the credentials). | ✓ | ✓ |
port_client_secret | Your Port client secret (How to get the credentials). | ✓ | ✓ |
port_base_url | Your Port API URL (https://api.port.io for EU, https://api.us.port.io for US). | ✓ | ✗ |
github_token | GitHub token used to query the GitHub API. | ✓ | ✓ |
github_enterprise_name | Optional GitHub Enterprise account slug used for enterprise-level Copilot usage metrics endpoints. | ✓ | ✓ |
initialize_port_resources | Default true. When set to true, the integration will create default blueprints and the Port app config mapping. | ✗ | ✗ |
integration_identifier | The identifier of the integration that will be installed. | ✗ | ✗ |
send_raw_data_examples | Enable sending raw data examples from the third-party API to Port for testing and managing the integration mapping. Default is true. | ✗ | ✗ |
Your Jenkins agent must be able to run Docker commands.
Below are the available parameters and their descriptions.
| Parameter | Description | Required? | Secret?Store this value as a Jenkins credential (Secret Text) |
|---|---|---|---|
OCEAN__ | Your Port client ID (How to get the credentials). | ✓ | ✓ |
OCEAN__ | Your Port client secret (How to get the credentials). | ✓ | ✓ |
OCEAN__ | Your Port API URL (https://api.port.io for EU, https://api.us.port.io for US). | ✓ | ✗ |
OCEAN__ | GitHub token used to query the GitHub API. | ✓ | ✓ |
OCEAN__ | Optional GitHub Enterprise account slug used for enterprise-level Copilot usage metrics endpoints. | ✓ | ✓ |
OCEAN__ | Default true. When set to true, the integration will create default blueprints and the Port app config mapping. | ✗ | ✗ |
OCEAN__ | The identifier of the integration that will be installed. | ✗ | ✗ |
OCEAN__ | Enable sending raw data examples from the third-party API to Port for testing and managing the integration mapping. Default is true. | ✗ | ✗ |
Here is an example for a Jenkinsfile pipeline file:Jenkins pipeline (click to expand)
Prerequisites
- Your Azure Devops agent should be able to run docker commands. Learn more about agents here.
- You must have permissions to create and manage Azure DevOps variable groups for storing credentials.
Set up your credentials
- Create a Variable Group: Name it port-ocean-credentials.
- Store the required variables (see the table below).
- Authorize Your Pipeline:
-
Go to "Library" -> "Variable groups."
-
Find port-ocean-credentials and click on it.
-
Select "Pipeline Permissions" and add your pipeline to the authorized list.
-
Below are the available parameters and their descriptions.
| Parameter | Description | Required? | Secret?Store this value as an Azure DevOps pipeline variable |
|---|---|---|---|
OCEAN__ | Your Port client ID (How to get the credentials). | ✓ | ✓ |
OCEAN__ | Your Port client secret (How to get the credentials). | ✓ | ✓ |
OCEAN__ | Your Port API URL (https://api.port.io for EU, https://api.us.port.io for US). | ✓ | ✗ |
OCEAN__ | GitHub token used to query the GitHub API. | ✓ | ✓ |
OCEAN__ | Optional GitHub Enterprise account slug used for enterprise-level Copilot usage metrics endpoints. | ✓ | ✓ |
OCEAN__ | Default true. When set to true, the integration will create default blueprints and the Port app config mapping. | ✗ | ✗ |
OCEAN__ | The identifier of the integration that will be installed. | ✗ | ✗ |
OCEAN__ | Enable sending raw data examples from the third-party API to Port for testing and managing the integration mapping. Default is true. | ✗ | ✗ |
Here is an example for a azure-pipeline.yml pipeline file:Azure pipeline (click to expand)
- Go to the GitHub Copilot Connectors page in your portal.
- Under Select your installation method, choose your desired CI/CD platform.
- Copy the workflow and replace the placeholders with your values.
Below are the available parameters and their descriptions.
| Parameter | Description | Required? | Secret?Store this value as a GitLab CI/CD variable |
|---|---|---|---|
OCEAN__ | Your Port client ID (How to get the credentials). | ✓ | ✓ |
OCEAN__ | Your Port client secret (How to get the credentials). | ✓ | ✓ |
OCEAN__ | Your Port API URL (https://api.port.io for EU, https://api.us.port.io for US). | ✓ | ✗ |
OCEAN__ | GitHub token used to query the GitHub API. | ✓ | ✓ |
OCEAN__ | Optional GitHub Enterprise account slug used for enterprise-level Copilot usage metrics endpoints. | ✓ | ✓ |
OCEAN__ | Default true. When set to true, the integration will create default blueprints and the Port app config mapping. | ✗ | ✗ |
OCEAN__ | The identifier of the integration that will be installed. | ✗ | ✗ |
OCEAN__ | Enable sending raw data examples from the third-party API to Port for testing and managing the integration mapping. Default is true. | ✗ | ✗ |
Configuration
Port integrations use a YAML mapping block to ingest data from the third-party api into Port.
The mapping makes use of the JQ JSON processor to select, modify, concatenate, transform and perform other operations on existing fields and values from the integration API.
Default mapping configuration
This is the default mapping configuration for this integration:
Default mapping configuration (click to expand)
entityDeletionThreshold: 0
resources:
- kind: organization-usage-metrics
selector:
query: 'true'
port:
entity:
mappings:
identifier: (.__organization.login + "@" + .day)
title: (.__organization.login + " copilot-metrics " + .day)
blueprint: '"githubCopilotOrganizationUsage"'
properties:
record_date: .day + "T00:00:00Z"
daily_active_users: .daily_active_users
weekly_active_users: .weekly_active_users
monthly_active_chat_users: .monthly_active_chat_users
monthly_active_agent_users: .monthly_active_agent_users
user_initiated_interaction_count: .user_initiated_interaction_count
code_generation_activity_count: .code_generation_activity_count
code_acceptance_activity_count: .code_acceptance_activity_count
loc_suggested_to_add_sum: .loc_suggested_to_add_sum
loc_added_sum: .loc_added_sum
loc_suggested_to_delete_sum: .loc_suggested_to_delete_sum
loc_deleted_sum: .loc_deleted_sum
prs_created_by_copilot: .pull_requests.total_created_by_copilot
prs_reviewed_by_copilot: .pull_requests.total_reviewed_by_copilot
prs_merged_by_copilot: .pull_requests.total_merged_created_by_copilot
total_copilot_applied_suggestions: .pull_requests.total_copilot_applied_suggestions
git_hub_org: .__organization.login
- kind: organization-user-usage-metrics
selector:
query: 'true'
port:
entity:
mappings:
identifier: (.user_login + "@" + .__organization.login + "@" + .day)
title: (.user_login + "@" + .__organization.login + "@" + .day)
blueprint: '"githubCopilotUserUsage"'
properties:
record_date: .day + "T00:00:00Z"
code_generation_activity_count: .code_generation_activity_count
code_acceptance_activity_count: .code_acceptance_activity_count
loc_suggested_to_add_sum: .loc_suggested_to_add_sum
loc_suggested_to_delete_sum: .loc_suggested_to_delete_sum
loc_added_sum: .loc_added_sum
loc_deleted_sum: .loc_deleted_sum
user_initiated_interaction_count: .user_initiated_interaction_count
git_hub_org: .__organization.login
used_agent: .used_agent
used_chat: .used_chat
username: .user_login
- kind: enterprise-usage-metrics
selector:
query: 'true'
port:
entity:
mappings:
identifier: (.__enterprise.slug + "@" + .day)
title: (.__enterprise.slug + " copilot-metrics " + .day)
blueprint: '"githubCopilotOrganizationUsage"'
properties:
record_date: .day + "T00:00:00Z"
daily_active_users: .daily_active_users
weekly_active_users: .weekly_active_users
monthly_active_agent_users: .monthly_active_agent_users
monthly_active_chat_users: .monthly_active_chat_users
user_initiated_interaction_count: .user_initiated_interaction_count
code_generation_activity_count: .code_generation_activity_count
code_acceptance_activity_count: .code_acceptance_activity_count
loc_suggested_to_add_sum: .loc_suggested_to_add_sum
loc_added_sum: .loc_added_sum
loc_suggested_to_delete_sum: .loc_suggested_to_delete_sum
loc_deleted_sum: .loc_deleted_sum
prs_created_by_copilot: .pull_requests.total_created_by_copilot
prs_reviewed_by_copilot: .pull_requests.total_reviewed_by_copilot
prs_merged_by_copilot: .pull_requests.total_merged_created_by_copilot
total_copilot_applied_suggestions: .pull_requests.total_copilot_applied_suggestions
- kind: enterprise-user-usage-metrics
selector:
query: 'true'
port:
entity:
mappings:
identifier: (.user_login + "@" + .__enterprise.slug + "@" + .day)
title: (.user_login + "@" + .__enterprise.slug + "@" + .day)
blueprint: '"githubCopilotUserUsage"'
properties:
record_date: .day + "T00:00:00Z"
code_generation_activity_count: .code_generation_activity_count
code_acceptance_activity_count: .code_acceptance_activity_count
loc_suggested_to_add_sum: .loc_suggested_to_add_sum
loc_suggested_to_delete_sum: .loc_suggested_to_delete_sum
loc_added_sum: .loc_added_sum
loc_deleted_sum: .loc_deleted_sum
user_initiated_interaction_count: .user_initiated_interaction_count
git_hub_org: .__enterprise.slug
used_agent: .used_agent
used_chat: .used_chat
username: .user_login
relations:
github_team:
combinator: '"and"'
rules:
- property: '"member_logins"'
operator: '"contains"'
value: .user_login
Mapping & selectors per resource
To view and test the integration's mapping against examples of the third-party API responses, use the jq playground in your connectors page. Find the integration in the list of connectors and click on it to open the playground.
{
"identifier": "githubCopilotOrganizationUsage",
"title": "Github Copilot Org Usage",
"icon": "Github",
"schema": {
"properties": {
"record_date": {
"title": "Record Date",
"type": "string",
"format": "date-time"
},
"daily_active_users": { "title": "Daily Active Users", "type": "number" },
"weekly_active_users": { "title": "Weekly Active Users", "type": "number" },
"monthly_active_users": { "title": "Monthly Active Users", "type": "number" },
"monthly_active_chat_users": { "title": "Monthly Active Chat Users", "type": "number" },
"monthly_active_agent_users": { "title": "Monthly Active Agent Users", "type": "number" },
"user_initiated_interaction_count": { "title": "User Initiated Interaction Count", "type": "number" },
"code_generation_activity_count": { "title": "Code Generation Activity Count", "type": "number" },
"code_acceptance_activity_count": { "title": "Code Acceptance Activity Count", "type": "number" },
"loc_suggested_to_add_sum": { "title": "LOC Suggested To Add", "type": "number" },
"loc_added_sum": { "title": "LOC Added", "type": "number" },
"loc_suggested_to_delete_sum": { "title": "LOC Suggested To Delete", "type": "number" },
"loc_deleted_sum": { "title": "LOC Deleted", "type": "number" },
"prs_created_by_copilot": { "title": "PRs Created by Copilot", "icon": "DefaultProperty", "type": "number" },
"prs_reviewed_by_copilot": { "title": "PRs Reviewed By Copilot", "icon": "DefaultProperty", "type": "number" },
"prs_merged_by_copilot": { "title": "PRs Merged By Copilot", "icon": "DefaultProperty", "type": "number" },
"total_copilot_applied_suggestions": { "title": "Total Suggestions Applied By Copilot", "type": "number" },
"git_hub_org": { "title": "GitHub Org", "type": "string" },
"daily_active_cli_users": { "title": "Daily Active CLI Users", "type": "number" },
"daily_active_copilot_cloud_agent_users": { "title": "Daily Active Cloud Agent Users", "type": "number" },
"weekly_active_copilot_cloud_agent_users": { "title": "Weekly Active Cloud Agent Users", "type": "number" },
"monthly_active_copilot_cloud_agent_users": { "title": "Monthly Active Cloud Agent Users", "type": "number" },
"daily_active_copilot_code_review_users": { "title": "Daily Active Code Review Users", "type": "number" },
"weekly_active_copilot_code_review_users": { "title": "Weekly Active Code Review Users", "type": "number" },
"monthly_active_copilot_code_review_users": { "title": "Monthly Active Code Review Users", "type": "number" },
"daily_passive_copilot_code_review_users": { "title": "Daily Passive Code Review Users", "type": "number" },
"weekly_passive_copilot_code_review_users": { "title": "Weekly Passive Code Review Users", "type": "number" },
"monthly_passive_copilot_code_review_users": { "title": "Monthly Passive Code Review Users", "type": "number" },
"totals_by_ide": { "title": "Totals by IDE", "type": "array" },
"totals_by_feature": { "title": "Totals by Feature", "type": "array" },
"totals_by_language_feature": { "title": "Totals by Language & Feature", "type": "array" },
"totals_by_language_model": { "title": "Totals by Language & Model", "type": "array" },
"totals_by_model_feature": { "title": "Totals by Model & Feature", "type": "array" },
"totals_by_ai_adoption_phase": { "title": "Totals by AI Adoption Phase", "type": "array" },
"pull_requests": { "title": "Pull Requests", "type": "object" },
"totals_by_cli": { "title": "Totals by CLI", "type": "object" }
},
"required": []
},
"mirrorProperties": {},
"calculationProperties": {
"acceptance_rate": {
"title": "Acceptance Rate",
"icon": "DefaultProperty",
"calculation": "if (.properties.code_generation_activity_count == 0) then 0 else ((.properties.code_acceptance_activity_count / .properties.code_generation_activity_count) * 100 | round) end",
"type": "number"
}
},
"aggregationProperties": {},
"relations": {}
}
- kind: organization-usage-metrics
selector:
query: 'true'
port:
entity:
mappings:
identifier: (.__organization.login + "@" + .day)
blueprint: '"githubCopilotOrganizationUsage"'
title: (.__organization.login + " copilot-metrics " + .day)
properties:
record_date: .day + "T00:00:00Z"
daily_active_users: .daily_active_users
weekly_active_users: .weekly_active_users
monthly_active_users: .monthly_active_users
monthly_active_chat_users: .monthly_active_chat_users
monthly_active_agent_users: .monthly_active_agent_users
daily_active_cli_users: .daily_active_cli_users
daily_active_copilot_cloud_agent_users: .daily_active_copilot_cloud_agent_users
weekly_active_copilot_cloud_agent_users: .weekly_active_copilot_cloud_agent_users
monthly_active_copilot_cloud_agent_users: .monthly_active_copilot_cloud_agent_users
daily_active_copilot_code_review_users: .daily_active_copilot_code_review_users
weekly_active_copilot_code_review_users: .weekly_active_copilot_code_review_users
monthly_active_copilot_code_review_users: .monthly_active_copilot_code_review_users
daily_passive_copilot_code_review_users: .daily_passive_copilot_code_review_users
weekly_passive_copilot_code_review_users: .weekly_passive_copilot_code_review_users
monthly_passive_copilot_code_review_users: .monthly_passive_copilot_code_review_users
user_initiated_interaction_count: .user_initiated_interaction_count
code_generation_activity_count: .code_generation_activity_count
code_acceptance_activity_count: .code_acceptance_activity_count
loc_suggested_to_add_sum: .loc_suggested_to_add_sum
loc_added_sum: .loc_added_sum
loc_suggested_to_delete_sum: .loc_suggested_to_delete_sum
loc_deleted_sum: .loc_deleted_sum
prs_created_by_copilot: .pull_requests.total_created_by_copilot
prs_reviewed_by_copilot: .pull_requests.total_reviewed_by_copilot
prs_merged_by_copilot: .pull_requests.total_merged_created_by_copilot
total_copilot_applied_suggestions: .pull_requests.total_copilot_applied_suggestions
git_hub_org: .__organization.login
totals_by_ide: .totals_by_ide
totals_by_feature: .totals_by_feature
totals_by_language_feature: .totals_by_language_feature
totals_by_language_model: .totals_by_language_model
totals_by_model_feature: .totals_by_model_feature
totals_by_ai_adoption_phase: .totals_by_ai_adoption_phase
pull_requests: .pull_requests
totals_by_cli: .totals_by_cli
{
"day": "2026-03-05",
"organization_id": "216844958",
"enterprise_id": "232528",
"daily_active_users": 3,
"weekly_active_users": 5,
"monthly_active_users": 5,
"monthly_active_chat_users": 4,
"monthly_active_agent_users": 3,
"user_initiated_interaction_count": 0,
"code_generation_activity_count": 187,
"code_acceptance_activity_count": 48,
"totals_by_ide": [
{
"ide": "neovim",
"user_initiated_interaction_count": 0,
"code_generation_activity_count": 185,
"code_acceptance_activity_count": 47,
"loc_suggested_to_add_sum": 250,
"loc_suggested_to_delete_sum": 0,
"loc_added_sum": 66,
"loc_deleted_sum": 0
},
{
"ide": "intellij",
"user_initiated_interaction_count": 0,
"code_generation_activity_count": 2,
"code_acceptance_activity_count": 1,
"loc_suggested_to_add_sum": 2,
"loc_suggested_to_delete_sum": 0,
"loc_added_sum": 1,
"loc_deleted_sum": 0
}
],
"totals_by_feature": [
{
"feature": "code_completion",
"user_initiated_interaction_count": 0,
"code_generation_activity_count": 187,
"code_acceptance_activity_count": 48,
"loc_suggested_to_add_sum": 252,
"loc_suggested_to_delete_sum": 0,
"loc_added_sum": 67,
"loc_deleted_sum": 0
}
],
"totals_by_language_feature": [
{
"language": "python",
"feature": "code_completion",
"code_generation_activity_count": 167,
"code_acceptance_activity_count": 47,
"loc_suggested_to_add_sum": 232,
"loc_suggested_to_delete_sum": 0,
"loc_added_sum": 66,
"loc_deleted_sum": 0
},
{
"language": "dotenv",
"feature": "code_completion",
"code_generation_activity_count": 5,
"code_acceptance_activity_count": 1,
"loc_suggested_to_add_sum": 5,
"loc_suggested_to_delete_sum": 0,
"loc_added_sum": 1,
"loc_deleted_sum": 0
},
{
"language": "markdown",
"feature": "code_completion",
"code_generation_activity_count": 6,
"code_acceptance_activity_count": 0,
"loc_suggested_to_add_sum": 6,
"loc_suggested_to_delete_sum": 0,
"loc_added_sum": 0,
"loc_deleted_sum": 0
},
{
"language": "yaml",
"feature": "code_completion",
"code_generation_activity_count": 5,
"code_acceptance_activity_count": 0,
"loc_suggested_to_add_sum": 5,
"loc_suggested_to_delete_sum": 0,
"loc_added_sum": 0,
"loc_deleted_sum": 0
},
{
"language": "typescript",
"feature": "code_completion",
"code_generation_activity_count": 3,
"code_acceptance_activity_count": 0,
"loc_suggested_to_add_sum": 3,
"loc_suggested_to_delete_sum": 0,
"loc_added_sum": 0,
"loc_deleted_sum": 0
},
{
"language": "toml",
"feature": "code_completion",
"code_generation_activity_count": 1,
"code_acceptance_activity_count": 0,
"loc_suggested_to_add_sum": 1,
"loc_suggested_to_delete_sum": 0,
"loc_added_sum": 0,
"loc_deleted_sum": 0
}
],
"totals_by_language_model": [],
"totals_by_model_feature": [],
"loc_suggested_to_add_sum": 252,
"loc_suggested_to_delete_sum": 0,
"loc_added_sum": 67,
"loc_deleted_sum": 0,
"pull_requests": {
"total_reviewed": 0,
"total_created": 0,
"total_created_by_copilot": 0,
"total_reviewed_by_copilot": 0,
"total_merged": 0,
"total_suggestions": 0,
"total_applied_suggestions": 0,
"total_merged_created_by_copilot": 0,
"total_copilot_suggestions": 0,
"total_copilot_applied_suggestions": 0
},
"__organization": {
"login": "idp-app-dev",
"id": 216844958,
"node_id": "O_kgDODOzKng",
"url": "https://api.github.com/orgs/idp-app-dev",
"repos_url": "https://api.github.com/orgs/idp-app-dev/repos",
"events_url": "https://api.github.com/orgs/idp-app-dev/events",
"hooks_url": "https://api.github.com/orgs/idp-app-dev/hooks",
"issues_url": "https://api.github.com/orgs/idp-app-dev/issues",
"members_url": "https://api.github.com/orgs/idp-app-dev/members{/member}",
"public_members_url": "https://api.github.com/orgs/idp-app-dev/public_members{/member}",
"avatar_url": "https://avatars.githubusercontent.com/u/216844958?v=4",
"description": ""
}
}
The github_team relation on enterprise user usage metrics requires the GitHub integration to be installed and syncing githubTeam entities with the member_logins property populated.
Monitoring and sync status
To learn more about how to monitor and check the sync status of your integration, see the relevant documentation.
Track AI credit cost
GitHub's Copilot usage metrics API includes an ai_credits_used field on user-level reports. It is the total AI credits a user consumed for that day, across all Copilot activity. The field is available on both organization and enterprise user reports. See GitHub's changelog announcement.
You can map that field into a dedicated blueprint to monitor spend, compare consumption across users, and estimate USD cost next to request volume.
ai_credits_used is an overall per-user total. GitHub does not break it down by feature, model, or surface. Treat amount as a consumption estimate for analysis, not an invoice line. The mapping multiplies credits by 0.01 to store an estimated USD value.
Add this mapping in addition to the default organization-user-usage-metrics (or enterprise-user-usage-metrics) block. Ocean can ingest the same kind twice into different blueprints.
Create the cost usage blueprint
-
Go to the data model page in Port.
-
Click + Blueprint.
-
Click the
{...} Edit JSONbutton. -
Copy and paste the following JSON configuration:
GitHub Copilot cost usage blueprint (click to expand)
{"identifier": "githubCopilotCostUsage","description": "Per-user USD cost across a date range","title": "GitHub Copilot Cost Usage","icon": "GithubCopilot","schema": {"properties": {"record_date": {"type": "string","format": "date-time","title": "Range Start (UTC)"},"range_end": {"type": "string","format": "date-time","title": "Range End (UTC)"},"user_name": {"type": "string","title": "User Name"},"currency": {"type": "string","title": "Currency"},"amount": {"type": "number","title": "AI Credit Amount"},"requests": {"type": "number","title": "Requests"}},"required": ["record_date"]},"mirrorProperties": {},"calculationProperties": {},"aggregationProperties": {},"relations": {}} -
Click Save.
Add the mapping
- Go to the connectors page in Port.
- Open your GitHub Copilot integration and select the Mapping tab.
- Add one of the following resource blocks, then click Save & Resync.
- Organization
- Enterprise
Organization cost mapping (click to expand)
- kind: organization-user-usage-metrics
selector:
query: 'true'
port:
entity:
mappings:
identifier: (.user_login + "@" + .__organization.login + "@" + .day)
title: (.user_login + "@" + .__organization.login + "@" + .day)
blueprint: '"githubCopilotCostUsage"'
properties:
record_date: .report_start_day + "T00:00:00Z"
range_end: .report_end_day + "T00:00:00Z"
user_name: .user_login
currency: '"USD"'
amount: (.ai_credits_used * 0.01)
requests: .user_initiated_interaction_count
Enterprise cost mapping (click to expand)
- kind: enterprise-user-usage-metrics
selector:
query: 'true'
port:
entity:
mappings:
identifier: (.user_login + "@" + .__enterprise.slug + "@" + .day)
title: (.user_login + "@" + .__enterprise.slug + "@" + .day)
blueprint: '"githubCopilotCostUsage"'
properties:
record_date: .report_start_day + "T00:00:00Z"
range_end: .report_end_day + "T00:00:00Z"
user_name: .user_login
currency: '"USD"'
amount: (.ai_credits_used * 0.01)
requests: .user_initiated_interaction_count
Migration Guide
This guide covers the migration from the legacy copilot-organization-metrics kind to the new organization-usage-metrics kind. GitHub shut down the legacy Copilot Metrics API on April 2, 2026.
What changed
- The
copilot-organization-metricskind was replaced byorganization-usage-metrics, which uses a new blueprint (githubCopilotOrganizationUsage) and features a restructured schema. - GitHub discontinued support for team-level metrics. As a result, the
copilot-team-metricskind stopped functioning after the sunset date. There is no replacement for this functionality in the new API or the integration.
Migrate from copilot-organization-metrics
1. Add the new blueprint
Ensure you have the githubCopilotOrganizationUsage blueprint in Port. You can find the blueprint definition in the Organization usage metrics section above.
2. Add the new integration mapping
In your Port connector configuration, add the organization-usage-metrics kind. You can find the full mapping in the organization-usage-metrics resource section above.
3. Verify token permissions
Ensure you are using a classic PAT (fine-grained PATs are not supported) with at least one of the following scopes: manage_billing:copilot or read:enterprise. The token must be generated by an Enterprise Administrator or Billing Manager, or a user with the proper fine-grained permissions to access Copilot metrics. Also confirm that the "Copilot usage metrics" policy is set to Enabled everywhere in your enterprise settings under AI Controls -> Copilot -> Metrics.
4. Remove legacy kinds
Once data is flowing correctly via organization-usage-metrics, remove both copilot-organization-metrics and copilot-team-metrics from your mapping. Note that copilot-team-metrics has no replacement — it is simply being removed.
Entities already ingested under the github_copilot_usage blueprint will not be automatically deleted. A resync will auto-reconcile the environment.