# GasBuddy API

> GasBuddy returns nearby station prices and average gas prices as a workflow and API.

GasBuddy (Gas Buddy) lists nearby stations and reported fuel prices for a US or Canadian city, address, or postal code. Get average gas prices returns reported averages and regular-price changes for a US state or listed metro area, using its name or code.

- Page: https://fous.com/tools/gasbuddy
- Handle: `@gasbuddy`
- Category: [Energy](https://fous.com/tools/category/energy)
- Source website: https://gasbuddy.com
- Last verified: Sep 29, 2026

## Methods

### Get average gas prices

Operation `get_average_gas_prices`, version 1. 1 credit per completed call. Failed calls without a completed billing receipt are free; completed work can remain charged if delivery is interrupted.

Get GasBuddy’s latest reported average prices and regular-price changes for a US state or listed metro area. Midgrade, premium and current-area low/high prices are not published with these averages; updates may lag the current day.

**Input**

| Field | Type | Required | Example | Description |
|---|---|---|---|---|
| `location` | string | yes | `"Ohio"` | US state name or two-letter code, or city and state, for example "Chicago, IL". |

**Input schema**

```json
{
  "type": "object",
  "required": [
    "location"
  ],
  "properties": {
    "location": {
      "type": "string",
      "description": "US state name or two-letter code, or city and state, for example \"Chicago, IL\".",
      "examples": [
        "Ohio",
        "Chicago, IL",
        "OH"
      ]
    }
  },
  "additionalProperties": false,
  "examples": [
    {
      "location": "Ohio"
    },
    {
      "location": "Chicago, IL"
    },
    {
      "location": "OH"
    }
  ]
}
```

**Output**

| Field | Type | Example | Description |
|---|---|---|---|
| `place` | string | `"Ohio"` | State or GasBuddy metro area. |
| `currency` | string | `"USD"` | Currency of all prices and changes. |
| `gasbuddy_link` | string | `"https://fuelinsights.gasbuddy.com/#Home/US/Ohio"` |  |
| `last_updated_date` | string or null | `"2026-09-28"` | Date of the latest reported average, not necessarily today. |
| `diesel_price_per_gallon` | number or null | `6.735` |  |
| `premium_price_per_gallon` | number or null |  |  |
| `regular_price_per_gallon` | number or null | `4.269` |  |
| `midgrade_price_per_gallon` | number or null |  |  |
| `regular_change_from_week_ago` | number or null | `-0.218` |  |
| `regular_change_from_year_ago` | number or null | `1.421` |  |
| `regular_change_from_month_ago` | number or null | `0.395` |  |
| `regular_change_from_yesterday` | number or null | `-0.037` |  |
| `lowest_regular_price_per_gallon` | number or null |  |  |
| `highest_regular_price_per_gallon` | number or null |  |  |

**Example input**

```json
{
  "location": "Ohio"
}
```

**Example output**

```json
{
  "place": "Ohio",
  "currency": "USD",
  "gasbuddy_link": "https://fuelinsights.gasbuddy.com/#Home/US/Ohio",
  "last_updated_date": "2026-09-28",
  "diesel_price_per_gallon": 6.735,
  "premium_price_per_gallon": null,
  "regular_price_per_gallon": 4.269,
  "midgrade_price_per_gallon": null,
  "regular_change_from_week_ago": -0.218,
  "regular_change_from_year_ago": 1.421,
  "regular_change_from_month_ago": 0.395,
  "regular_change_from_yesterday": -0.037,
  "lowest_regular_price_per_gallon": null,
  "highest_regular_price_per_gallon": null
}
```

### List cheapest gas stations

Operation `list_cheapest_gas_stations`, version 1. 1 credit per completed call. Failed calls without a completed billing receipt are free; completed work can remain charged if delivery is interrupted.

Find nearby GasBuddy stations and their reported fuel prices for a US or Canadian city, address, or postal code. Results are ordered by listed price among nearby search results; prices may be missing or out of date.

**Input**

| Field | Type | Required | Example | Description |
|---|---|---|---|---|
| `location` | string | yes | `"Denver, CO"` | US or Canadian city, street address, or postal code, such as Denver, CO or 90210. |
| `fuel_type` | string | no | `"premium"` | Fuel grade, such as premium. Defaults to regular. |
| `max_results` | integer | no | `50` | Maximum number of stations, such as 20. Defaults to 20; maximum 50. |

**Input schema**

```json
{
  "type": "object",
  "required": [
    "location"
  ],
  "properties": {
    "location": {
      "type": "string",
      "description": "US or Canadian city, street address, or postal code, such as Denver, CO or 90210.",
      "examples": [
        "Denver, CO",
        "Los Angeles, CA",
        "90210"
      ]
    },
    "fuel_type": {
      "enum": [
        "regular",
        "midgrade",
        "premium",
        "diesel"
      ],
      "type": "string",
      "default": "regular",
      "description": "Fuel grade, such as premium. Defaults to regular.",
      "examples": [
        "premium",
        "diesel"
      ]
    },
    "max_results": {
      "type": "integer",
      "default": 20,
      "maximum": 50,
      "minimum": 1,
      "description": "Maximum number of stations, such as 20. Defaults to 20; maximum 50.",
      "x-fous-developer": true,
      "examples": [
        50,
        25,
        20
      ]
    }
  },
  "additionalProperties": false,
  "examples": [
    {
      "location": "Denver, CO"
    },
    {
      "location": "Los Angeles, CA",
      "fuel_type": "premium",
      "max_results": 50
    },
    {
      "location": "90210"
    }
  ]
}
```

**Output**

| Field | Type | Example | Description |
|---|---|---|---|
| `stations` | array |  | Nearby stations, lowest listed price first, stations without a price last. |
| `stations[].city` | string or null | `"Denver"` | City. |
| `stations[].unit` | string | `"gallon"` | gallon or litre. |
| `stations[].brand` | string or null | `"Sam's Club"` | Fuel or store brand. |
| `stations[].price` | number or null | `3.57` | Listed price for the selected fuel in the stated currency and unit. |
| `stations[].currency` | string | `"USD"` | USD or CAD. |
| `stations[].latitude` | number or null | `39.769096133279` | Station latitude. |
| `stations[].reported` | string or null | `"5 Hours Ago"` | Approximate age of the selected price, such as 2 Hours Ago. |
| `stations[].longitude` | number or null | `-104.899241924286` | Station longitude. |
| `stations[].cash_price` | number or null | `6.09` | Cash price for the selected fuel when reported. |
| `stations[].price_type` | string or null | `"credit"` | Cash or credit for the listed price. |
| `stations[].station_id` | string | `"25649"` | GasBuddy station ID. |
| `stations[].star_rating` | number or null | `4.3` | Star rating when shown. |
| `stations[].credit_price` | number or null | `3.57` | Credit price for the selected fuel when reported. |
| `stations[].station_link` | string | `"https://www.gasbuddy.com/station/25649"` | GasBuddy page for the station. |
| `stations[].station_name` | string or null | `"Sam's Club"` | Name shown for the station. |
| `stations[].street_address` | string or null | `"7805 E 35th Ave"` | Street address. |

**Example input**

```json
{
  "location": "Denver, CO"
}
```

**Example output**

```json
{
  "stations": [
    {
      "city": "Denver",
      "unit": "gallon",
      "brand": "Sam's Club",
      "price": 3.57,
      "currency": "USD",
      "latitude": 39.769096133279,
      "reported": "5 Hours Ago",
      "longitude": -104.899241924286,
      "cash_price": null,
      "price_type": "credit",
      "station_id": "25649",
      "star_rating": 4.3,
      "credit_price": 3.57,
      "station_link": "https://www.gasbuddy.com/station/25649",
      "station_name": "Sam's Club",
      "street_address": "7805 E 35th Ave"
    },
    {
      "city": "Denver",
      "unit": "gallon",
      "brand": "Costco",
      "price": 3.59,
      "currency": "USD",
      "latitude": 39.781004,
      "reported": "1 Hour Ago",
      "longitude": -104.796366,
      "cash_price": null,
      "price_type": "credit",
      "station_id": "208619",
      "star_rating": 5,
      "credit_price": 3.59,
      "station_link": "https://www.gasbuddy.com/station/208619",
      "station_name": "Costco",
      "street_address": "4741 N Airport WayE"
    },
    {
      "city": "Denver",
      "unit": "gallon",
      "brand": "Maverik",
      "price": 3.59,
      "currency": "USD",
      "latitude": 39.784177313031,
      "reported": "26 Minutes Ago",
      "longitude": -104.797430634499,
      "cash_price": null,
      "price_type": "credit",
      "station_id": "201189",
      "star_rating": 4.4,
      "credit_price": 3.59,
      "station_link": "https://www.gasbuddy.com/station/201189",
      "station_name": "Maverik",
      "street_address": "16351 Green Valley Ranch Blvd"
    }
  ]
}
```

## Quick start

Replace `YOUR_API_KEY` with a Fous API key. To create one, open Developers at the bottom of Fous Studio, turn on Developer mode, then go to API keys (https://app.fous.com/keys). Change the values in `input` to run the same tool on new data.

```bash
curl 'https://api.fous.com/v1/query' \
  --fail-with-body --silent --show-error --max-time 180 \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "api": "@gasbuddy",
  "visibility": "public",
  "operation": "get_average_gas_prices",
  "version": 1,
  "input": {
    "location": "Ohio"
  },
  "response": {
    "format": "json"
  }
}'
```

```python
# Save as fous.py and run with python3 fous.py. No packages needed.
import json
import urllib.error
import urllib.request

api_key = "YOUR_API_KEY"

body = json.loads("{\n  \"api\": \"@gasbuddy\",\n  \"visibility\": \"public\",\n  \"operation\": \"get_average_gas_prices\",\n  \"version\": 1,\n  \"input\": {\n    \"location\": \"Ohio\"\n  },\n  \"response\": {\n    \"format\": \"json\"\n  }\n}")
request = urllib.request.Request(
    "https://api.fous.com/v1/query",
    data=json.dumps(body).encode("utf-8"),
    headers={
        "Authorization": f"Bearer {api_key}",
        "Content-Type": "application/json",
    },
    method="POST",
)
try:
    with urllib.request.urlopen(request, timeout=180) as response:
        result = json.load(response)
except urllib.error.HTTPError as error:
    raise RuntimeError(f"HTTP {error.code}: {error.read().decode('utf-8', errors='replace')}") from error
if result.get("success") is False:
    raise RuntimeError(result.get("error", {}).get("message", "Request failed"))
print(json.dumps(result["data"]["output"], indent=2))
```

```typescript
// Save as fous.mts and run with npx tsx fous.mts.
const apiKey = "YOUR_API_KEY";

const response = await fetch("https://api.fous.com/v1/query", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${apiKey}`,
    "Content-Type": "application/json",
  },
  signal: AbortSignal.timeout(180_000),
  body: JSON.stringify({
  "api": "@gasbuddy",
  "visibility": "public",
  "operation": "get_average_gas_prices",
  "version": 1,
  "input": {
    "location": "Ohio"
  },
  "response": {
    "format": "json"
  }
}),
});
type ApiResult = { success: boolean; data?: { output: unknown }; error?: { message: string } };
const result: ApiResult = await response.json();
if (!response.ok || result.success === false) {
  throw new Error(result.error?.message ?? `HTTP ${response.status}`);
}
if (!result.data) throw new Error("Missing API response data");
console.log(result.data.output);
```

## Use from an AI assistant

Connect this tool to Claude Code, Claude Desktop, Cursor, VS Code, Codex and any MCP client as its own MCP server. Each method is a typed tool whose arguments are the method’s input.

- Server URL: `https://api.fous.com/mcp/tools/gasbuddy`
- Authorization: `Authorization: Bearer <Fous API key>`

