Skip to content

Add support for usage-based billing#312892

Merged
pwang347 merged 41 commits intomainfrom
lramos15/token-based-billing
Apr 28, 2026
Merged

Add support for usage-based billing#312892
pwang347 merged 41 commits intomainfrom
lramos15/token-based-billing

Conversation

@pwang347
Copy link
Copy Markdown
Member

No description provided.

lramos15 and others added 30 commits April 17, 2026 12:40
Standardize severity colors and tighten typography/spacing across the
chat status dashboard, chat input notification banner, and chat context
usage details hover.

Color tokens (accessibility & theme correctness)
- Use editorWarning-foreground / editorError-foreground / focusBorder
  for severity foregrounds (icons, borders, bar fills). These tokens
  are AA-validated by core across light, dark, and HC themes.
- Replace 20%-transparent severity overlays with editorWidget-border
  for bar tracks. Avoids opacity-blending pitfalls and stays visible
  in HC themes.
- Use color-mix(... 6%, var(--vscode-editorWidget-background)) for
  subtle banner/callout background tints so they degrade gracefully
  in HC (fall back to widget background) instead of resolving to
  Color.white via the gauge.* tokens.
- Color the percent value text with --vscode-foreground (always AA);
  severity is conveyed via the icon, bar fill, and border per
  WCAG 1.4.1.

Chat status dashboard (chatStatus.css)
- 16px outer padding, widened to 380-440px.
- SKU header: 13px / 400 / foreground with a 12px bottom rule.
- Quota title: 13px / 600 / foreground; meta in descriptionForeground.
- Big % value: 20px / 700 / foreground.
- 24px spacing between quota rows (16px before the upgrade row).
- Bars: 4px tall, 4px radius on a editorWidget-border track.
- Quick Settings header: foreground / 13px (sharper than before).
- Description text bumped to 12px for legibility.
- Replaced opacity-based dimming with descriptionForeground.

Chat input notification banner (chatInputNotificationWidget.css)
- 12x16 padding, 4px inner gap, 8px header icon/title gap.
- 4px top margin on the description so the title/bar/% group stays
  tight while the description (e.g. "Copilot will pause...") gets
  a touch of separation.
- Severity-info / -warning / -error variants now use the same color
  pattern as the dashboard.

Chat context usage details (chatContextUsageDetails.css)
- Quota bar track switched to editorWidget-border; severity fills use
  the editorWarning/editorError tokens.
- Output-buffer striping uses the same severity tokens so legend and
  bar match across info / warning / error states.
…d-billing

# Conflicts:
#	extensions/copilot/src/util/common/test/shims/vscodeTypesShim.ts
- Lighter, regular-weight quota titles (Monthly Limit, Inline Suggestions, etc.)
- Remove dimmed state so 0% and 100% render identically
- Tighten dashboard width (320–360px)
- Even out vertical rhythm across quota indicators and dividers
- Clean up Quick Settings spacing: uniform row gaps, consistent min-heights, zeroed hr margins
Copilot AI review requested due to automatic review settings April 27, 2026 19:58
@github-actions
Copy link
Copy Markdown
Contributor

⚠️ API Proposal Version Change Detected

The following proposed API files have version changes: vscode.proposed.chatProvider.d.ts

API proposal version changes should only be used when maintaining compatibility is not possible. Consider keeping the version as is and maintaining backward compatibility.

Any version changes must be adopted by the consuming extensions before the next insiders for the extension to work.


If the version change is required, comment /api-proposal-change-required to unblock this check and acknowledge that you will update any critical consuming extensions (Copilot Chat).

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 27, 2026

Screenshot Changes

Base: 6c2bbf76 Current: ef469303

Changed (4)

editor/inlineChatZoneWidget/InlineChatZoneWidgetTerminated/Dark
Before After
before after
editor/inlineChatZoneWidget/InlineChatZoneWidgetTerminated/Light
Before After
before after
editor/inlineChatZoneWidget/InlineChatZoneWidget/Dark
Before After
before after
editor/inlineChatZoneWidget/InlineChatZoneWidget/Light
Before After
before after

Removed (14)

chat/input/chatInput/Full/Dark

baseline

chat/input/chatInput/Default/Dark

