
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 (opt-in — disabled by default) |
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. This is always active and requires no configuration beyond the Copilot log level step below.
- Runtime (opt-in) — an HTTP proxy intercepts outbound LLM API calls made from your own scripts running in VS Code terminals. Disabled by default — enable it in settings if you want to track runtime API usage in addition to your in-IDE tools.
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
Disabled by default. Runtime capture requires an HTTP proxy that intercepts terminal traffic and injects a trusted certificate into terminal processes. Enable it only if you want to track LLM API calls made by your own scripts, in addition to your in-IDE tools (Claude Code and Copilot Chat are always captured without this setting).
To enable, open Settings (Cmd+, / Ctrl+,), search for PRISM, and turn on Enable Runtime Proxy.
Once enabled, 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.
Security considerations for Runtime Proxy
⚠️ IMPORTANT — The runtime proxy intercepts HTTPS traffic. Before enabling, understand the following:
- HTTPS interception — The proxy creates a self-signed certificate authority and installs it into terminal processes to decrypt API traffic. This allows the proxy to see the plaintext of all HTTPS requests and responses made from those terminals.
- Certificate storage — The CA private key is stored on disk (
globalStorage/local-ca.key). If your machine is compromised, an attacker could use this key to decrypt intercepted traffic.
- Response bodies captured — Complete API response bodies are processed to extract token counts. While PRISM only records models and token usage, the raw response is briefly held in memory.
- Terminal environment pollution — Proxy environment variables are injected into all new terminals. While PRISM targets only LLM APIs, misconfigured scripts could be affected.
- Unintended API interception — Simple URL matching may inadvertently capture non-LLM API traffic (e.g., other GitHub API calls, general HTTPs requests).
- Recommendation — Enable the proxy only if you understand these risks and trust PRISM. For production environments or sensitive work, consider disabling it or running PRISM in a sandboxed workspace.
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.