**Tools**

- `get_average_gas_prices`: Get average gas prices. 1 credit per completed call. Failed calls without a completed billing receipt are free; completed work can remain charged if delivery is interrupted.
- `list_cheapest_gas_stations`: List cheapest gas stations. 1 credit per completed call. Failed calls without a completed billing receipt are free; completed work can remain charged if delivery is interrupted.
- `fous_get_run`: the result of a run that was still going, by its `request_id`. Free.

Claude Code:

```bash
claude mcp add --scope user --transport http fous-gasbuddy https://api.fous.com/mcp/tools/gasbuddy --header "Authorization: Bearer ${FOUS_API_KEY:?Set FOUS_API_KEY to your Fous API key}"
```

To give the assistant every tool, connect `https://api.fous.com/mcp`: it finds one with `fous_search_tools` and runs it with `fous_run_tool`. Setup for other clients: https://fous.com/llms-full.txt.

## Use cases

- Compare listed fuel prices near a planned stop
- Find nearby stations by fuel grade
- Track regular-price changes over time
- Compare reported average prices across states or metro areas
- Map stations using their locations

## FAQ

### Can I run it with my own inputs?

Yes. Change the inputs in Studio and press Run, or send new inputs from your code, or ask a connected AI assistant.

### Can I call this GasBuddy tool as an API?

