EIA API: Get weekly fuel prices
Gets 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.
Unofficial. Not affiliated with or endorsed by EIA.
Inputs
Values from the run on Oct 23, 2026, shown under Output.
- Area optional
area Reported U.S. area, such as US, Midwest, California, Texas, Chicago, or Denver. Example: Midwest
Chicago
Default
US.- Weeks optional
weeks Number of recent weeks, from 1 to 52. Example: 4
3
Whole number from 1 to 52. Default
1.
Input as JSON
{ "area": "Chicago", "weeks": 3}Output
{ "area": "Chicago", "history": [ { "area": "Chicago", "currency": "USD", "eia_link": "https://www.eia.gov/dnav/pet/pet_pri_gnd_dcus_yord_w.htm" , "week_date": "2026-10-19", "diesel_price_per_gallon": null, "diesel_change_from_year_ago": null, "diesel_change_from_last_week": null, "premium_gasoline_price_per_gallon": 5.991, "regular_gasoline_price_per_gallon": 4.705, "midgrade_gasoline_price_per_gallon": 5.313, "all_grades_gasoline_price_per_gallon": 4.895, "premium_gasoline_change_from_year_ago": 1.698, "regular_gasoline_change_from_year_ago": 1.524, "midgrade_gasoline_change_from_year_ago": 1.5, "premium_gasoline_change_from_last_week": 0.011, "regular_gasoline_change_from_last_week": 0.01, "midgrade_gasoline_change_from_last_week": 0.019, "all_grades_gasoline_change_from_year_ago": 1.535, "all_grades_gasoline_change_from_last_week": 0.011 }, { "area": "Chicago", "currency": "USD", "eia_link": "https://www.eia.gov/dnav/pet/pet_pri_gnd_dcus_yord_w.htm" , "week_date": "2026-10-12", "diesel_price_per_gallon": null, "diesel_change_from_year_ago": null, "diesel_change_from_last_week": null, "premium_gasoline_price_per_gallon": 5.98, "regular_gasoline_price_per_gallon": 4.695, "midgrade_gasoline_price_per_gallon": 5.294, "all_grades_gasoline_price_per_gallon": 4.884, "premium_gasoline_change_from_year_ago": 1.624, "regular_gasoline_change_from_year_ago": 1.452, "midgrade_gasoline_change_from_year_ago": 1.413, "premium_gasoline_change_from_last_week": 0.06, "regular_gasoline_change_from_last_week": 0.062, "midgrade_gasoline_change_from_last_week": 0.041, "all_grades_gasoline_change_from_year_ago": 1.461, "all_grades_gasoline_change_from_last_week": 0.06 }, { "area": "Chicago", "currency": "USD", "eia_link": "https://www.eia.gov/dnav/pet/pet_pri_gnd_dcus_yord_w.htm" , "week_date": "2026-10-05", "diesel_price_per_gallon": null, "diesel_change_from_year_ago": null, "diesel_change_from_last_week": null, "premium_gasoline_price_per_gallon": 5.92, "regular_gasoline_price_per_gallon": 4.633, "midgrade_gasoline_price_per_gallon": 5.253, "all_grades_gasoline_price_per_gallon": 4.824, "premium_gasoline_change_from_year_ago": 1.415, "regular_gasoline_change_from_year_ago": 1.224, "midgrade_gasoline_change_from_year_ago": 1.206, "premium_gasoline_change_from_last_week": -0.106, "regular_gasoline_change_from_last_week": -0.126, "midgrade_gasoline_change_from_last_week": -0.098, "all_grades_gasoline_change_from_year_ago": 1.237, "all_grades_gasoline_change_from_last_week": -0.122 } ], "currency": "USD", "eia_link": "https://www.eia.gov/dnav/pet/pet_pri_gnd_dcus_yord_w.htm" , "week_date": "2026-10-19", "diesel_price_per_gallon": null, "diesel_change_from_year_ago": null, "diesel_change_from_last_week": null, "premium_gasoline_price_per_gallon": 5.991, "regular_gasoline_price_per_gallon": 4.705, "midgrade_gasoline_price_per_gallon": 5.313, "all_grades_gasoline_price_per_gallon": 4.895, "premium_gasoline_change_from_year_ago": 1.698, "regular_gasoline_change_from_year_ago": 1.524, "midgrade_gasoline_change_from_year_ago": 1.5, "premium_gasoline_change_from_last_week": 0.011, "regular_gasoline_change_from_last_week": 0.01, "midgrade_gasoline_change_from_last_week": 0.019, "all_grades_gasoline_change_from_year_ago": 1.535, "all_grades_gasoline_change_from_last_week": 0.011}Code
curl https://api.fous.com/v1/runs \ -H "Authorization: Bearer $FOUS_API_KEY" \ -H "Content-Type: application/json" \ -d '{"method":"eia.gov/get_fuel_prices","input":{"area":"Chicago","weeks":3}}' # 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_fuel_prices" , "input": { "area": "Chicago", "weeks": 3 }})# 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_fuel_prices" , "input": { "area": "Chicago", "weeks": 3 } }), 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_fuel_prices# with {"area":"Chicago","weeks":3}"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", "properties": { "area": { "type": "string", "default": "US", "description": "Reported U.S. area, such as US, Midwest, California, Texas, Chicago, or Denver. Example: Midwest" }, "weeks": { "type": "integer", "default": 1, "maximum": 52, "minimum": 1, "description": "Number of recent weeks, from 1 to 52. Example: 4" } }}Output schema
{ "type": "object", "required": [ "area", "week_date", "currency", "eia_link", "history" ], "properties": { "area": { "type": "string" }, "history": { "type": "array", "items": { "type": "object" } }, "currency": { "enum": [ "USD" ], "type": "string" }, "eia_link": { "type": "string" }, "week_date": { "type": "string" }, "diesel_price_per_gallon": { "type": [ "number", "null" ] }, "diesel_change_from_year_ago": { "type": [ "number", "null" ] }, "diesel_change_from_last_week": { "type": [ "number", "null" ] }, "premium_gasoline_price_per_gallon": { "type": [ "number", "null" ] }, "regular_gasoline_price_per_gallon": { "type": [ "number", "null" ] }, "midgrade_gasoline_price_per_gallon": { "type": [ "number", "null" ] }, "all_grades_gasoline_price_per_gallon": { "type": [ "number", "null" ] }, "premium_gasoline_change_from_year_ago": { "type": [ "number", "null" ] }, "regular_gasoline_change_from_year_ago": { "type": [ "number", "null" ] }, "midgrade_gasoline_change_from_year_ago": { "type": [ "number", "null" ] }, "premium_gasoline_change_from_last_week": { "type": [ "number", "null" ] }, "regular_gasoline_change_from_last_week": { "type": [ "number", "null" ] }, "midgrade_gasoline_change_from_last_week": { "type": [ "number", "null" ] }, "all_grades_gasoline_change_from_year_ago": { "type": [ "number", "null" ] }, "all_grades_gasoline_change_from_last_week": { "type": [ "number", "null" ] } }}- Price
- 1 credit per completed run (1¢ with pay as you go); failed runs are free.
- Method
eia.gov/get_fuel_prices- Returns
- area, week date, regular/midgrade/premium/all-grades gasoline and diesel prices with changes, EIA link, history
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_fuel_prices with the inputs above.
Ask your agent
- What is the latest weekly retail gasoline price for the US, including regular, midgrade, and premium, and how much did it change from last week?
- Show me the on-highway diesel price for the Midwest this week compared with the same week last year.
- Give me the past 4 weeks of regular gasoline prices for California from eia.gov.
- I need the current all-grades gasoline average for Chicago along with the weekly change and a link to the EIA source.
- How have diesel prices in Denver moved over the last 12 weeks, with week-over-week and year-over-year changes?
See more
All EIA methodsGets 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.
eia.gov/get_electricity_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_pricesReturns 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_economyFinds nearby GasBuddy stations for a US or Canadian city, address or postal code and lists their reported prices for a fuel grade, lowest listed price first.
gasbuddy.com/list_cheapest_gas_stationsGets 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_pricesGets 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_rateGets decades of yearly commodity or stock-index price history from Macrotrends: yearly average, open, high, low, close, annual change and inflation-adjusted value for gold, silver, crude oil, natural gas, copper, Dow Jones, S&P 500 and Nasdaq. The current year may be incomplete.
macrotrends.net/get_long_term_price_history