baseline

chat/input/chatInput/Default/Light

baseline

chat/input/chatInput/WithArtifacts/Dark

baseline

chat/input/chatInput/WithArtifacts/Light

baseline

chat/input/chatInput/WithFileChanges/Dark

baseline

chat/input/chatInput/WithFileChanges/Light

baseline

chat/input/chatInput/WithTodos/Dark

baseline

chat/input/chatInput/WithTodos/Light

baseline

chat/input/chatInput/WithTodosAndFileChanges/Dark

baseline

chat/input/chatInput/WithTodosAndFileChanges/Light

baseline

chat/input/chatInput/WithArtifactsAndFileChanges/Dark

baseline

chat/input/chatInput/WithArtifactsAndFileChanges/Light

baseline

chat/input/chatInput/Full/Light

baseline


blocks-ci screenshots changed

Replace the contents of test/componentFixtures/blocks-ci-screenshots.md with:

Updated blocks-ci-screenshots.md
<!-- auto-generated by CI — do not edit manually -->

#### editor/codeEditor/CodeEditor/Dark
![screenshot](https://hediet-screenshots.azurewebsites.net/images/cb32a3e854b5734fe5aaca2318f2e0a42ee821b05ea97883ea42c5ba95edb3c3)

#### editor/codeEditor/CodeEditor/Light
![screenshot](https://hediet-screenshots.azurewebsites.net/images/42624fbba5e0db7f32c224b5eb9c5dd3b08245697ae2e7d2a88be0d7c287129b)

#### editor/inlineChatZoneWidget/InlineChatZoneWidget/Dark
![screenshot](https://hediet-screenshots.azurewebsites.net/images/4baed4b05eeb8aadc8bc2dc633abfc87054cdeea4c35b7a655766063bcfedfed)

#### editor/inlineChatZoneWidget/InlineChatZoneWidget/Light
![screenshot](https://hediet-screenshots.azurewebsites.net/images/b9d098d8ccc2bdb6b816537f14b1f1f3c10dadf294fc0b28d03d6e5a34eaf4c8)

#### editor/inlineChatZoneWidget/InlineChatZoneWidgetTerminated/Dark
![screenshot](https://hediet-screenshots.azurewebsites.net/images/4baed4b05eeb8aadc8bc2dc633abfc87054cdeea4c35b7a655766063bcfedfed)

#### editor/inlineChatZoneWidget/InlineChatZoneWidgetTerminated/Light
![screenshot](https://hediet-screenshots.azurewebsites.net/images/b9d098d8ccc2bdb6b816537f14b1f1f3c10dadf294fc0b28d03d6e5a34eaf4c8)

@pwang347
Copy link
Copy Markdown
Member Author

/api-proposal-change-required

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds token-based billing and quota UX support across the VS Code workbench, the Sessions window, and the built-in Copilot extension by introducing pricing metadata for language models and a new chat input notification surface for quota/rate-limit messaging.

Changes:

  • Adds a proposed API for model pricing labels and wires pricing metadata through language model providers into the model management UI.
  • Reworks quota snapshot handling to support token-based billing fields (e.g. reset timestamps, token-based billing flag) and updates related UI/telemetry.
  • Introduces a proposed API + implementation for chat input notifications, replacing the previous “status widget” approach and integrating into both Workbench and Sessions UI.
Show a summary per file
File Description
src/vscode-dts/vscode.proposed.languageModelPricing.d.ts New proposed API surface for model pricing labels.
src/vscode-dts/vscode.proposed.chatProvider.d.ts Bumps proposal version and adjusts model cost metadata shape/docs.
src/vscode-dts/vscode.proposed.chatInputNotification.d.ts New proposed API for chat input notifications.
src/vs/workbench/services/chat/common/chatEntitlementService.ts Updates quota snapshot shape for token-based billing + moves overage fields to aggregate quotas.
src/vs/workbench/contrib/chat/common/languageModels.ts Swaps model metadata from multiplier label to pricing label.
src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/media/chatContextUsageDetails.css Updates quota indicator styling colors.
src/vs/workbench/contrib/chat/browser/widget/input/media/chatStatusWidget.css Removes old quota-exceeded status widget styles.
src/vs/workbench/contrib/chat/browser/widget/input/media/chatInputNotificationWidget.css Adds styling for the new chat input notification banner (Workbench).
src/vs/workbench/contrib/chat/browser/widget/input/chatStatusWidget.ts Removes old quota-exceeded status widget implementation.
src/vs/workbench/contrib/chat/browser/widget/input/chatModelPicker.ts Updates model picker description composition (removes multiplier label usage).
src/vs/workbench/contrib/chat/browser/widget/input/chatInputPartWidgets.ts Removes generic “input part widgets” registry/controller.
src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.ts Integrates notification widget container + auto-dismiss on send.
src/vs/workbench/contrib/chat/browser/widget/input/chatInputNotificationWidget.ts Implements the notification banner widget rendering + actions/dismiss.
src/vs/workbench/contrib/chat/browser/widget/input/chatInputNotificationService.ts Adds singleton service to manage notifications and selection logic.
src/vs/workbench/contrib/chat/browser/chatStatus/media/chatStatus.css Updates status dashboard tooltip styling and quota visuals.
src/vs/workbench/contrib/chat/browser/chatStatus/chatStatusDashboard.ts Refactors dashboard layout (collapsible quick settings), updates quota/overage display, stores collapse state.
src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsWidget.ts Updates model management UI to show “Pricing” instead of multiplier.
src/vs/workbench/contrib/chat/browser/chat.contribution.ts Registers new chat input notification service (replaces old widget import).
src/vs/workbench/api/common/extHostTypes.ts Adds ChatInputNotificationSeverity enum to ext host types.
src/vs/workbench/api/common/extHostLanguageModels.ts Wires pricing metadata through ext host language model plumbing.
src/vs/workbench/api/common/extHostChatInputNotification.ts Implements ext host-side ChatInputNotification object + syncing to main thread.
src/vs/workbench/api/common/extHost.protocol.ts Adds DTOs and main-thread shape for chat input notifications.
src/vs/workbench/api/common/extHost.api.impl.ts Exposes chat.createInputNotification (proposed) and severity enum to API surface.
src/vs/workbench/api/browser/mainThreadChatInputNotification.ts Main thread bridge: persists notification DTOs into the notification service.
src/vs/workbench/api/browser/extensionHost.contribution.ts Registers the new main-thread chat input notification actor.
src/vs/sessions/electron-browser/sessions-dev.html Extends dev CSP connect-src to allow localhost HTTP.
src/vs/sessions/contrib/chat/browser/newChatInput.ts Adds notification banner above the Sessions new-chat input area.
src/vs/sessions/contrib/chat/browser/media/chatInput.css Adds Sessions-specific container styling for the notification banner.
src/vs/sessions/contrib/accountMenu/test/browser/accountTitleBarState.test.ts Updates tests for revised quota snapshot shape.
src/vs/sessions/contrib/accountMenu/browser/media/accountTitleBarWidget.css Increases sessions account titlebar panel width.
src/vs/sessions/contrib/accountMenu/browser/account.contribution.ts Updates constant width for the sessions account panel.
src/vs/platform/hover/browser/hoverWidget.ts Adds ResizeObserver-based layout refresh for dynamic HTML hover content.
src/vs/platform/extensions/common/extensionsApiProposals.ts Registers new proposals: chatInputNotification + languageModelPricing; bumps chatProvider proposal version.
src/vs/code/electron-browser/workbench/workbench-dev.html Extends dev CSP connect-src to allow localhost HTTP.
src/vs/base/common/defaultAccount.ts Updates quota snapshot DTO shape (adds reset/token billing fields; removes legacy fields).
extensions/copilot/src/vscodeTypes.ts Re-exports ChatInputNotificationSeverity for Copilot code.
extensions/copilot/src/util/common/test/shims/vscodeTypesShim.ts Adds shim export for ChatInputNotificationSeverity.
extensions/copilot/src/util/common/test/shims/chatTypes.ts Adds shim enum for ChatInputNotificationSeverity.
extensions/copilot/src/platform/networking/common/networking.ts Adds normalized tokenPricing to chat endpoint interface.
extensions/copilot/src/platform/endpoint/node/chatEndpoint.ts Implements token price normalization and exposes tokenPricing.
extensions/copilot/src/platform/endpoint/node/autoChatEndpoint.ts Makes multiplier discount logic handle undefined multiplier safely.
extensions/copilot/src/platform/endpoint/common/endpointProvider.ts Expands billing metadata shape (optional multiplier/is_premium + token_prices).
extensions/copilot/src/platform/chat/common/chatQuotaServiceImpl.ts Replaces “consume warning” flow with onDidChange-driven quota/rate-limit updates.
extensions/copilot/src/platform/chat/common/chatQuotaService.ts Updates service contract to expose events and current quota/rate-limit info.
extensions/copilot/src/extension/vscode-api.d.ts References new proposed chatInputNotification API types for Copilot extension build.
extensions/copilot/src/extension/prompt/node/chatParticipantRequestHandler.ts Avoids rendering multiplier detail when multiplier is undefined.
extensions/copilot/src/extension/externalAgents/node/oaiLanguageModelServer.ts Passes through tokenPricing on endpoint wrapper.
extensions/copilot/src/extension/extension/vscode-node/contributions.ts Registers ChatInputNotificationContribution.
extensions/copilot/src/extension/conversation/vscode-node/remoteAgents.ts Makes billing metadata optional in remote agent model info.
extensions/copilot/src/extension/conversation/vscode-node/languageModelAccess.ts Emits pricing label (multiplier label or token pricing) into model metadata.
extensions/copilot/src/extension/conversation/vscode-node/chatParticipants.ts Removes inline stream warning injection (moved to notification system).
extensions/copilot/src/extension/conversation/common/languageModelAccess.ts Adds formatting helpers for pricing labels.
extensions/copilot/src/extension/chatSessions/vscode-node/copilotCloudSessionsProvider.ts Makes model option description conditional on multiplier presence.
extensions/copilot/src/extension/chatSessions/claude/node/claudeLanguageModelServer.ts Passes through tokenPricing on endpoint wrapper.
extensions/copilot/src/extension/chatSessions/claude/node/claudeCodeModels.ts Emits pricing label + tooltip for Claude code models.
extensions/copilot/src/extension/chatInputNotification/vscode-node/chatInputNotification.contribution.ts New contribution showing quota/rate-limit notifications in the chat input UI.
extensions/copilot/package.json Enables new proposals and bumps @vscode/copilot-api dependency.
extensions/copilot/package-lock.json Locks updated @vscode/copilot-api version.

Copilot's findings

Files not reviewed (1)
  • extensions/copilot/package-lock.json: Language not supported
Comments suppressed due to low confidence (1)

src/vs/workbench/contrib/chat/browser/widget/input/chatInputNotificationWidget.ts:106

  • The dismiss control is a custom clickable
    but only listens for CLICK/KEY_DOWN. In touch environments (notably iOS in the Sessions window), CLICK can be unreliable for non- elements. Consider using the gesture system (Gesture.addTarget) and handling both CLICK and TouchEventType.Tap (or switch this to a real /Button) so dismiss works consistently on touch devices.
  • Files reviewed: 53/58 changed files
  • Comments generated: 3

Comment thread src/vs/workbench/contrib/chat/browser/widget/input/chatInputNotificationWidget.ts Outdated
Comment thread src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsWidget.ts Outdated
Comment thread extensions/copilot/src/platform/endpoint/node/chatEndpoint.ts
@pwang347 pwang347 changed the title Add support for token based billing Add support for usage-based billing Apr 27, 2026
@pwang347 pwang347 marked this pull request as ready for review April 28, 2026 02:00
@vs-code-engineering
Copy link
Copy Markdown
Contributor

vs-code-engineering Bot commented Apr 28, 2026

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

@deepak1556

Matched files:

  • src/vs/code/electron-browser/workbench/workbench-dev.html

@pwang347 pwang347 enabled auto-merge (squash) April 28, 2026 02:02
@pwang347 pwang347 merged commit b712765 into main Apr 28, 2026
25 of 27 checks passed
@pwang347 pwang347 deleted the lramos15/token-based-billing branch April 28, 2026 02:37
@vs-code-engineering vs-code-engineering Bot added this to the 1.119.0 milestone Apr 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants