AVI AI Usage Collector
Know what your AI coding assistants cost. AVI AI Usage Collector records the tokens and estimated cost of every model call made by Claude Code, OpenAI Codex and GitHub Copilot. It shows today's spend in the status bar and keeps a searchable audit log. It can also share a monthly summary with your team through a SharePoint or OneDrive folder.
It records numbers only: never prompts, answers, code, file names or repository names.
Features
Today's cost in the status bar. AI $3.42 today, updated a few seconds after each answer. Hover for a breakdown by tool and model (requests, tokens, cost), or click to open the audit log.
Audit log. Every recorded model call, with time, tool, model, input / output / cache / reasoning tokens, Copilot AI credits and estimated cost. Filter by month, tool, model and date range, with totals.
Team sharing through SharePoint, in one click. Your team lead shares an invite link; clicking it joins the team folder. Or paste your team's SharePoint folder link and the extension finds the matching folder that OneDrive syncs to your PC. If the library isn't synced yet, it tells you how to sync it. A monthly summary file is written there, and OneDrive uploads it, so a team lead can combine everyone's usage. No sign-in or API access is needed: the extension only writes to a local folder.
Covers the tools you use:
| Tool |
Where usage comes from |
| Claude Code (CLI and IDE) |
session transcripts in ~/.claude/projects |
| OpenAI Codex (CLI, IDE extension, desktop app) |
session files in ~/.codex/sessions, including compressed ones |
| GitHub Copilot Chat in VS Code (ask / edit / agent) |
VS Code's saved chat sessions (AI credits per request) |
| GitHub Copilot CLI |
session state in ~/.copilot/session-state |
Works in the background. A small hook in each tool, plus a scheduled task every 30 minutes, keeps collecting even when VS Code is closed. While VS Code is open, new Copilot Chat usage shows up within about a minute.
Windows, Linux and WSL. On WSL the extension runs inside the distro and can still find the Windows OneDrive folders.
Privacy
From each tool's log, only the lines that carry token counts are read, and only these fields are kept:
date and time · tool · model · request count · input / output / reasoning / cache tokens · Copilot AI credits
Never recorded or shared: prompts, AI answers, code, file contents, commands, file or folder paths, repository / branch / commit names, and the email or account you use to sign in to the tools. Session ids are hashed and used only for counting.
The extension makes no network connections, opens no ports, and does not turn on or change any tool's telemetry. Data leaves your PC only as the monthly summary in the shared folder you choose.
Requirements
- VS Code 1.90 or newer.
- Node.js 18 or newer on the PC (22.15+ recommended, to read Codex sessions older than a week). The collector runs as a small Node script, so it also works when VS Code is closed.
- To share with a team: the OneDrive client syncing the team's SharePoint library (Windows), or any folder that is synced to where your team collects the files.
Getting started
With an invite link (one click)
Your team lead shares one link, in Teams or by email. Click it:
- VS Code opens and asks Join team usage folder "…" as jdoe? Click Join. If the link has no account id, you type yours once.
- If OneDrive doesn't sync that SharePoint folder on your PC yet, it opens in the browser. Click Sync (or Add shortcut to My files); joining continues by itself when the folder appears.
- Done: today's usage shows in the status bar.
If clicking the link doesn't open VS Code, run AVI AI Usage: Join Team… and paste the link.
Team leads: run AVI AI Usage: Create Invite Link and paste the SharePoint folder link (from the browser address bar). Leave the account id empty for one link the whole team can use. The link is copied to the clipboard.
Manually
Open AVI AI Usage: Setup / Shared Folder, or click AVI AI Usage: set up in the status bar. It also opens on first install.
Check that Node.js shows a ✓.
Enter your account id: the name your team lead uses for you on the dashboard.
Choose the shared folder:
- paste the SharePoint folder link and click Find on this PC; or
- pick one of the synced SharePoint / OneDrive folders the page lists; or
- Browse… to any folder.
The page checks that the folder exists, that you can write to it, and that it is inside a synced folder.
Click Install. The first run picks up the usage history still on disk; use Only usage since to limit it.
Codex users: the next time you open Codex, type /hooks and trust the ai-usage-collector hook.
What it changes on your PC
| Where |
What |
~/.ai-usage-collector/ |
the collector, its config, the local usage ledger, monthly summaries, collector.log |
~/.claude/settings.json |
Stop, SubagentStop, SessionEnd hooks (backup written next to it) |
~/.codex/hooks.json |
Stop hook (backup written next to it) |
~/.copilot/hooks/ai-usage-collector.json |
Copilot CLI hooks, only if Copilot CLI is installed |
| Task Scheduler (Windows) / crontab (Linux) |
"AI Usage Collector", every 30 minutes and at logon |
Nothing is changed until you click Install. No admin rights are needed.
To remove: run AVI AI Usage: Uninstall Collector. It removes the hooks and the scheduled task, and can optionally delete local data. Uninstalling the extension also removes the hooks and the task after VS Code restarts. Files already in the shared folder are kept.
The shared folder
Each PC writes its own subfolder, so several PCs (or a Windows and a WSL install) under one account never collide:
<shared folder>/
<account>/
<computer>/
usage-2026-10.json one row per day × tool × model: requests, sessions, tokens, credits, estimated cost
status.json last run time and which tools were found
_dist/ optional: drop a newer .vsix here and installed copies offer to update
Commands
| Command |
|
| AVI AI Usage: Join Team… |
paste an invite link (or SharePoint folder link) and join |
| AVI AI Usage: Create Invite Link |
make a one-click invite link for your team |
| AVI AI Usage: Setup / Shared Folder |
account, shared folder, install / reinstall / remove |
| AVI AI Usage: Collect Now |
collect immediately |
| AVI AI Usage: Show Audit Log |
every recorded model call |
| AVI AI Usage: Check for Update |
look for a newer .vsix in the shared folder's _dist |
| AVI AI Usage: Uninstall Collector |
remove hooks and the scheduled task |
Settings
| Setting |
Default |
|
aiUsage.statusBar |
true |
show today's cost in the status bar |
aiUsage.watchSources |
true |
collect shortly after a tool writes new usage while VS Code is open |
aiUsage.nodePath |
"" |
Node.js to use; empty means find it on PATH and in the usual install folders |
Costs are estimates. Claude Code and Codex calls are priced as tokens × the provider's public list price for the model, including cache reads and writes. Copilot uses the AI credits Copilot itself reports ($0.01 each), or premium requests on older plans. If you are on a flat-rate subscription (Claude Pro / Max, ChatGPT plans), the figure shows what the same usage would cost on the API, not what you pay. Unknown models are priced at a default rate.
Troubleshooting
| Problem |
Fix |
| Setup says Node.js was not found |
Install Node.js LTS from nodejs.org, restart VS Code, or set aiUsage.nodePath |
| Find on this PC says the library is not synced |
Click Open in browser, click Sync (or Add shortcut to My files) on SharePoint, wait for the folder to appear, then click Find on this PC again |
A sharing link (…/:f:/s/…) is not accepted |
Open it in the browser and paste the address of the folder page instead |
| ⚠ in the status bar |
Hover to see why: the background task hasn't run for 90 minutes, or the shared folder isn't reachable (data is kept locally and shared when it is back) |
| A tool you use shows "not found" |
It stores data in a non-default place (CLAUDE_CONFIG_DIR, CODEX_HOME, COPILOT_HOME); add the folder under roots in ~/.ai-usage-collector/config.json |
| Want details |
Output → AVI AI Usage Collector, or ~/.ai-usage-collector/collector.log (error codes and numbers only) |