TokenTorch
TokenTorch translates AI coding usage into dollars you can actually reason about.
The point of the extension is to fix the gap between vendor UI and billing reality. If VS Code, Copilot, or Cursor tells you that you have used 88% of your credits, that still does not tell you whether you have effectively consumed $17.60 of a $20 plan, or whether the next burst of usage is about to become overage. This extension normalizes that into a current-cycle USD view.
What it does
- Shows current AI spend in the status bar.
- Opens a dashboard with per-tool and per-plan breakdowns.
- Converts credit percentages into an effective dollar cost using your configured monthly plan price.
- Tracks direct token-billed usage for API-based models with exact published rates.
- Separates exact, effective, estimated, and included cost labels so the UI does not imply false precision.
Current MVP scope
This version supports two ways of tracking spend:
- Direct-billed usage.
Log token usage for a direct API profile such as OpenAI or Anthropic. The extension computes exact cost from per-million token pricing.
- Credit and subscription usage.
Create a profile for a product such as GitHub Copilot Pro or Cursor Pro, then update the current credit percentage from the vendor UI. The extension converts that percentage into an effective cost for the current billing cycle.
Native per-request telemetry from proprietary tools is not yet available through public VS Code APIs, so Copilot and Cursor are estimation-first in this MVP.
Commands
TokenTorch: Open Dashboard
TokenTorch: Set Up Billing Profile
TokenTorch: Update Credit Usage Snapshot
TokenTorch: Import Credit Usage From Text
TokenTorch: Quick Paste Copilot Usage
TokenTorch: Quick Paste Cursor Usage
TokenTorch: Log Token Usage
TokenTorch: Load Demo Data
TokenTorch: Connect GitHub Billing Account
TokenTorch: Connect Provider Account
TokenTorch: Sync GitHub Billing Usage
TokenTorch: Sync All Provider Accounts
TokenTorch: Configure Cloud Sync Backend
TokenTorch: Manage Provider Connections
TokenTorch: Open Connections Panel
TokenTorch: Sign In To Cloud Sync
TokenTorch: Sign Out Of Cloud Sync
TokenTorch: Restore Connections From Cloud
TokenTorch: Reset Stored Data
Example workflow
You can now get started without opening Command Palette:
- Click the startup prompt action
Set Up Now, or click the AI Spend: Set Up status bar item.
- Complete the guided setup inputs.
- Use the dashboard action buttons for ongoing updates.
Command Palette commands still exist, but they are optional.
- Run
TokenTorch: Set Up Billing Profile.
- Choose
GitHub Copilot Pro.
- Enter your monthly fee, for example
$20.
- Run
TokenTorch: Update Credit Usage Snapshot.
- Enter the percentage shown by Copilot, for example
88.
- Open the dashboard or watch the status bar.
That profile will now show an effective current-cycle cost of about $17.60.
Fast import workflow for credit UIs
When a tool only shows a percentage in its UI:
- Copy the text that includes usage percent (for example:
You used 88% of monthly credits).
- Run
TokenTorch: Quick Paste Copilot Usage or TokenTorch: Quick Paste Cursor Usage.
- The extension parses the percentage from clipboard text and stores a new snapshot.
- Your status bar and dashboard update immediately to the latest effective dollar figure.
Extension settings
This extension contributes the following settings:
tokentorch.currencyCode: Display currency code. Default is USD.
tokentorch.staleSnapshotHours: Mark credit snapshots as stale after this many hours. Default is 72.
tokentorch.cloudSyncEnabled: Use an external cloud backend for provider sync. Default is false.
tokentorch.cloudSyncEndpoint: Base URL for cloud sync backend, for example an Azure Function App.
tokentorch.anthropicUsageEndpoint: Optional direct endpoint for Anthropic usage sync when cloud mode is off.
tokentorch.cursorUsageEndpoint: Optional direct endpoint for Cursor usage sync when cloud mode is off.
Cross-device accounts
TokenTorch now supports cloud user sessions and connection persistence:
- Configure cloud sync backend endpoint.
- Sign in with either your Microsoft account or cloud email + passcode.
- Connect provider accounts.
- On a new machine, sign in and run
Restore Connections From Cloud.
Provider tokens are stored in cloud backend storage and restored to local VS Code secret storage.
Cloud backend and Azure deployment
The repository includes a containerized backend and deployment script:
- Backend service:
cloud/backend
- Azure deployment script:
cloud/azure/deploy-containerapp.ps1
- Key Vault helper:
cloud/azure/configure-keyvault.ps1
- Secret rotation helper:
cloud/azure/rotate-secrets.ps1
- Post-deploy verification:
cloud/azure/verify-containerapp-secrets.ps1
Deployment now defaults to Key Vault reference mode (managed identity + secretref). If Key Vault is missing, deployment fails unless you explicitly pass -AllowPlainEnvFallback.
Default deploy script targets:
- Resource group:
northLo
- Container Apps environment:
coastal-container-env
Known limitations
- GitHub Copilot and Cursor do not expose exact per-user billing telemetry to third-party VS Code extensions, so their totals are currently effective or estimated rather than audit-grade.
- Credit-to-USD normalization is only as good as the monthly plan price or credit assumptions you configure.
- The extension stores billing profiles, usage events, and credit snapshots locally in VS Code global state. It does not store prompts.
Development
npm run compile builds the extension bundle.
npm run clean:vsix removes all local .vsix artifacts from the repo root.
npm run release:package cleans old .vsix files, then builds a fresh production package.
npm test runs the extension tests.
- Press
F5 in VS Code to launch an Extension Development Host.
Roadmap
- Add collector adapters for tools that expose usable telemetry.
- Support manual plan overage pricing and prepaid credit pools.
- Improve import flows for provider invoices and usage exports.