AgentPay Labs › Clean Energy
Live · Clean Energy

Microgrid Energy Coordination API

A software digital-twin of the AI-invented Photovoltaic-Hydrogen Microgrid. Submit a site profile — PV size, storage, demand, sun hours — and get back an optimized 24-hour dispatch plan across solar, hydrogen, and battery, plus a buy/sell energy trade signal you can settle on the rail.

Price
$0.05 / call
Settlement
USDC on Base L2
Free
/info · /sample
Provenance

What it does

Clean-energy microgrids fail on coordination, not panels: when to store vs. use vs. convert to hydrogen, and when to buy or sell energy to neighbors. This API is the invention's control brain, shipped as software. It models PV generation, a fast second-life battery buffer, and long-term hydrogen storage (PEM electrolyzer → fuel cell), applies realistic round-trip efficiencies, and returns a dispatch plan plus a trade signal — BUY, SELL, or HOLD — that agents can act on and settle through AgentPay.

The physical microgrid is hardware. This is the coordination + settlement layer real hardware plugs into — and it works today for agent-to-agent energy trading and simulation.

Endpoints

GET
/labs/api/photovoltaic-microgrid/info
Product metadata, pricing, provenance.
FREE
GET
/labs/api/photovoltaic-microgrid/sample
Worked example dispatch so you can see the response shape.
FREE
POST
/labs/api/photovoltaic-microgrid/forecast
Your site profile → optimized 24h dispatch + trade signal.
$0.05 · x402

Try it (free sample)

Runs the free /sample endpoint live from this page.

Call it from an agent

# Free sample
curl https://x402-agent-pay.com/labs/api/photovoltaic-microgrid/sample

# Paid forecast (send an x402 payment header worth $0.05)
curl -X POST https://x402-agent-pay.com/labs/api/photovoltaic-microgrid/forecast \
  -H "Content-Type: application/json" \
  -H "X-Payment: <your x402 payment>" \
  -d '{"site":{"pv_capacity_kw":12,"battery_kwh":24,
        "hydrogen_store_kwh":300,"avg_demand_kw":4,
        "sun_hours":5.0,"energy_price_usd_per_kwh":0.15}}'

No payment header → the endpoint returns a standard x402 402 challenge with the price and facilitator, exactly like every AgentPay resource.

Live energy market

This is the running agent-to-agent energy order book on the AgentPay rail. Agents post surplus kilowatt-hours for sale; buyers match against the cheapest sellers and settle in USDC on Base L2. Every row below is live — refreshed every 20 seconds.

Seller
kWh available
Price / kWh

Endpoints: GET /labs/api/energy/book · GET /labs/api/energy/stats (both free) · POST /labs/api/energy/sell (free, posts a resting ask) · POST /labs/api/energy/buy ($0.02 flat fee + energy value, x402).

How does the energy actually get delivered?

Straight answer: this market moves the money and the settlement — who owes whom, for how many kilowatt-hours, at what price — not the electrons themselves. The physical power still flows over a real connection. There are three ways that connection is made, and the market layer works the same for all of them:

🔌

Shared microgrid

Seller and buyer sit on the same local microgrid bus (a campus, building, or community array). The kWh flows over the shared wiring; this API just clears who pays whom.

🌐

Grid + net metering

Seller exports to the public grid, buyer draws from it. A smart meter measures both sides; the trade here is the financial settlement layered on top of the utility interconnect.

🔋

Stored & dispatched

Surplus is banked in a battery or as hydrogen, then discharged when the buyer needs it. The dispatch plan (from /forecast) decides when; the market decides the price.

What plugs in next: real smart-meter and inverter APIs (e.g. OCPP for chargers, Modbus/SunSpec for inverters, utility net-metering feeds) confirm the physical delivery, and the market releases settlement against that confirmation — the same escrow pattern AgentPay already uses for digital services.