Skip to content

Sustainability Dashboard API

Get comprehensive sustainability metrics in a single request.

GET /v1/sustainability/dashboard

Overview

The Dashboard endpoint returns all sustainability data needed for a complete overview:

  • Summary KPIs - Total carbon, energy, efficiency score
  • Time series - Carbon and energy over time
  • Efficiency breakdown - Score components
  • Optimization opportunities - Top recommendations

This is the recommended endpoint for initial dashboard load.

Request

bash
curl "https://api.gateflow.ai/v1/sustainability/dashboard?time_range=last_7_days" \
  -H "Authorization: Bearer gw_prod_..."
python
import requests

response = requests.get(
    "https://api.gateflow.ai/v1/sustainability/dashboard",
    headers={"Authorization": "Bearer gw_prod_..."},
    params={
        "time_range": "last_7_days",
        "project_id": "proj_abc123"
    }
)
typescript
const response = await fetch(
  'https://api.gateflow.ai/v1/sustainability/dashboard?time_range=last_7_days',
  {
    headers: {
      'Authorization': 'Bearer gw_prod_...',
    },
  }
);

Parameters

ParameterTypeRequiredDefaultDescription
start_datedateNo-Start date (YYYY-MM-DD)
end_datedateNo-End date (YYYY-MM-DD)
time_rangestringNolast_7_daysPreset: last_7_days, last_30_days, this_month, this_quarter
project_idstringNonullFilter by project
team_idstringNonullFilter by team

Response

json
{
  "summary": {
    "total_carbon_gco2e": 1250.5,
    "total_energy_kwh": 2.5,
    "total_requests": 15000,
    "avg_carbon_per_request_gco2e": 0.083,
    "efficiency_score": 78,
    "carbon_trend_percent": -12.5,
    "breakdown_by_model": [
      {"model": "gpt-4o", "carbon_gco2e": 450.2, "percentage": 36.0},
      {"model": "claude-sonnet-4-5", "carbon_gco2e": 350.1, "percentage": 28.0}
    ],
    "breakdown_by_provider": [
      {"provider": "openai", "carbon_gco2e": 650.3, "percentage": 52.0},
      {"provider": "anthropic", "carbon_gco2e": 400.2, "percentage": 32.0}
    ]
  },
  "time_series": [
    {
      "date": "2024-01-09",
      "carbon_gco2e": 180.5,
      "energy_kwh": 0.36,
      "requests": 2150
    },
    {
      "date": "2024-01-10",
      "carbon_gco2e": 175.2,
      "energy_kwh": 0.35,
      "requests": 2100
    }
  ],
  "efficiency": {
    "overall_score": 78,
    "components": {
      "carbon_savings_rate": {"score": 82, "weight": 0.4},
      "cache_hit_rate": {"score": 65, "weight": 0.3},
      "grid_efficiency": {"score": 85, "weight": 0.3}
    },
    "grade": "B+",
    "percentile": 75
  },
  "opportunities": [
    {
      "type": "model_downgrade",
      "title": "Use smaller models for simple tasks",
      "description": "15% of requests use GPT-4o for simple Q&A tasks",
      "potential_savings_kg_co2": 2.5,
      "implementation": "Enable intelligent routing with model=auto"
    },
    {
      "type": "enable_caching",
      "title": "Enable semantic caching",
      "description": "Detected 25% duplicate queries that could be cached",
      "potential_savings_kg_co2": 1.8,
      "implementation": "Set caching=enabled in project settings"
    }
  ]
}

Response Fields

FieldTypeDescription
summaryobjectAggregated KPIs
summary.total_carbon_gco2enumberTotal carbon emissions in grams CO₂e
summary.total_energy_kwhnumberTotal energy consumption in kWh
summary.efficiency_scoreintegerOverall efficiency (0-100)
summary.carbon_trend_percentnumberChange vs previous period
time_seriesarrayDaily/hourly data points
efficiencyobjectScore breakdown
opportunitiesarrayTop 5 optimization recommendations

Time Range Presets

PresetDescription
last_7_daysPast 7 days including today
last_30_daysPast 30 days including today
this_monthCurrent calendar month
this_quarterCurrent calendar quarter

Efficiency Score Components

The efficiency score (0-100) is calculated from three components:

ComponentWeightDescription
Carbon Savings Rate40%% carbon saved vs baseline
Cache Hit Rate30%% requests served from cache
Grid Efficiency30%Grid carbon intensity vs global average

See Also

Built with reliability in mind.