CallToChange is a carbon emissions calculator for AI apps. This tool analyzes and calculates the carbon emissions generated by a company's LLM (Large Language Model) calls.
This project won first place in the environmental track at LA Hacks (hundreds of participants)
This repo is for call-to-change, a Python library that logs LLM calls with a single line of code.
Use the command pip install call-to-change to download our library. Ensure the downloaded version is >= 0.8.6.
Here is a sample script utilizing call-to-change:
from openai import OpenAI
from call_to_change import log
client = OpenAI()
log(client, 'test@test.com')
response = client.chat.completions.create(
model="gpt-3.5-turbo",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Who won the world series in 2020?"},
]
)
print(response.choices[0].message.content)
The log function takes in two parameters, an OpenAI client and an email address.
It modifies the client to log any text generation or image generation calls you made. These calls will be tied to the email address you input into the log function.
If you have an account with our web app, your logged calls can be seen through your dashboard. From there, you can view the carbon emissions tied to your OpenAI calls and the offset cost.
If not, your text generation and image generation calls will still be saved. To access your data, create an account with us here and go to the Dashboard page.
Our Python library logs LLM calls in MongoDB.
Under the hood, it does this by sending a POST request to API routes in our web app. These API routes securely handle data updates in MongoDB.