You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: load and log Copilot plan info from copilot_internal/user API (#687)
* feat: load and log Copilot plan info from copilot_internal/user API
After a GitHub session is established (startup restore, manual sign-in,
or external session change), fire-and-forget fetch of
https://api.github.com/copilot_internal/user to log the user's
Copilot plan details (plan type, IDE chat, agent mode, public code
suggestions, PR summaries) to the output channel.
- Add CopilotPlanInfo type, fetchCopilotPlanInfoPage (internal) and
fetchCopilotPlanInfo (exported with injectable fetcher for tests) to
githubPrService.ts
- Add CopilotTokenTracker.loadAndLogCopilotPlanInfo() that calls the
fetcher and logs key plan fields; non-2xx responses and network errors
are surfaced as warnings (best-effort, no impact on startup)
- Wire void calls from restoreGitHubSession, authenticateWithGitHub, and
the onDidChangeSessions handler so plan info refreshes on session change
- Add 6 unit tests covering success, 401/403, network error, invalid
response format, and partial data
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* feat: add copilotPlans.json with plan names and monthly premium request allotments
Add a new data file mapping copilot_plan API values to display names,
monthly prices, and premium request allotments (as of 2026-04-27):
free → Copilot Free → 50 premium requests/month
individual → Copilot Pro → 300 premium requests/month
pro → Copilot Pro → 300 premium requests/month
pro_plus → Copilot Pro+ → 1500 premium requests/month
business → Copilot Business → 300 premium requests/month
enterprise → Copilot Enterprise → 1000 premium requests/month
Update loadAndLogCopilotPlanInfo() to look up the plan from the new
file and include the human-readable name and credit allotment in the
output log line, e.g.:
Copilot plan: Copilot Enterprise (enterprise)
Monthly premium requests: 1,000/month
Document the new file in vscode-extension/src/README.md.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* feat: add monthlyAiCreditsUsd to copilotPlans.json and log it
Each plan now records the dollar value of AI credits included per
month (1 AI credit = \.01):
free → \ (none)
pro → \/month
pro_plus → \/month
business → \/month
enterprise → \/month
Update loadAndLogCopilotPlanInfo() to include the AI credits line:
Monthly AI credits: \/month included
Update README table and metadata notes.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* feat: show Copilot plan name and included AI credits in details table
Store the resolved plan from copilot_internal/user on the tracker
(_copilotPlanResolved) and pass it to the details webview via
window.__INITIAL_DETAILS__.copilotPlan.
In the metrics table, two new rows appear after 'Estimated cost (TBB)'
when a plan is known — only for the 'Last 30 Days' and 'Previous Month'
columns (Today/Projected show '—' since the allotment is per-month):
🏷️ Copilot plan — Copilot Enterprise Copilot Enterprise —
💳 Included AI credits — \ \ —
Both rows include tooltips. Rows are omitted entirely when the plan
has not yet been loaded (e.g. user not signed in to GitHub).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* refactor: merge Copilot plan and AI credits into a single table row
Combine the two rows into one: 'Copilot plan' now shows
'Copilot Enterprise (\ credits)' in the Last 30 Days and
Previous Month columns instead of separate plan/credits rows.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* refactor: move Copilot plan info to label column
Show 'Copilot Enterprise (\ credits/month)' in the row label
and '—' in all value columns for a cleaner look.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy file name to clipboardExpand all lines: vscode-extension/src/README.md
+35Lines changed: 35 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,41 @@
2
2
3
3
This directory contains JSON configuration files for the GitHub Copilot Token Tracker extension.
4
4
5
+
## copilotPlans.json
6
+
7
+
Contains GitHub Copilot plan definitions — the `plans` object keys match the `copilot_plan` value returned by the `copilot_internal/user` API endpoint.
8
+
9
+
**Structure:**
10
+
```json
11
+
{
12
+
"plans": {
13
+
"<plan-id>": {
14
+
"name": "Display name",
15
+
"monthlyPricePerUser": 10,
16
+
"monthlyPremiumRequests": 300,
17
+
"codeCompletionsPerMonth": null,
18
+
"description": "..."
19
+
}
20
+
}
21
+
}
22
+
```
23
+
24
+
-`monthlyPremiumRequests` — included allotment per user per month; extra requests are $0.04 each
25
+
-`monthlyAiCreditsUsd` — dollar value of AI credits included with the plan (1 AI credit = $0.01); `0` = none included
**How to update:** Edit the `plans` object when GitHub changes pricing or adds plans. Update `metadata.lastUpdated` and reference the [official plans page](https://docs.github.com/en/copilot/get-started/plans).
39
+
5
40
## tokenEstimators.json
6
41
7
42
Contains character-to-token ratio estimators for different AI models. These ratios are used to estimate token counts from text length.
"description": "GitHub Copilot plan definitions. Keys match the value of the 'copilot_plan' field returned by the copilot_internal/user API endpoint.",
"notes": "monthlyPremiumRequests is the included allotment per user per month. null means unlimited. Extra premium requests beyond the allotment are billed at $0.04 each. Code completions (tab completions) do not consume premium requests on paid plans. monthlyAiCreditsUsd is the dollar value of AI credits included with the plan (1 AI credit = $0.01)."
8
+
},
9
+
"plans": {
10
+
"free": {
11
+
"name": "Copilot Free",
12
+
"monthlyPricePerUser": 0,
13
+
"monthlyAiCreditsUsd": 0,
14
+
"monthlyPremiumRequests": 50,
15
+
"codeCompletionsPerMonth": 2000,
16
+
"description": "Limited plan for light use and evaluation"
17
+
},
18
+
"individual": {
19
+
"name": "Copilot Pro",
20
+
"monthlyPricePerUser": 10,
21
+
"monthlyAiCreditsUsd": 10,
22
+
"monthlyPremiumRequests": 300,
23
+
"codeCompletionsPerMonth": null,
24
+
"description": "For individual developers (legacy plan ID, same as 'pro')"
25
+
},
26
+
"pro": {
27
+
"name": "Copilot Pro",
28
+
"monthlyPricePerUser": 10,
29
+
"monthlyAiCreditsUsd": 10,
30
+
"monthlyPremiumRequests": 300,
31
+
"codeCompletionsPerMonth": null,
32
+
"description": "For individual developers"
33
+
},
34
+
"pro_plus": {
35
+
"name": "Copilot Pro+",
36
+
"monthlyPricePerUser": 39,
37
+
"monthlyAiCreditsUsd": 39,
38
+
"monthlyPremiumRequests": 1500,
39
+
"codeCompletionsPerMonth": null,
40
+
"description": "For power users needing more premium requests and the broadest model selection"
41
+
},
42
+
"business": {
43
+
"name": "Copilot Business",
44
+
"monthlyPricePerUser": 19,
45
+
"monthlyAiCreditsUsd": 19,
46
+
"monthlyPremiumRequests": 300,
47
+
"codeCompletionsPerMonth": null,
48
+
"description": "For organizations; includes policy controls and audit logs"
49
+
},
50
+
"enterprise": {
51
+
"name": "Copilot Enterprise",
52
+
"monthlyPricePerUser": 39,
53
+
"monthlyAiCreditsUsd": 39,
54
+
"monthlyPremiumRequests": 1000,
55
+
"codeCompletionsPerMonth": null,
56
+
"description": "For large organizations on GitHub Enterprise Cloud; includes custom models and expanded controls"
labelTooltip: `Your active GitHub Copilot subscription plan (ID: ${stats.copilotPlan.planId}). Included AI credits cover token-based billing (1 AI credit = $0.01).`,
0 commit comments