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.
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.
Runs the free /sample endpoint live from this page.
# 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.
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.
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).
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:
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.
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.
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.