Skip to content

Instantly share code, notes, and snippets.

@mrchrisadams
Last active May 1, 2026 07:49
Show Gist options
  • Select an option

  • Save mrchrisadams/16525c1a1f1385ee420b63c2736ba32e to your computer and use it in GitHub Desktop.

Select an option

Save mrchrisadams/16525c1a1f1385ee420b63c2736ba32e to your computer and use it in GitHub Desktop.
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:

  • Energy consumption (joules, watt-hours, kilowatt-hours)
  • Carbon emissions (grams CO2 equivalent)
  • Data attribution (measured vs estimated, methodology used)

Current State

Client applications like Mistral Vibe currently track:

  • Token usage (input/output tokens)
  • Cost (based on pricing per million tokens)
  • But NOT energy or carbon emissions

Proposed Energy Disclosure Standard

1. SSE Comment Format (Recommended for Streaming)

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:

  • Non-breaking: Clients that don't support energy ignore the comments
  • Streaming updates: Energy can be reported in real-time during inference
  • Simple parsing: Lines starting with : energy are clearly marked

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

  • 1 Wh = 3,600 J
  • 1 kWh = 3,600,000 J = 1,000 Wh
  • 1 Wms (Watt-millisecond) = 1/3,600,000 Wh

Carbon Calculation

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

Typical grid intensities:

  • Global average: 400-500 gCO2/kWh
  • Low-carbon grids (France, Norway): 20-100 gCO2/kWh
  • High-carbon grids: 600+ gCO2/kWh

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

@geethking

Copy link
Copy Markdown

***

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment