Skip to main content

GreenLedger CLI

A carbon-aware AI inference terminal that makes every prompt environmentally conscious.

GreenLedger CLI is a terminal-based interactive chat interface (inspired by Claude Code) that embeds sustainability into the AI development workflow. It helps developers understand and minimize the carbon footprint of their AI interactions through real-time analysis, model routing, and environmental accounting.


🌟 Key Features

1. Smart Model Router & Analyzer

Before every query, a lightweight Analyzer LLM evaluates your prompt and your selected model. It classifies the task complexity (Simple, Medium, Complex, Reasoning, or Code) and suggests the most eco-efficient model that meets your quality requirements.

2. Real-time Carbon Budget

Track your environmental impact as you work. The CLI features a persistent status bar showing:

  • CO2e Emissions (grams)
  • Energy Consumption (Wh)
  • Water Usage (mL)
  • Carbon Levy (USD contribution to carbon removal)

3. Environmental Receipts

Every AI response is followed by a detailed Environmental Receipt, breaking down the impact of that specific query and showing how much carbon you saved by choosing an eco-efficient model compared to the heaviest alternatives.

4. BYOK (Bring Your Own Key)

Complete privacy and control. Provide your own API keys for Anthropic, OpenAI, and Google. GreenLedger routes the requests using your keys, ensuring you only pay for the inference you use.


🚀 Quick Start

1. Prerequisites

  • Python 3.11+
  • Virtual environment (recommended)

2. Installation

From the project root:

pip install -e .

3. Launching the CLI

You can launch the CLI in a new dedicated terminal window (recommended for the best TUI experience):

python cli/launch.py

Or run it directly in your current terminal:

python cli/main.py

4. Setup

On first launch, or by running the /setup command, you will be prompted to enter your provider API keys. These are stored encrypted and used only for your inference requests.


⌨️ Slash Commands

Command Description
/help Show all available commands
/models List all supported models with their eco-efficiency scores
/budget View detailed budget status and limits
/history View environmental receipts for the current session
/config Edit your preferences (default model, budget limits)
/session View cumulative session statistics and planetary impact
/clear Clear the terminal screen
/exit End the session and show a final sustainability summary

📊 Supported Models & Tiers

GreenLedger categorizes models into tiers based on their energy consumption per query:

  • Nano/Light: (e.g., GPT-4.1 Nano, Claude Haiku 4.5) - Minimal footprint, best for simple tasks.
  • Standard: (e.g., Claude Sonnet 4.6, GPT-5.2 Mini) - The sweet spot for most development work.
  • Heavy/Reasoning: (e.g., Claude Opus 4.6, o3) - High impact, reserved for deep analysis and complex logic.

🛠️ Technology Stack

  • Rich & Prompt Toolkit: For the beautiful, interactive terminal UI.
  • FastAPI: Backend services for key management and routing.
  • Pydantic: Robust data validation and settings management.
  • Anthropic/OpenAI/Google SDKs: Native integration with top-tier AI providers.

📄 Documentation

For more details on the inner workings of GreenLedger, see the docs directory:

Metadata

Release files for greenledger 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for greenledger 0.1.2
File Size Uploaded
greenledger-0.1.2.tar.gz 25.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for greenledger 0.1.2
File Interpreter ABI Platform
greenledger-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 52.7 kB

Release files / greenledger-0.1.2.tar.gz

Download URL greenledger-0.1.2.tar.gz
Size 25.9 kB
Tags Source
SHA-256 checksum
How to use checksums
9b4fda9167ce42044d6cd074bbf4226242b2ad21c8a2dc2da399349ce7f2b8f4
BLAKE2b-256 checksum
How to use checksums
a535552ead4545e5455a26fd188dc705eb4815ee888c2e72397da86fc62020a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.4

Release files / greenledger-0.1.2-py3-none-any.whl

Download URL greenledger-0.1.2-py3-none-any.whl
Size 26.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3a03ee7a830f8324c65f7d14f19f542e40f3c46fde39abb13af17e5769e17cf0
BLAKE2b-256 checksum
How to use checksums
fc0094ecc8a71744b5f869ab8b15602ea077915e68f000e38972dd7160b811ac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.4

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page