block by mrchrisadams 16525c1a1f1385ee420b63c2736ba32e

Energy Tracking Implementation Plan for Mistral Vibe

Energy Disclosure Standard for AI Providers

Executive Summary

This document defines a standard for AI providers (such as Mistral) to disclose energy consumption and carbon emissions data through their APIs. The goal is to enable clients to track and report the environmental impact of AI usage.

Background

AI model inference consumes significant energy. Users and organizations increasingly want visibility into:

Current State

Client applications like Mistral Vibe currently track:

Proposed Energy Disclosure Standard

Providers SHOULD send energy data as SSE (Server-Sent Events) comments alongside the main response stream.

Format:

: energy {"energy_joules": <float>, "energy_kwh": <float>, "wh": <float>, "g_co2e": <float>, "source": "measured", "provider": "<provider>"}

Example:

data: {"choices": [{"delta": {"content": "Hello"}}]}
: energy {"energy_joules": 500.0, "energy_kwh": 1.39e-07, "wh": 0.000139, "source": "measured", "provider": "mistral-datacenter", "method": "direct"}
data: {"choices": [{"delta": {"content": " world"}}]}
data: [DONE]

Advantages:

2. Response Body Format (For Non-Streaming)

Providers SHOULD include energy data in the usage object of the response body.

Format:

{
  "choices": [...],
  "usage": {
    "prompt_tokens": 100,
    "completion_tokens": 50,
    "energy": {
      "joules": 1500.0,
      "kwh": 4.167e-07,
      "wh": 0.000417,
      "g_co2e": 0.000167,
      "source": "measured",
      "provider": "mistral-datacenter",
      "method": "direct-instrumentation",
      "grid_carbon_intensity": 400.0
    }
  }
}

3. Response Header Format (Alternative)

Providers MAY include energy data in response headers for simple integrations.

Header: X-Energy-Data

Example:

X-Energy-Data: {"energy_joules": 1500.0, "source": "measured"}

Required Fields

Field Type Required Description
joules float Recommended Energy in joules (SI unit)
kwh float Recommended Energy in kilowatt-hours (billing unit)
wh float Recommended Energy in watt-hours (convenient unit)
g_co2e float Recommended Carbon emissions in grams CO2 equivalent
source string Required "measured" or "estimated"
provider string Recommended Provider/datacenter identifier
method string Recommended Attribution method (e.g., "direct", "proportional")

Energy Unit Conversions

Carbon Calculation

Carbon emissions (gCO2e) = Energy (kWh) × Grid Carbon Intensity (gCO2/kWh)

Typical grid intensities:

Implementation for Mistral Vibe

The proposed implementation adds:

  1. Energy Capture Module (vibe/core/llm/energy_capture.py)

    • Parses SSE comments and response body for energy data
    • Supports Neuralwatt and GreenPT formats
    • Provides fallback estimation when provider doesn’t support energy disclosure
  2. Extended AgentStats (vibe/core/types.py)

    • Tracks session and per-turn energy consumption
    • Accumulates carbon emissions
    • Distinguishes measured vs estimated energy
  3. Backend Integration (vibe/core/llm/backend/generic.py)

    • Captures energy data from SSE streams
    • Stores energy in response headers

Example Client Usage

from vibe.core.types import AgentStats

stats = AgentStats()

# After each LLM call, energy is automatically updated
stats.update_energy(measured_energy_data)

# Display to user
print(f"Energy: {stats.session_energy.energy_summary}")
print(f"Carbon: {stats.session_energy.carbon_summary}")
print(f"Source: {stats.session_energy.source}")

Benefits to Providers

Implementing energy disclosure:

  1. Transparency: Shows commitment to environmental responsibility
  2. Trust: Users can verify sustainability claims
  3. Differentiation: Stand out in a competitive market
  4. Future-proofing: Prepare for potential regulations

Call to Action

We propose that Mistral and other AI providers:

  1. Implement the SSE comment format for streaming energy disclosure
  2. Include energy data in non-streaming response bodies
  3. Document the methodology used for energy measurement/estimation
  4. Report both energy and carbon emissions where possible

This standard enables a new generation of energy-aware AI clients that help users understand and minimize their environmental impact.

References