This workflow corresponds to n8n.io template #7716 — we link there as the canonical source.
This workflow follows the Chainllm → OpenAI Chat recipe pattern — see all workflows that pair these two integrations.
The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"nodes": [
{
"id": "e374f8b8-ff4a-4b98-af50-d609338ec38f",
"name": "When clicking \u2018Execute workflow\u2019",
"type": "n8n-nodes-base.manualTrigger",
"position": [
0,
-160
],
"parameters": {},
"typeVersion": 1
},
{
"id": "6cce6b66-bd1a-419b-86c1-b76aa257e96c",
"name": "Basic LLM Chain",
"type": "@n8n/n8n-nodes-langchain.chainLlm",
"position": [
608,
-160
],
"parameters": {
"text": "Enter here your user prompt",
"batching": {},
"messages": {
"messageValues": [
{
"message": "Enter here the system prompt"
}
]
},
"promptType": "define"
},
"typeVersion": 1.7
},
{
"id": "d0ea8139-307d-4de6-9f29-11216958f362",
"name": "OpenAI Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
672,
64
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o",
"cachedResultName": "gpt-4o"
},
"options": {}
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "0fca2f27-8a0b-46d0-9dfc-27967afe2ae5",
"name": "Calculate gCO\u2082e",
"type": "n8n-nodes-base.set",
"position": [
960,
-160
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "cc17f2be-ce12-488f-89c7-de200b4c4869",
"name": "AI output",
"type": "string",
"value": "={{ $json.text }}"
},
{
"id": "c396e3b8-f07f-4153-9892-1b499a724dbc",
"name": "AI output gCO\u2082e",
"type": "number",
"value": "={{ Math.ceil($json.text.length / 4) * $('Conversion factor').item.json['Conversion factor (in gCO\u2082e/token)'] }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "5c25ded0-c24d-455b-82fb-d54d267ca591",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-624,
-384
],
"parameters": {
"width": 560,
"height": 672,
"content": "# Measure Your AI's Carbon Footprint\n\nThis workflow demonstrates a technique to calculate the gCO\u2082e (grams of CO\u2082 equivalent) of an AI model's output, based on the methodology from **Ecologits.ai**.\n\n## How it works\n\nA dedicated **Conversion factor** node makes it easy to set your parameters. The **Calculate gCO\u2082e** node then uses this factor and the AI's text output to estimate the carbon footprint.\n\n## How to use this snippet\n\n1. **Set your conversion factor (Important!):** The default factor is for **GPT-4o in the US**. You **must** visit **ecologits.ai/latest** to find the correct factor for *your model and server region* and update the value in the **\"Conversion factor\"** node.\n2. **Connect the snippet:** Place the **\"Conversion factor\"** node before your AI node and the **\"Calculate gCO\u2082e\"** node after it.\n3. **Update the calculation:** Modify the **\"Calculate gCO\u2082e\"** node to use the output text from *your* AI node.\n\n**Pro-Tip:** For higher accuracy, use the direct `output_tokens` value from your AI node's data if it's available."
},
"typeVersion": 1
},
{
"id": "941043b0-01ee-4553-87ec-1246a4cb2f2b",
"name": "Conversion factor",
"type": "n8n-nodes-base.set",
"position": [
304,
-160
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "a2c5484b-173e-4647-8dc1-23c32a899f75",
"name": "Conversion factor (in gCO\u2082e/token)",
"type": "number",
"value": 0.0612
}
]
}
},
"typeVersion": 3.4
},
{
"id": "430fc390-50b7-4feb-8c8f-be196a342d60",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
224,
-240
],
"parameters": {
"color": 5,
"width": 272,
"height": 336,
"content": "### Adapt this value to your model & settings\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nUse the expert mode here to find the factor that fits best:\nhttps://huggingface.co/spaces/genai-impact/ecologits-calculator"
},
"typeVersion": 1
}
],
"connections": {
"Basic LLM Chain": {
"main": [
[
{
"node": "Calculate gCO\u2082e",
"type": "main",
"index": 0
}
]
]
},
"Conversion factor": {
"main": [
[
{
"node": "Basic LLM Chain",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "Basic LLM Chain",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"When clicking \u2018Execute workflow\u2019": {
"main": [
[
{
"node": "Conversion factor",
"type": "main",
"index": 0
}
]
]
}
}
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
openAiApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This template provides a straightforward technique to measure and raise awareness about the environmental impact of your AI automations.
Source: https://n8n.io/workflows/7716/ — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
[AI/LangChain] Output Parser 4. Uses manualTrigger, chainLlm, outputParserStructured, outputParserAutofixing. Event-driven trigger; 11 nodes.
This workflow is for anyone looking to automatically fetch, validate, and parse complex language-based queries into a structured format. Its unique capability lies in not only processing language but
⚠️ Disclaimer This workflow uses a community node: Please make sure to install this before running the workflow.
Daily AI News Summaries with ChatGPT 5 Mini to WhatsApp. Uses chainLlm, rssFeedReadTrigger, jinaAi, lmChatOpenAi. Event-driven trigger; 10 nodes.
titletopodcast. Uses telegramTrigger, chainLlm, lmChatOpenAi, openAi. Event-driven trigger; 7 nodes.