Yes. Send a POST request to /v1/query with your Fous API key and the inputs, and get JSON back.

### How much does it cost?

Each completed run costs 1 credit. Failed runs without a completed receipt are free; completed work can remain charged if delivery is interrupted. With pay as you go, a credit costs 1¢. Monthly plans cost less per credit.

### Do I need a GasBuddy account?

No. You only need a Fous account.

### How current is the data?

Fous gets the data from gasbuddy.com when you run it. Some results are reused for up to 24 hours, and results that use your account or key are never reused. It was last verified on Sep 29, 2026.

### Which nearby stations have the lowest listed fuel prices?

List cheapest gas stations returns nearby stations ordered by listed price, using a US or Canadian city, address, or postal code.

### What are the reported average gas prices in my state?

Get average gas prices returns reported averages for a US state or listed metro area, using its name or code.

### How have regular gas prices changed recently?

Get average gas prices provides regular-price changes from yesterday, a week ago, a month ago, and a year ago.

## Related

- [AAA API](https://fous.com/tools/aaa.md): AAA daily gas price averages for the United States, states and metro areas.
- [US Energy Information Administration API](https://fous.com/tools/us-energy-information-administration.md): US Energy Information Administration provides official energy statistics and analysis, including latest weekly fuel prices and preliminary monthly state electricity prices with historical comparisons.
- [Costco API](https://fous.com/tools/costco.md): Costco returns US product prices/details and warehouse hours/services/gas prices; delivery affects availability, member prices may be hidden, and posted gas and holiday hours may differ.
- [CarGurus API](https://fous.com/tools/cargurus.md): CarGurus helps shoppers browse dealer-listed new and used cars with deal ratings, and view average used prices, price ranges and 12-month price history by model year.
- [Alternative Fuels Data Center API](https://fous.com/tools/alternative-fuels-data-center.md): U.S. Department of Energy data on alternative fuel stations and vehicles.
- [FuelEconomy.gov API](https://fous.com/tools/fueleconomy-gov.md): FuelEconomy.gov provides official vehicle fuel economy ratings, driving range, emissions, five-year savings, and annual fuel costs based on current fuel prices and EPA’s 15,000-mile annual driving assumption.
- [Etherscan API](https://fous.com/tools/etherscan.md): Etherscan shows current gas prices, estimated costs, wallet balances, displayed token holdings and newest confirmed transactions, plus transaction status and details; pending fees are unconfirmed.
- [Best Buy API](https://fous.com/tools/best-buy.md): Best Buy returns US electronics and appliance listings, prices, deals, specifications, images, reviews, and nearby store pickup and shipping details; prices and availability can change by location and before checkout.
- [All Energy tools](https://fous.com/tools/category/energy)
