EIA API: Get electricity prices
Gets a state's latest monthly electricity price for a customer type from EIA. It also returns the year-over-year change, the year-to-date average and the matching US average.
Unofficial. Not affiliated with or endorsed by EIA.
Inputs
Values from the run on Oct 23, 2026, shown under Output.
- State, required
state US state name or two-letter code, or US. Example: California.
California
- Customer Type optional
customer_type Customer sector: residential, commercial, industrial, transportation, or all; home and business are accepted. Example: home.
residential (default)
Input as JSON
{ "state": "California"}Output
{ "state": "California", "eia_link": "https://www.eia.gov/electricity/monthly/epm_table_grapher.php?t=epmt_5_6_a" , "latest_month": "2026-07", "customer_type": "Residential", "change_percent": 2.91, "us_average_cents_per_kwh": 18.31, "average_price_cents_per_kwh": 33.61, "price_year_earlier_cents_per_kwh": 32.66, "year_to_date_average_cents_per_kwh": 33.25}Code
curl https://api.fous.com/v1/runs \ -H "Authorization: Bearer $FOUS_API_KEY" \ -H "Content-Type: application/json" \ -d '{"method":"eia.gov/get_electricity_prices","input":{"state":"California"}}' # Save as fous.py, then run: python3 fous.pyimport json, os, timefrom urllib.error import HTTPErrorfrom urllib.request import Request, urlopenAPI = "https://api.fous.com/v1/runs" KEY = os.environ["FOUS_API_KEY"]HEADERS = { "Authorization": f"Bearer {KEY}", "Content-Type": "application/json" ,}def call(url, body=None): data = json.dumps(body).encode() if body else None request = Request(url, data, HEADERS) try: with urlopen(request, timeout=120) as r: return r.status, json.load(r) except HTTPError as error: message = json.load(error)["error"]["message"] raise RuntimeError(message) from errorstatus, run = call(API, { "method": "eia.gov/get_electricity_prices" , "input": { "state": "California" }})# 202: still going after 30 s. Ask again until it ends.while status == 202: time.sleep(2) status, run = call(f"{API}/{run['id']}")print(json.dumps(run["data"], indent=2))// Save as fous.mjs, then run: node fous.mjsconst api = "https://api.fous.com/v1/runs" ;const headers = { Authorization: `Bearer ${process.env.FOUS_API_KEY}`, "Content-Type": "application/json" ,};let response = await fetch(api, { method: "POST", headers, body: JSON.stringify({ "method": "eia.gov/get_electricity_prices" , "input": { "state": "California" } }), signal: AbortSignal.timeout(120_000),});let run = await response.json();// 202: still going after 30 s. Ask again until it ends.while (response.status === 202) { await new Promise((done) => setTimeout(done, 2_000)); response = await fetch(`${api}/${run.id}`, { headers }); run = await response.json();}if (!response.ok) throw new Error(run.error.message);console.log(run.data);# Connect your agent to Fous once, over MCP (Streamable HTTP):# https://api.fous.com/mcp# Set FOUS_API_KEY first: create a key at https://app.fous.com/keys.# Claude Codeclaude mcp add \ --scope user \ --transport http fous https://api.fous.com/mcp \ --header "Authorization: Bearer ${FOUS_API_KEY:?Set FOUS_API_KEY to your Fous API key}"# Codexcodex mcp add fous \ --url https://api.fous.com/mcp \ --bearer-token-env-var FOUS_API_KEY# Cursor, VS Code, Windsurf, Cline and morenpx -y add-mcp https://api.fous.com/mcp -g -n fous \ --header "Authorization: Bearer ${FOUS_API_KEY:?Set FOUS_API_KEY to your Fous API key}"# Then ask your agent:# "Use Fous to run eia.gov/get_electricity_prices# with {"state":"California"}"Over HTTP, the answer’s data holds the output. A run still going after 30 seconds answers 202 with its id: ask GET /v1/runs/{id} until it ends.
Schema
Input schema
{ "type": "object", "required": [ "state" ], "properties": { "state": { "type": "string", "description": "US state name or two-letter code, or US. Example: California." }, "customer_type": { "type": "string", "default": "residential", "description": "Customer sector: residential, commercial, industrial, transportation, or all; home and business are accepted. Example: home." } }}Output schema
{ "type": "object", "required": [ "state", "customer_type", "latest_month", "eia_link" ], "properties": { "state": { "type": "string" }, "eia_link": { "type": "string" }, "latest_month": { "type": "string" }, "customer_type": { "type": "string" }, "change_percent": { "type": [ "number", "null" ] }, "us_average_cents_per_kwh": { "type": [ "number", "null" ] }, "average_price_cents_per_kwh": { "type": [ "number", "null" ] }, "price_year_earlier_cents_per_kwh": { "type": [ "number", "null" ] }, "year_to_date_average_cents_per_kwh": { "type": [ "number", "null" ] } }}- Price
- 1 credit per completed run (1¢ with pay as you go); failed runs are free.
- Method
eia.gov/get_electricity_prices- Returns
- state, customer type, latest month, price, price a year earlier, change percent, year-to-date average, US average, EIA link
Use it from your agent
Give your agent this line. It reads SKILL.md, gets a Fous API key and connects the Fous MCP server. Its run then takes the method eia.gov/get_electricity_prices with the inputs above.
Ask your agent
- What is the latest residential electricity price in California and how does it compare to a year ago?
- How much do businesses in Texas pay per kWh for electricity right now, and is that above the national average?
- Show me the newest monthly power rate for home customers in Ohio with the year-to-date average.
- I need the current industrial electricity price in Washington state versus the US average, with the percent change from last year.
- On eia.gov, what's the most recent commercial electricity cost in Florida and where can I find the source?
See more
All EIA methodsGets the latest weekly EIA retail gasoline and on-highway diesel prices for a U.S. area, with changes from the prior week and from 52 weeks earlier.
eia.gov/get_fuel_pricesGets AAA average gasoline and diesel prices for the US, a state, or a metro area listed on its state page, with yesterday, week, month and year-ago comparisons and record highs, as of the date AAA shows.
gasprices.aaa.com/get_gas_pricesGets GasBuddy's latest reported average regular gas price, its changes and the diesel benchmark for a US state or a listed metro area. Midgrade, premium and area low/high prices are not published with these averages; updates may lag the current day.
gasbuddy.com/get_average_gas_pricesGets current commodity prices and price movements from the Trading Economics commodities page, in the page's group order; filter by a commodity name, slug, symbol or group (e.g. copper, energy), or leave blank for all groups including Electricity.
tradingeconomics.com/get_commodity_pricesLooks up an official Eurostat statistic for an EU or EEA country and the EU27 figure for the same period. Quarterly and half-yearly series return the reporting period that contains a requested month.
ec.europa.eu/get_statisticGets a city's current Numbeo cost of living indices, monthly estimates without rent, and typical prices. Add a country or state to tell apart cities with the same name.
numbeo.com/get_cost_of_livingGets the latest U.S. Consumer Price Index inflation for a spending category, with up to 24 recent months of history. Monthly changes are seasonally adjusted; 12-month changes are not.
bls.gov/get_inflation_rateReturns official MPG or MPGe, range, annual fuel cost, five-year savings and emissions for every matching version of a vehicle. Costs use current fuel prices and 15,000 miles per year; plug-in hybrid costs include gasoline and electricity.
fueleconomy.gov/get_fuel_economy