Inspiration
AI data centers require enormous amounts of computational power, consuming vast quantities of electricity to run large-scale models and the infrastructure that supports them. This energy demand driven by both model inference/training and the cooling systems needed to keep hardware operational, results in millions of tonnes of CO₂ emissions each year. As AI usage continues to scale, these emissions place increasing strain on the environment, making it critical to understand and reduce the carbon cost of everyday AI interactions.
That's why we built CarbonPrompt.
What it does
The extension listens for user input and other events. As a user types a prompt, it injects TypeScript code into the webpage to highlight the estimated carbon emissions that would be released during processing. This is calculated via an algorithm derived from data based on the research papers: (https://www.sciencedirect.com/science/article/pii/S2666389925002788) and (https://arxiv.org/abs/1906.02243) with further information from: (https://mlco2.github.io/codecarbon/methodology.html), and displayed discreetly on the bottom right of the screen.
Once the extension detects that a prompt has been sent successfully, it retains the estimated emission information. This data is then used in the dashboard as a daily emission tracker, noting highest-emission days, all-time emission totals, and individual session statistics.
The extension also utilizes linear regression algorithms to predict future emissions if current trends continue, allowing users to adjust their usage to better align with their sustainability goals.
How we built it
- The Chrome extension was built on TypeScript using the Vite development server, with all aspects of the extension created in this one unified programming language.
- We have created incredibly efficient algorithms that run entirely within the user's own browser. This eliminates the need for server-side resources and unnecessary overhead while maintaining an unmatched level of user data privacy.
- The extension uses event listeners to monitor user interactions and injects JavaScript directly into chatgpt.com to listen for prompt input changes in real time.
- As the user types, the injected script estimates carbon emissions based on prompt size and model assumptions.
- Emission data is stored locally and aggregated into a dashboard, where linear regression is applied to a user’s past week of activity to predict future emissions if current usage patterns continue.
Challenges we ran into
Our primary challenge was accurately estimating CO₂ emissions from AI usage. This required extensive research into existing literature and energy-consumption studies to derive a reasonable and defensible calculation model. On the technical side, injecting JavaScript into chatgpt.com and reliably listening to the correct input events proved non-trivial, as the page structure is dynamic and not designed for external instrumentation. Ensuring our listeners captured prompt changes accurately without impacting performance required careful iteration and testing.
Accomplishments that we're proud of
We are proud of the features we were able to implement within this specific time frame. None of us had prior experience with Chrome Extensions, and had to pick it up from scratch. Nonetheless, we worked as a team and did our parts to push out a solid final product.
What we learned
We learned that individual prompts do not have a massive impact, but over time, the consequences add up, and these emissions have a way bigger impact in the future. We mitigate that by optimizing our prompts, reducing the overall impact.
What's next for CarbonPrompt
We aim to expand CarbonPrompt by implementing: a leaderboard so you can compete with friends, gamification through a rewards system, a heat map to show the usage from your local area, and most enticing of all, expansion to other LLMs and AI chatbots.
Built With
- css
- html
- javascript
- linear-regresson
- node.js
- typescript
- vite
Log in or sign up for Devpost to join the conversation.