NetGreener; Energy & Carbon Profiler for Python
Measure, analyze, and reduce the energy consumption and carbon footprint of your Python code; without leaving VS Code.
What it does
NetGreener connects your editor to the NetGreener platform, giving you:
- Live energy metrics; CPU, GPU, and memory power draw for every run, shown in the sidebar
- Code issue detection; static analysis that flags energy-inefficient patterns (redundant loops, excessive allocations, repeated I/O, and more) directly in your editor
- One-click AI-powered optimization; select any flagged function and get a fully rewritten, energy-efficient version with an explanation
- Carbon estimates; project-level CO₂ estimates based on your run history and infrastructure
- Insights; trends and recommendations across all your projects
Requirements
The extension requires the NetGreener CLI (netgreener) to measure and analyze your code.
If the CLI is not installed when the extension activates, you will be prompted automatically.
You can also run NetGreener: Install or Update CLI from the Command Palette.
- Install Globally with pipx; recommended, installs one shared CLI and keeps NetGreener dependencies isolated from your project
- Install in Project Python Environment; advanced, may upgrade/downgrade project packages such as TensorFlow
- Install with Current Python; advanced, uses
python3/py -3 from the integrated terminal environment
To install manually:
python3 -m pip install --user --upgrade pipx
python3 -m pipx ensurepath
python3 -m pipx install --force netgreener
Getting started
- Install the extension and open a Python project
- Click NetGreener: Log In from the Command Palette (
Ctrl+Shift+P)
- The extension auto-matches your workspace to a NetGreener project
- Press
Ctrl+Shift+G R to run and measure your script in the integrated terminal
- View results in the NetGreener sidebar
Features
Run Metrics
See energy consumption (Wh), CPU/GPU utilization, memory, and estimated CO₂ for every run; updated automatically when a run completes.
Code Issues
Scan your project for energy-inefficiency patterns with NetGreener: Scan Project for Issues ($(search) button in the sidebar). Issues are shown as:
- Inline editor diagnostics with severity indicators
- A filterable tree view in the sidebar
- CodeLens actions on flagged functions
AI-Powered Optimization
Click Optimize Function on any flagged issue to send it to the NetGreener AI agent and receive a fully rewritten, energy-efficient version. Supports applying fixes one-by-one or all at once with Optimize All Issues.
Carbon Estimates
The Estimates panel projects your expected energy use and CO₂ emissions based on historical runs and detected code patterns.
Configuration
| Setting |
Default |
Description |
netgreener.cliPath |
netgreener |
Path to the CLI executable |
netgreener.apiBaseUrl |
(cloud) |
NetGreener API base URL |
netgreener.llmProvider |
(server default) |
AI provider: azure_openai, openai, anthropic, ollama, custom |
netgreener.llmKey |
|
API key for your AI provider |
netgreener.llmEndpoint |
|
Endpoint URL (required for hosted providers, Ollama, or custom) |
netgreener.llmModel |
|
Model or deployment name |
netgreener.dataPath |
|
Path or URI to training/inference data; required for full CNN/data feature extraction on AI projects (supports local paths, Azure Blob, S3, GCS) |
Bring your own AI provider
NetGreener supports any AI provider for code optimization. Set llmProvider + llmModel (and llmKey / llmEndpoint as needed) in your VS Code settings. Supported providers:
- openai; OpenAI-compatible hosted API
- anthropic; Anthropic API
- azure_openai; Azure-hosted deployment
- ollama; local Ollama instance (
http://localhost:11434)
- custom; any OpenAI-compatible endpoint
Keyboard shortcuts
| Shortcut |
Action |
Ctrl+Shift+G R |
Run script in integrated terminal |
Ctrl+Shift+G L |
Open last run in dashboard |
Ctrl+Shift+G P |
Open project in dashboard |
Ctrl+Shift+G S |
Select active project |
Commands
All commands are available from the Command Palette (Ctrl+Shift+P):
NetGreener: Log In / Log Out
NetGreener: Run in Integrated Terminal
NetGreener: Scan Project for Issues
NetGreener: Optimize Function
NetGreener: Optimize All Issues
NetGreener: Open Project in Dashboard
NetGreener: Open Last Run in Dashboard
NetGreener: Select Project
NetGreener: Create Project for This Workspace
Privacy & data
Energy measurements and code analysis results are sent to the NetGreener platform associated with your account. Code sent for AI-powered optimization goes to your configured AI provider (or the NetGreener server default). No data is shared with third parties.
Support