Skip to content

Token cost estimates#77

Merged
rajbos merged 27 commits intomainfrom
token-cost-estimates
Dec 27, 2025
Merged

Token cost estimates#77
rajbos merged 27 commits intomainfrom
token-cost-estimates

Conversation

@rajbos
Copy link
Copy Markdown
Owner

@rajbos rajbos commented Dec 27, 2025

This pull request introduces an automated workflow to keep the Copilot Token Tracker extension's model data up-to-date with GitHub Copilot's officially supported models. It adds scripts and GitHub Actions to scrape Copilot's documentation, compare the results with local configuration files, and alert maintainers when updates are needed. Additionally, it improves documentation and code maintainability by loading model data from JSON files and displaying estimated costs in the extension UI.

The most important changes are:

Automation for model updates:

  • Added a scheduled GitHub Actions workflow (.github/workflows/check-models.yml) that scrapes the official Copilot documentation for supported models, compares them to local tokenEstimators.json and modelPricing.json, and opens a GitHub issue if any models are missing. This ensures the extension's model data stays current without manual checking.
  • Introduced a headless scraping script (.github/scripts/scrape-models.sh) using Puppeteer to extract model names from the documentation, outputting results as JSON and plain text for the workflow to consume.
  • Added a workflow (.github/workflows/tag-on-issue.yml) to automatically tag a user or team when a new issue is created, improving notification and response times for required updates.

Data and documentation improvements:

  • Moved model estimator and pricing data to separate JSON files (src/tokenEstimators.json, src/modelPricing.json) and updated the code to load these at runtime, replacing hardcoded values. [1] [2]
  • Added a comprehensive src/README.md with instructions for updating the JSON data files, including structure, update procedures, and pricing source details. [1] [2]

Extension UI and code enhancements:

  • The extension now displays estimated Copilot usage costs (based on model pricing) for both daily and monthly stats in the UI, using the new pricing data. [1] [2] [3] [4]
  • Added a new dependency on jsdom for future-proofing or possible HTML parsing needs.

These changes collectively automate the maintenance of supported model data, improve transparency around updates, and enhance the user experience by showing cost estimates based on up-to-date pricing information.

rajbos and others added 27 commits December 27, 2025 20:52
Co-authored-by: rajbos <6085745+rajbos@users.noreply.github.com>
Co-authored-by: rajbos <6085745+rajbos@users.noreply.github.com>
Co-authored-by: rajbos <6085745+rajbos@users.noreply.github.com>
Co-authored-by: rajbos <6085745+rajbos@users.noreply.github.com>
Co-authored-by: rajbos <6085745+rajbos@users.noreply.github.com>
Fix Puppeteer deprecated API and improve model scraping accuracy with normalized model names
@rajbos rajbos merged commit 0513e30 into main Dec 27, 2025
13 checks passed
@rajbos rajbos deleted the token-cost-estimates branch December 27, 2025 22:19
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.

2 participants