GasBuddy API: Get average gas prices
Gets 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.
Unofficial. Not affiliated with or endorsed by GasBuddy.
Inputs
Values from the run on Oct 31, 2026, shown under Output.
- Location, required
location US state name or two-letter code, or city and state, for example "Chicago, IL".
Chicago, IL
Input as JSON
{ "location": "Chicago, IL"}Output
{ "place": "Chicago, IL", "currency": "USD", "gasbuddy_link": "https://fuelinsights.gasbuddy.com/#Home/US/Illinois/Chicago" , "last_updated_date": "2026-09-28", "diesel_price_per_gallon": 6.816, "premium_price_per_gallon": null, "regular_price_per_gallon": 4.866, "midgrade_price_per_gallon": null, "regular_change_from_week_ago": -0.177, "regular_change_from_year_ago": 1.281, "regular_change_from_month_ago": 0.436, "regular_change_from_yesterday": 0.009, "lowest_regular_price_per_gallon": null, "highest_regular_price_per_gallon": null}Code
curl https://api.fous.com/v1/runs \ -H "Authorization: Bearer $FOUS_API_KEY" \ -H "Content-Type: application/json" \ -d '{"method":"gasbuddy.com/get_average_gas_prices","input":{"location":"Chicago, IL"}}' # 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": "gasbuddy.com/get_average_gas_prices" , "input": { "location": "Chicago, IL" }})# 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": "gasbuddy.com/get_average_gas_prices" , "input": { "location": "Chicago, IL" } }), 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 gasbuddy.com/get_average_gas_prices# with {"location":"Chicago, IL"}"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": [ "location" ], "properties": { "location": { "type": "string", "description": "US state name or two-letter code, or city and state, for example \"Chicago, IL\"." } }}Output schema
{ "type": "object", "required": [ "place", "currency", "regular_price_per_gallon", "midgrade_price_per_gallon", "premium_price_per_gallon", "diesel_price_per_gallon", "regular_change_from_yesterday", "regular_change_from_week_ago", "regular_change_from_month_ago", "regular_change_from_year_ago", "lowest_regular_price_per_gallon", "highest_regular_price_per_gallon", "last_updated_date", "gasbuddy_link" ], "properties": { "place": { "type": "string", "description": "State or GasBuddy metro area." }, "currency": { "enum": [ "USD" ], "type": "string", "description": "Currency of all prices and changes." }, "gasbuddy_link": { "type": "string" }, "last_updated_date": { "type": [ "string", "null" ], "format": "date", "description": "Date of the latest reported average, not necessarily today." }, "diesel_price_per_gallon": { "type": [ "number", "null" ] }, "premium_price_per_gallon": { "type": [ "number", "null" ] }, "regular_price_per_gallon": { "type": [ "number", "null" ] }, "midgrade_price_per_gallon": { "type": [ "number", "null" ] }, "regular_change_from_week_ago": { "type": [ "number", "null" ] }, "regular_change_from_year_ago": { "type": [ "number", "null" ] }, "regular_change_from_month_ago": { "type": [ "number", "null" ] }, "regular_change_from_yesterday": { "type": [ "number", "null" ] }, "lowest_regular_price_per_gallon": { "type": [ "number", "null" ] }, "highest_regular_price_per_gallon": { "type": [ "number", "null" ] } }, "additionalProperties": false}- Price
- 1 credit per completed run (1¢ with pay as you go); failed runs are free.
- Method
gasbuddy.com/get_average_gas_prices- Returns
- place, regular price, regular price changes (day, week, month, year), diesel price, last updated date, GasBuddy 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 gasbuddy.com/get_average_gas_prices with the inputs above.
Ask your agent
- What's the average price of regular gas in Ohio right now, and how much has it changed since last week?
- Check gasbuddy.com for the current average regular and diesel prices in Phoenix, AZ.
- How does today's average regular unleaded price in Colorado compare to a year ago?
- Pull the GasBuddy average gas price for Atlanta, GA, including the monthly change and the diesel average.
- I'm driving through TX tomorrow. What's the statewide average for regular fuel and diesel, and when was it last updated?
See more
All GasBuddy methodsFinds 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 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 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 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_pricesFinds the US Costco warehouses nearest a city, address or ZIP code, with today's and weekly hours, gas station hours, services and posted gas prices.
costco.com/search_warehousesGets 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 current average used asking price, the CarGurus price range and the 12-month price history for a model year (all trims), from CarGurus price trends.
cargurus.com/get_market_valueGets Zumper's current median monthly rents for studio through three-bedroom homes in a city, with monthly and yearly percentage changes. National rank is included only when the same-month U.S. national report ranks the city.
zumper.com/get_average_rents