Skip to content

boettiger-lab/nrp-carbon-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NRP Carbon API

A lightweight Go service that estimates the carbon footprint of LLM inference on the National Research Platform (NRP) Nautilus Kubernetes cluster.

Live dashboard: https://carbon-api.nrp-nautilus.io

Credits

This project is based upon the original NRP LLM Dashboard from [@ZihaoZhou], source repository: https://github.com/ZihaoZhou/nautilus-llm-status.

How it works

  1. GPU power is read from NVIDIA DCGM Exporter metrics already collected by the cluster's Prometheus instance.
  2. Token throughput is read from vLLM's built-in Prometheus metrics.
  3. Grid carbon intensity is looked up per node using EPA eGRID 2022 subregion averages (see internal/carbon/intensity.go).

Carbon = Energy x Grid Intensity. See the Methodology page for full details.

Running locally

export PROMETHEUS_URL=https://prometheus.nrp-nautilus.io
go run ./cmd
# → http://localhost:8080

Deploying to NRP

Build and push the container image, then apply the Kubernetes manifests:

docker build -t ghcr.io/boettiger-lab/carbon-api:latest .
docker push ghcr.io/boettiger-lab/carbon-api:latest
kubectl apply -f k8s/deployment.yaml
kubectl -n biodiversity rollout restart deployment/carbon-api

API

Endpoint Description
GET /api/v1/carbon Current metrics for all models
GET /api/v1/carbon/timeseries?range=24h|7d|30d Cluster-wide CO2 and power time series
GET /api/v1/carbon/{ns}/{container}/{metric}?range=... Per-model time series (power_watts, co2_grams_per_hour, co2_mg_per_token)
GET /healthz Health check

License

BSD 2-Clause

About

Monitoring carbon footprint of LLMs on NRP

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors