API: Carbon Bot


📖 To learn more, take a look at our complete API

📤 Example Request

  1. Generate an api key below👇

  2. Install node-fetch & add the GOOEY_API_KEY to your environment variables.
    Never store the api key in your code and don't use direcly in the browser.

$ npm install node-fetch
$ export GOOEY_API_KEY=sk-xxxx
  1. Use this sample code to call the API.
    If you encounter any issues, write to us at [email protected] and make sure to include the full code snippet and the error message.
import fetch from 'node-fetch';

const payload = {
  "input_prompt": "What about the XPS 16 Laptop by Dell?",
  "messages": [
    {
      "role": "user",
      "content": "hi"
    },
    {
      "role": "assistant",
      "content": "Welcome to Carbon Bot. I'm an AI \ud83e\udd16 designed to help calculate the environmental footprint of various consumer products. Send me a text or \ud83c\udf99\ufe0fvoice note with the name of a product (or include a photo of the product) and I'll give you an answer based on reliable sources in my database. I'm constantly trying to improve, so please give me your feedback by tapping the \ud83d\udc4d\ud83c\udffe \ud83d\udc4e\ud83c\udffd buttons.  Now, what would you like to know? \ud83c\udf31"
    },
    {
      "role": "user",
      "content": "What is the carbon footprint of a Mercedes-Benz GLS-Class"
    },
    {
      "role": "assistant",
      "content": "The carbon footprint for manufacturing a luxury SUV like the Mercedes-Benz GLS-Class ranges from 20,000 to 26,500 kg of CO2e. For the use phase, let's assume an average CO2 emission of about 200 g/km (a typical value for large SUVs) and an annual driving distance of 15,000 km. This results in approximately 3,000 kg of CO2e emitted per year during use."
    }
  ]
};

async function gooeyAPI() {
  const response = await fetch("https://api.gooey.ai/v2/video-bots?example_id=l0ynz3rd9h0x", {
    method: "POST",
    headers: {
      "Authorization": "bearer " + process.env["GOOEY_API_KEY"],
      "Content-Type": "application/json",
    },
    body: JSON.stringify(payload),
  });

  if (!response.ok) {
    throw new Error(response.status);
  }

  const result = await response.json();
  console.log(response.status, result);
}

gooeyAPI();
  1. Generate an api key below👇

  2. Install requests & add the GOOEY_API_KEY to your environment variables.
    Never store the api key in your code.

$ python3 -m pip install requests
$ export GOOEY_API_KEY=sk-xxxx
  1. Use this sample code to call the API.
    If you encounter any issues, write to us at [email protected] and make sure to include the full code snippet and the error message.
import os
import requests

payload = {
    "input_prompt": "What about the XPS 16 Laptop by Dell?",
    "messages": [
        {"role": "user", "content": "hi"},
        {
            "role": "assistant",
            "content": "Welcome to Carbon Bot. I'm an AI 🤖 designed to help calculate the environmental footprint of various consumer products. Send me a text or 🎙️voice note with the name of a product (or include a photo of the product) and I'll give you an answer based on reliable sources in my database. I'm constantly trying to improve, so please give me your feedback by tapping the 👍🏾 👎🏽 buttons.  Now, what would you like to know? 🌱",
        },
        {
            "role": "user",
            "content": "What is the carbon footprint of a Mercedes-Benz GLS-Class",
        },
        {
            "role": "assistant",
            "content": "The carbon footprint for manufacturing a luxury SUV like the Mercedes-Benz GLS-Class ranges from 20,000 to 26,500 kg of CO2e. For the use phase, let's assume an average CO2 emission of about 200 g/km (a typical value for large SUVs) and an annual driving distance of 15,000 km. This results in approximately 3,000 kg of CO2e emitted per year during use.",
        },
    ],
}

response = requests.post(
    "https://api.gooey.ai/v2/video-bots?example_id=l0ynz3rd9h0x",
    headers={
        "Authorization": "bearer " + os.environ["GOOEY_API_KEY"],
    },
    json=payload,
)
assert response.ok, response.content

result = response.json()
print(response.status_code, result)
  1. Generate an api key below👇

  2. Install curl & add the GOOEY_API_KEY to your environment variables.
    Never store the api key in your code.

export GOOEY_API_KEY=sk-xxxx
  1. Run the following curl command in your terminal.
    If you encounter any issues, write to us at [email protected] and make sure to include the full curl command and the error message.
curl 'https://api.gooey.ai/v2/video-bots?example_id=l0ynz3rd9h0x' \
  -H "Authorization: bearer $GOOEY_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "input_prompt": "What about the XPS 16 Laptop by Dell?",
  "messages": [
    {
      "role": "user",
      "content": "hi"
    },
    {
      "role": "assistant",
      "content": "Welcome to Carbon Bot. I'"'"'m an AI \ud83e\udd16 designed to help calculate the environmental footprint of various consumer products. Send me a text or \ud83c\udf99\ufe0fvoice note with the name of a product (or include a photo of the product) and I'"'"'ll give you an answer based on reliable sources in my database. I'"'"'m constantly trying to improve, so please give me your feedback by tapping the \ud83d\udc4d\ud83c\udffe \ud83d\udc4e\ud83c\udffd buttons.  Now, what would you like to know? \ud83c\udf31"
    },
    {
      "role": "user",
      "content": "What is the carbon footprint of a Mercedes-Benz GLS-Class"
    },
    {
      "role": "assistant",
      "content": "The carbon footprint for manufacturing a luxury SUV like the Mercedes-Benz GLS-Class ranges from 20,000 to 26,500 kg of CO2e. For the use phase, let'"'"'s assume an average CO2 emission of about 200 g/km (a typical value for large SUVs) and an annual driving distance of 15,000 km. This results in approximately 3,000 kg of CO2e emitted per year during use."
    }
  ]
}'

🎁 Example Response

{4 Items
"id"
:
string
"te3lo238kk66"
"url"
:
string
"https://gooey.ai/copilot/"
"created_at"
:
string
"2024-06-13T22:43:48.429960+00:00"
"output"
:
{13 Items
"final_prompt"
:
[6 Items
0
:
{
}2 Items
1
:
{
}2 Items
2
:
{
}2 Items
3
:
{
}2 Items
4
:
{
}2 Items
5
:
{
}2 Items
]
"output_text"
:
[1 Items
0
:
string
"I don't have specific data for a Dell XPS 16 lapto"
]
"output_audio"
:
[1 Items
0
:
string
"https://storage.googleapis.com/dara-c1b52.appspot."
]
"output_video"
:
NULL
"raw_input_text"
:
string
"What about the XPS 16 Laptop by Dell?"
"raw_tts_text"
:
[1 Items
0
:
string
"I don't have specific data for a Dell XPS 16 lapto"
]
"raw_output_text"
:
[1 Items
0
:
string
"I don't have specific data for a Dell XPS 16 lapto"
]
"references"
:
[2 Items
0
:
{
}4 Items
1
:
{
}4 Items
]
"final_search_query"
:
string
"You're asking about the carbon footprint of the De"
"final_keyword_query"
:
[4 Items
0
:
string
"Dell"
1
:
string
"XPS"
2
:
string
"16"
3
:
string
"Laptop"
]
"output_documents"
:
NULL
"reply_buttons"
:
NULL
"finish_reason"
:
[1 Items
0
:
string
"stop"
]
}
}

Please Login to generate the $GOOEY_API_KEY