Responsible AI Initiative: Understand and optimize the hidden environmental costs of your Large Language Model (LLM) operations in real-time.
EcoPrompt is a modern, responsive single-page web dashboard designed to calculate, analyze, and minimize the carbon emissions, clean water consumption, grid energy draw, and cost of LLM queries. It supports direct browser-side API integrations with Google Gemini, Anthropic Claude, and Groq cloud endpoints alongside a quantized local edge simulation.
The following flowchart maps how a query is processed, tracked, and visualized in the EcoPrompt dashboard:
graph TD
A[User Inputs Prompt] --> B{API Key Present?}
B -- Yes --> C[Route to Live Cloud Endpoint]
B -- No --> D[Trigger offline Local Simulation]
C --> C1[Gemini 1.5 Flash API]
C --> C2[Claude 3.5 Sonnet API]
C --> C3[Groq Llama 3 API]
C1 --> E[Calculate Input + Output Tokens]
C2 --> E
C3 --> E
D --> E
E --> F[Dual-Stage Environmental Engine]
F --> F1[Energy Draw: Input vs Output scaling]
F --> F2[Water Evaporation Cooling Rates]
F --> F3[Carbon Grid Intensity Calculations]
F --> F4[API Cost Estimation Metrics]
F1 & F2 & F3 & F4 --> G[Update Dashboard Metrics]
G --> H[Render SVG Circular Eco Score Gauge]
G --> I[Insert Data Points in Chart.js Timeline]
G --> J[Refresh Model Matrix Comparison]
G --> K[Log to Local History Database]
Operational inference (every token processed and generated) represents a growing share of global compute energy. EcoPrompt splits calculations into two distinct hardware phases:
-
Input Prompt Tokens (
$T_{in}$ ):$$T_{in} = \text{Prompt Words} \times 1.3$$ -
Output Completion Tokens (
$T_{out}$ ):$$T_{out} = \text{Response Words} \times 1.3$$
Input pre-fill processing is parallelized and consumes significantly less energy per token compared to token-by-token autoregressive generation:
Model Specific Factors:
-
GPT-4:
$2.2\times$ scale factor (Large Mixture of Experts draw) -
Claude:
$1.6\times$ scale factor -
Gemini:
$1.0\times$ scale factor (Standard Base) -
Llama 3:
$0.7\times$ scale factor (Cloud Optimized) -
Local Edge Model:
$0.3\times$ scale factor (Low-power localized execution)
Assuming an average global grid carbon intensity:
Data center liquid cooling systems evaporate clean water to maintain temperature thresholds:
Input tokens are calculated at
An efficiency score clamped between
- HTML5: Semantic nodes, responsive viewport tags.
- CSS3 (Vanilla): Grid variables, dark/light theme tokens, layout flexboxes, key status indicators, and typewriter timelines.
- JavaScript (Vanilla ES6): Pure DOM logic, localStorage history logs, and fetch client routes.
- Chart.js (CDN): Dual-axis combined line-bar footprint tracker.
- html2pdf.js (CDN): High-resolution PDF exporting.
- Font Awesome (CDN): Interface icons.
The application is entirely serverless and runs directly in standard web browsers.
To verify theme transitions, API keys caching, CSV log downloads, and PDF exports, run a simple static files server in the root of the workspace directory:
# Using Python
python -m http.server 8000Open http://localhost:8000 in your web browser.
To test cloud queries directly inside the browser:
- Click the Key icon in the top navbar to expand the Credentials Manager.
- Input keys for the endpoints you wish to use:
- Gemini: Input Google AI Studio key (
AIzaSy...). - Claude: Input Anthropic API key (
sk-ant-...). - Groq: Input Groq Cloud key (
gsk_...).
- Gemini: Input Google AI Studio key (
- Click Save Credentials.
- The key status indicator dots will turn green (🟢). Models without keys will safely continue in simulation mode.