Estimate energy and CO2e
cloudcdn_carbonEstimate CloudCDN traffic energy use and CO2e emissions by region and total over 1–30 days for sustainability reports or carbon-aware deploy gating.
Instructions
Estimate the energy (kWh) and emissions (grams CO2e) of CloudCDN traffic over the last N days, per region and in total, for sustainability reporting or as a carbon-aware deploy gate. For money use cloudcdn_cost, which reads the same usage: GET /api/billing/usage when the API has it (cloudcdn.pro answers 404 today), otherwise the account totals of GET /api/core/statistics as a single region named "global", with no split by region. Energy is computed locally at 0.0000001 kWh per request plus 0.0002 kWh per GB; grid intensity is a built-in average per region (400 g/kWh for a region it does not know), or the live value from api.electricitymap.org when the API tags a region with an electricity_maps_zone. Returns JSON: days; regions, each with region, requests, bandwidth_gb, compute_kwh, transfer_kwh, total_kwh, intensity_g_per_kwh, intensity_source ("static" or "electricity_maps") and co2e_g; and totals (total_kwh, total_co2e_g). With intensity-below set it also returns threshold and cleanest (the lowest regional intensity), and unless cleanest is below threshold the call fails with exit code 69, still carrying the report. Read-only. Fails: no CLOUDCDN_ACCOUNT_KEY, a JSON-RPC error; days outside 1..30, exit code 64; statistics without request and bandwidth totals, exit code 69, instead of reporting zero usage.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "cloudcdn_carbon"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| days | No | Look-back window in days, 1 to 30. Default 7. | |
| region | No | One region, as named in the region field of an earlier cloudcdn_carbon or cloudcdn_cost result, e.g. "eu-north"; passed to the billing endpoint as is. The statistics fallback ignores it and still reports "global". | |
| intensity-below | No | Deploy-gate threshold in g CO2e/kWh, e.g. 250: the call succeeds only if some region's intensity is below it. Omit to report without gating. |