Skip to content

Releases

v0.1.3

Choose a tag to compare

@Albert-code-1114 Albert-code-1114 released this 13 Oct 04:35

0.1.3 — the interface speaks English too

Everything the extension shows — command titles, setting descriptions, the status
bar hint, the details panel, the Markdown report, the diagnostics output — now
follows VS Code's display language.

Chinese remains the authored language, so a Chinese VS Code looks exactly as
before
; every other display language gets English. Nothing about the numbers
changed in this release: 0.1.3 is the 0.1.2 accounting with a bilingual UI.

Added

  • English UI. 85 runtime strings and 24 manifest strings are translated.
    Messages are authored in Chinese, so the Chinese string is the key and
    l10n/bundle.l10n.en.json holds the English text. There is deliberately no
    bundle.l10n.zh-cn.json: the host resolves an untranslated key to the authored
    text, so a Chinese bundle could only ever be an identity map that silently rots.
    Command titles and setting descriptions use package.nls.json (English, the
    default) plus package.nls.zh-cn.json, the same two-file shape VS Code's own
    built-in extensions ship.
    • src/core/l10n.js wraps vscode.l10n.t and falls back to in-place {0}
      substitution when the host API is absent, so nothing throws on an older VS
      Code and the headless test suites keep working.
    • The details QuickPick dispatches on codicon prefixes rather than on item
      text, so a translated label can never break the command wiring.

Fixed

  • Switch scope claimed "no models configured yet" whenever
    copilotOtelUsage.gatewayModels was empty, even though host evidence alone
    (server.address in the records) can drive a correct grouping. It now needs
    both gatewayModels and gatewayHosts to be empty before it hints.

Tests

  • New test/l10n.test.js (24 assertions) fails the build on a t("…") call with
    no English translation, an entry nothing uses, a translation that adds, drops
    or renumbers a {0} placeholder, a translation left identical to its key, Han
    characters surviving into the English text, or a stray
    bundle.l10n.zh-cn.json. test/run-all.js now runs five suites.

Install

code --install-extension copilot-otel-usage-0.1.3.vsix

Then reload the window. Coming from 0.1.1 or earlier, also run
Copilot Token Usage: Reset today and Copilot Token Usage: Re-scan data source
— those versions double-billed every call, and the stored totals keep showing it
until you reset.

Full changelog: CHANGELOG.md

v0.1.2

Choose a tag to compare

@Albert-code-1114 Albert-code-1114 released this 12 Oct 14:50

What changed

Fixed — one API call was being billed twice

Copilot Chat writes two records per model call: a
gen_ai.client.inference.operation.details record, and a second record with no
event.name at all. They share gen_ai.response.id but not a span, and only
one of the two carries gen_ai.usage.cache_read.input_tokens. The span-based
de-duplication id therefore never paired them, so every call was counted at its
full prompt size twice over.

Measured over one live export file (57.9 MB):

Fact Count
usage records 1,800
distinct gen_ai.response.id 923
ids that repeat 837
…with byte-identical token counts 817
…with a different cache_read value 827

Records are now paired by gen_ai.response.id and merged per field with a
maximum, never a sum
: the two records are two views of one response, so summing
re-bills the whole prompt while the max keeps it counted once and still picks up
the cache figure that only one side has. On the same day of real traffic the
figure went from 29.8M → 2.97M.

Added — per-route split: your endpoint vs Copilot's own models

The split is driven by the server.address each record carries — the host that
actually answered the request — with copilotOtelUsage.gatewayModels as a
name-based net for the paired record that omits the host. It works with no
configuration at all
: a host that is not GitHub's own is treated as yours.

The short model name is deliberately not used as a discriminator:
gen_ai.provider.name is github for both routes, and deepseek-flash is a
substring of deepseek-v4-flash-ascend1.

  • copilotOtelUsage.statusBarScope (all / gateway / internal), switchable
    without opening settings via 切换统计范围. When a scope hides a route that has
    traffic, the status bar appends ↑ <amount> so a number is never silently partial.
  • Details panel and Markdown report gained a 按链路 section above 按模型.
  • copilotOtelUsage.showGroups turns the section off.
  • The cost format intentionally ignores the scope: pricing rules match by model
    name, so restricting the scope would produce a misleading estimate.

Also in 0.1.1 (included here)

  • The total no longer counts cache-read tokens: the wire format reports cache
    reads inside input, and they were being added to output as if fresh. The
    total is now (input − cached) + output — billable tokens, the same rule
    gateways use.
  • Removed a dead resourceSpans fan-out in the OTel reader: the live file
    contains 2,234 flat log records and 6,474 metric envelopes, but zero
    resourceSpans.
  • Fixed a "no-id fingerprint" de-dupe path that stored an object and compared it
    with now - seenAt — which is NaN, so it never matched anything.
  • Added .vscodeignore: the packaged vsix carries only the runtime.

Install

code --install-extension copilot-otel-usage-0.1.2.vsix

sha256: 8C90932F5E7763971BC123B9F39AEB0A0AEA0C101C2233A4BDB800246C1BB63E

Upgrading from 0.1.1 or 0.1.0? The stored state still holds the pre-fix
totals. After installing: reload the window → run
Copilot Token Usage: 重置今日统计 → run 重新扫描数据源.

Verification

4/4 suites pass: parser 38 assertions, otel 40, smoke 19, activation harness 15
(the last one drives the real cycleScope command and asserts the status bar
text at all three scopes).

v0.1.1

Choose a tag to compare

@Albert-code-1114 Albert-code-1114 released this 12 Oct 14:51

Version 0.1.1 fixed the token total so it no longer counts cache-read tokens (the wire format reports them inside input).

0.1.2 supersedes this release and also fixes a double-counted report per call, plus adds the per-route split. Install that one instead: https://github.com/Albert-code-1114/vscode-copilot-otel-usage/releases/tag/v0.1.2

Copilot Token Usage 0.1.0

Choose a tag to compare

@Albert-code-1114 Albert-code-1114 released this 26 Sep 15:49

First release.

Status-bar readout of this request / today's total tokens for GitHub
Copilot Chat, including BYOK and custom-endpoint models. It reads the
OpenTelemetry JSON Lines file Copilot Chat can already export itself --
no proxy to run, nothing patched.

Added

  • Status bar readout in four formats (lastDay, last, day, cost).
  • otel-file data source reading the github.copilot.chat.otel.* export:
    • understands all three record shapes that can appear -- OTel log records
      (what the file exporter actually writes), OTLP span envelopes, and raw
      SDK spans
    • incremental reads: only new bytes are parsed
    • per-call de-duplication id persisted across window reloads, so replaying
      the file from byte 0 never double-counts
    • events from other local dates are discarded, not folded into today
  • Details panel: today's summary, per-model split, last 30 requests.
  • Markdown report export.
  • 诊断数据源 command: per-source connection state, lines read, and a verdict
    explaining a zero.
  • Optional local price list and cost estimation.
  • Model exclusion by substring (e.g. the small utility model Copilot uses to
    title conversations).
  • Offline test suite -- 4 suites / 87 assertions, no VS Code required.

Install

Download copilot-otel-usage-0.1.0.vsix below, then:

code --install-extension copilot-otel-usage-0.1.0.vsix

Then point it at the export file -- see the Install section of the README.

Notes

  • Reads only the officially exported surface. It does not patch, instrument,
    or modify VS Code or the Copilot extension.
  • Command titles and UI text are Chinese in this release.