x402AgentTools

⛽Fuel Cost Calculator

Calculate the liters of fuel a trip needs and its total cost from distance, consumption (L/100 km) and price per liter — with optional cost splitting between passengers.

Worked examples

450 km at 6.5 L/100km, 1.75/L

GET /api/v1/calculators/fuel-cost-calculator?distance=450&consumption=6.5&pricePerLiter=1.75&people=1

Result: 51.19

1,200 km road trip, 4 people

GET /api/v1/calculators/fuel-cost-calculator?distance=1200&consumption=7.2&pricePerLiter=1.82&people=4

Result: 157.25

25 km commute, 5.4 L/100km

GET /api/v1/calculators/fuel-cost-calculator?distance=25&consumption=5.4&pricePerLiter=1.68&people=1

Result: 2.27

Machine API (x402)

$0.001 / call

This tool is also a JSON API for AI agents. Requests without payment receive 402 Payment Required plus instructions; agents pay USDC on Base via the x402 protocol — no accounts, no API keys.

GET /api/v1/calculators/fuel-cost-calculator?distance=450&consumption=6.5&pricePerLiter=1.75&people=1 HTTP/1.1
Host: agenttools-hub.vercel.app

→ 402 (payment required, instructions in headers)
→ 200 (after X-PAYMENT header; JSON body below)

{
  "tool": "calculators/fuel-cost-calculator",
  "input": {"distance":450,"consumption":6.5,"pricePerLiter":1.75,"people":1},
  "result": { "value": 51.1875, "answer": "51.19" }
}

Agent docs: /llms.txt · OpenAPI spec · integration guide

About this tool

Estimate what any car trip costs in fuel: enter the distance, your car's consumption in L/100 km and the current pump price. For shared trips, the cost splits evenly between passengers automatically.

liters = distance × consumption ÷ 100 · cost = liters × price per liter

Frequently asked questions

How do I convert from MPG?

US mpg ≈ 235.215 ÷ (L/100km); UK mpg ≈ 282.481 ÷ (L/100km). Divide to get L/100 km and enter it here.

Does this include tolls or wear?

No — fuel only. For a full cost-per-km figure, add tolls, maintenance and depreciation separately.

Related tools