FuelEconomy.gov API: Compare cars
Compares the official fuel economy and estimated annual fuel cost of two to four cars by year, make and model, using FuelEconomy.gov. Selects a base version when no trim is given.
Unofficial. Not affiliated with or endorsed by FuelEconomy.gov.
Inputs
Values from the run on Oct 23, 2026, shown under Output.
- Cars, required
cars Two to four cars, each with a year, make, and model; for example, 2024 Toyota Camry Hybrid and 2024 Tesla Model 3.
- 2024 Honda Civic
- 2024 Toyota Camry
- 2024 Toyota Prius Prime
- 2024 Madeup Phantom
List of text 2 to 4 items.
Input as JSON
{ "cars": [ "2024 Honda Civic", "2024 Toyota Camry", "2024 Toyota Prius Prime", "2024 Madeup Phantom" ]}Output
{ "cars": [ { "car": "2024 Honda Civic", "city": 30, "link": "https://www.fueleconomy.gov/feg/noframes/47072.shtml" , "note": null, "highway": 37, "combined": 33, "fuel_type": "Regular", "vehicle_id": "47072", "efficiency_unit": "MPG", "vehicle_matched": "2024 Honda Civic 4Dr — Auto (AV-S7), 4 cyl, 2.0 L", "co2_grams_per_mile": 266, "annual_fuel_cost_usd": 1950, "electric_range_miles": null, "greenhouse_gas_score": 6 }, { "car": "2024 Toyota Camry", "city": 28, "link": "https://www.fueleconomy.gov/feg/noframes/47090.shtml" , "note": null, "highway": 39, "combined": 32, "fuel_type": "Regular", "vehicle_id": "47090", "efficiency_unit": "MPG", "vehicle_matched": "2024 Toyota Camry LE/SE — Auto (S8), 4 cyl, 2.5 L" , "co2_grams_per_mile": 280, "annual_fuel_cost_usd": 2000, "electric_range_miles": null, "greenhouse_gas_score": 6 }, { "car": "2024 Toyota Prius Prime", "city": 86, "link": "https://www.fueleconomy.gov/feg/noframes/47500.shtml" , "note": null, "highway": 72, "combined": 79, "fuel_type": "Regular Gas and Electricity", "vehicle_id": "47500", "efficiency_unit": "MPGe", "vehicle_matched": "2024 Toyota Prius Prime — Auto (variable gear ratios), 4 cyl, 2.0 L", "co2_grams_per_mile": 60, "annual_fuel_cost_usd": 1350, "electric_range_miles": 40, "greenhouse_gas_score": 10 } ], "summary": "2024 Toyota Prius Prime — Auto (variable gear ratios), 4 cyl, 2.0 L is the cheapest to run, saving $650 per year versus 2024 Toyota Camry LE/SE — Auto (S8), 4 cyl, 2.5 L." }Code
curl https://api.fous.com/v1/runs \ -H "Authorization: Bearer $FOUS_API_KEY" \ -H "Content-Type: application/json" \ -d '{"method":"fueleconomy.gov/compare_cars","input":{"cars":["2024 Honda Civic","2024 Toyota Camry","2024 Toyota Prius Prime","2024 Madeup Phantom"]}}' # 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": "fueleconomy.gov/compare_cars" , "input": { "cars": [ "2024 Honda Civic", "2024 Toyota Camry", "2024 Toyota Prius Prime", "2024 Madeup Phantom" ] }})# 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": "fueleconomy.gov/compare_cars" , "input": { "cars": [ "2024 Honda Civic", "2024 Toyota Camry", "2024 Toyota Prius Prime", "2024 Madeup Phantom" ] } }), 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 fueleconomy.gov/compare_cars# with {"cars":["2024 Honda Civic","2024 Toyota Camry","2024 Toyota Prius Prime","2024 Madeup Phantom"]}"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": [ "cars" ], "properties": { "cars": { "type": "array", "items": { "type": "string", "minLength": 6 }, "maxItems": 4, "minItems": 2, "description": "Two to four cars, each with a year, make, and model; for example, 2024 Toyota Camry Hybrid and 2024 Tesla Model 3." } }}Output schema
{ "type": "object", "required": [ "cars", "summary" ], "properties": { "cars": { "type": "array", "items": { "type": "object", "required": [ "car", "vehicle_matched", "fuel_type", "combined", "city", "highway", "efficiency_unit", "electric_range_miles", "annual_fuel_cost_usd", "co2_grams_per_mile", "greenhouse_gas_score", "link", "note", "vehicle_id" ], "properties": { "car": { "type": "string", "description": "Car exactly as entered." }, "city": { "type": [ "number", "null" ], "description": "City fuel economy in the stated unit." }, "link": { "type": [ "string", "null" ], "description": "FuelEconomy.gov page for the matched vehicle." }, "note": { "type": [ "string", "null" ], "description": "Why the car could not be matched, when applicable." }, "highway": { "type": [ "number", "null" ], "description": "Highway fuel economy in the stated unit." }, "combined": { "type": [ "number", "null" ], "description": "Combined fuel economy in the stated unit." }, "fuel_type": { "type": [ "string", "null" ], "description": "Fuel used by the vehicle." }, "vehicle_id": { "type": [ "string", "null" ], "description": "FuelEconomy.gov vehicle ID.", "x-fous-developer": true }, "efficiency_unit": { "type": [ "string", "null" ], "description": "MPG or MPGe for the fuel economy figures." }, "vehicle_matched": { "type": [ "string", "null" ], "description": "Official vehicle version selected, including transmission and engine." }, "co2_grams_per_mile": { "type": [ "number", "null" ], "description": "Tailpipe carbon dioxide emissions in grams per mile." }, "annual_fuel_cost_usd": { "type": [ "number", "null" ], "description": "Estimated annual fuel cost in US dollars." }, "electric_range_miles": { "type": [ "number", "null" ], "description": "Electric-only driving range in miles, when available." }, "greenhouse_gas_score": { "type": [ "integer", "null" ], "description": "Greenhouse gas score from 1 to 10." } }, "additionalProperties": false }, "description": "Vehicle comparisons in the order entered." }, "summary": { "type": "string", "description": "Cheapest vehicle to run and annual savings over the most expensive." } }, "additionalProperties": false}- Price
- 1 credit per completed run (1¢ with pay as you go); failed runs are free.
- Method
fueleconomy.gov/compare_cars- Returns
- per car: matched version, MPG or MPGe, annual fuel cost, CO2, GHG score, range, link; plus cheapest-to-run summary
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 fueleconomy.gov/compare_cars with the inputs above.
Ask your agent
- Compare the fuel economy and annual fuel cost of a 2024 Toyota Camry Hybrid and a 2024 Honda Accord Hybrid
- Which is cheaper to run per year, a 2023 Ford F-150 or a 2023 Chevrolet Silverado 1500?
- Side by side MPG and CO2 emissions for a 2025 Hyundai Ioniq 5, a 2025 Kia EV6, and a 2025 Tesla Model Y
- On fueleconomy.gov, check estimated yearly fuel cost for a 2022 Subaru Outback versus a 2022 Mazda CX-5
- Compare 2024 Nissan Leaf, 2024 Chevrolet Bolt EUV, and 2024 Volkswagen ID.4 by range and annual energy cost
See more
All FuelEconomy.gov methodsReturns 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_economyGets 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_valueSearches Carvana's used-car inventory by make and model, with optional price, year, mileage and ZIP filters, and returns each car's price, estimated monthly payment, mileage and delivery or pickup estimate for the ZIP.
carvana.com/search_carsGets Kelley Blue Book's expert and consumer ratings, trim prices with the KBB Fair Purchase Price, fuel economy, pros, cons and the expert review's opening verdict for a car model by year, make and model. Some details are unavailable for certain model years.
kbb.com/get_car_reviewSearches new and used cars for sale near a US ZIP code for a make and model, with prices, dealer details and CarGurus deal ratings. Used cars come first, then new cars, each in CarGurus order; market difference is positive below market and negative above.
cargurus.com/search_carsSearches CarMax used cars by make and model with optional ZIP, distance, year, price and mileage filters, keeping CarMax's order. Pages expose only the first 48 cars; distance is CarMax's distance from the selected local store, and larger limits or narrow distance filters may return fewer matches.
carmax.com/search_carsGets NHTSA 5-Star Safety Ratings for a car by make, model and model year. Returns each matching version; unrated versions have no stars.
nhtsa.gov/get_safety_ratingsSearches Cars.com car listings for a make and model around a US ZIP code within a radius, optionally by condition (new, used or certified pre-owned) and maximum price, in Cars.com search order.
cars.com/search_cars