
PRISM — AI Carbon Tracker
PRISM is a VS Code extension that estimates the carbon footprint of AI interactions in your IDE. It captures token usage from GitHub Copilot Chat, Claude Code, and runtime LLM API calls, then calculates CO₂ equivalents and surfaces them in the sidebar, status bar, and a live dashboard.
What PRISM tracks
| Source |
How it's captured |
| GitHub Copilot Chat |
Reads Copilot's log file (requires Trace log level — see setup below) |
| Claude Code |
Reads Claude Code's log file automatically |
| Runtime LLM calls |
HTTP proxy intercepts API calls in VS Code terminals |
Contents
How it works
PRISM captures AI token usage from two sources:
- Development-time — reads GitHub Copilot Chat and Claude Code log files automatically at a configurable interval.
- Runtime — an HTTP proxy intercepts outbound LLM API calls; proxy environment variables are injected into every new VS Code terminal so scripts run without any manual configuration.
Results appear immediately in the sidebar tree, status bar, and dashboard.
First-time setup
On activation, PRISM will prompt you to set GitHub Copilot Chat's log level to Trace. This is required for development-time log capture.
- Open the Command Palette (
Ctrl+Shift+P / Cmd+Shift+P).
- Run Developer: Set Log Level…
- Select GitHub Copilot Chat → Trace.
Everything else starts automatically — no further configuration needed.
How to use
The PRISM panel in the Activity Bar shows a timestamped log of all captured calls, grouped into the current session and an expandable archive. Each entry shows the model used and its estimated CO₂ cost.
Status bar
The bottom status bar shows the carbon cost of the most recent call, colour-coded by percentile:
- Green — below the 50th percentile of your recorded calls
- Amber — 50th–90th percentile
- Red — above the 90th percentile
- Grey — fewer than 10 calls recorded (not enough data to classify)
Dashboard
Open the full dashboard via the Command Palette:
PRISM: Open Carbon Dashboard
The dashboard shows a timeline graph, model breakdown, and cumulative session emissions. Colour thresholds and other preferences are configurable from the dashboard's settings panel.
Runtime analysis
Open any terminal in VS Code — PRISM automatically injects the proxy environment variables. Run your scripts as normal; LLM API calls are captured and appear in the sidebar in real time.
Commands
| Command |
Description |
PRISM: Open Carbon Dashboard |
Opens the dashboard |
PRISM: Reset budget window |
Clears current session data |
PRISM: Purge all stored logs |
Deletes all archived call history |
Supported models
GitHub Copilot
OpenAI
- o1, o3, o3-mini, o4, o4-mini (all effort levels)
- GPT-4o, GPT-4o Mini
- GPT-4 Turbo, GPT-4.1, GPT-4.1 Mini, GPT-4.1 Nano
- GPT-5 (all variants: high, medium, low, mini, nano)
Anthropic
- Claude Haiku, Sonnet, Opus (3.x and 4.x families)
Google
- Gemini 2.5 Flash, Gemini 2.5 Pro
- Gemini 3 Flash, Gemini 3.1 Pro
Models not in the list return zero emissions. Open an issue to request support for a new model.
Known issues
- Images — image API responses don't include token counts (pricing is by image size and quality), so image generation calls are not tracked.
- Timeline zoom — in some cases the zoom control on the timeline graph doesn't produce a scrollable view, limiting granular analysis.
- Gemini / older GPT tokenisation — text is tokenised client-side for Gemini and pre-GPT5 models; caching can prevent some calls (e.g. function calls) from being captured.
- Water usage — water consumption data is not yet in the model registry.
How to run PRISM
There are two ways to run the extension: directly from source (for development and contributing), or by building and installing a .vsix package.
Option A — Run from source (development)
Use this when you have cloned the repository and want to develop or test the extension.
Prerequisites
1. Install dependencies
From the repository root:
npm run setup
This runs npm install and compiles the TypeScript source in one step.
2. Launch the extension
Open the repository folder in VS Code, then press F5 (or go to Run → Start Debugging).
This opens a new Extension Development Host window with PRISM loaded. Changes to the source require restarting the host (Ctrl+Shift+F5 / Cmd+Shift+F5) to take effect.
3. Watch mode (optional)
To rebuild automatically on every file save:
npm run watch
Restart the Extension Development Host after each rebuild to pick up changes.
4. Run tests
npm test
Option B — Build and install a VSIX package
Use this to produce a self-contained .vsix file you can install on any machine without cloning the repo.
Prerequisites
1. Build the VSIX
From the repository root:
npm run release
This compiles the source and produces PRISM-CARBON.vsix inside distExtension/.
2. Install the VSIX
Via VS Code UI:
- Open VS Code.
- Go to the Extensions panel (
Cmd+Shift+X / Ctrl+Shift+X).
- Click the
··· menu (top-right of the panel).
- Select Install from VSIX…
- Choose
PRISM-CARBON.vsix.
- Reload VS Code when prompted.
Via terminal:
code --install-extension "distExtension/PRISM-CARBON.vsix"
After installing
- The PRISM icon appears in the Activity Bar (left sidebar).
- No build step or Node.js required on the target machine — the extension is fully bundled.
Project structure
├── README.md # this file
├── package.json # extension manifest and scripts
├── models.json # emissions rates per model
├── esbuild.js # build script
├── tsconfig.json
├── distExtension/ # packaged .vsix output (git-tracked folder, contents ignored)
├── public/ # static frontend assets (served in webviews)
│ ├── dashboard/ # carbon dashboard UI
│ │ ├── dashboard.html
│ │ ├── dashboard.js
│ │ ├── graph.js # timeline graph logic
│ │ └── style.css
│ └── miniview/ # compact emissions miniview panel
│ ├── miniview.html
│ ├── miniview.js
│ └── miniview.css
└── src/ # TypeScript source
├── extension.ts # entry point — registers all commands and listeners
├── extensionState.ts # shared mutable state across the extension
├── commands/ # VS Code command handlers
│ ├── index.ts
│ ├── menu.ts # bottom-right menu
│ ├── openDashboard.ts
│ ├── clearStore.ts
│ ├── purgeStore.ts
│ ├── selectCall.ts
│ ├── deleteCall.ts
│ ├── copyCall.ts
│ └── inputDisplay.ts
├── core/ # business logic
│ ├── budget.ts # Call type definitions and usage calculations
│ ├── callManager.ts # session and archive call management
│ ├── convert.ts # token counts → carbon emissions
│ ├── fileLogger.ts # persistent file-based call logging
│ ├── state.ts # runtime interceptor flag
│ └── capture/ # data capture layer
│ ├── captureProvider.ts
│ ├── sseParser.ts # SSE stream parsing for intercepted calls
│ └── adapters/
│ ├── interceptor/ # runtime proxy capture
│ │ ├── interceptorAdapter.ts
│ │ └── providers/ # per-provider parsers (Anthropic, OpenAI, Gemini)
│ └── log/ # development-time log capture
│ ├── logAdapter.ts
│ ├── logProvider.ts
│ └── providers/ # Copilot and Claude Code log parsers
├── dashboard/ # dashboard webview host
│ ├── dashboard.ts
│ ├── dashboardData.ts
│ └── webviewContent.ts
├── listeners/ # VS Code event listeners
│ ├── index.ts
│ ├── branchChangeListener.ts
│ ├── launchButton.ts
│ ├── logRefreshListener.ts
│ └── saveListener.ts
├── proxy/ # runtime HTTP proxy server
│ ├── proxyServer.ts
│ └── serverWorker.ts
├── ui/ # VS Code UI components
│ ├── treeView.ts # sidebar call history tree
│ ├── statusBar.ts # status bar carbon indicator
│ └── budgetMiniView.ts # emissions miniview panel
└── utils/
├── callId.ts
├── gitUtils.ts
└── logger.ts
Documents
Issues and feedback
PRISM is under active development. If you find a bug or want to request a feature, please open an issue on GitHub.