API & MCP

Everything a person can do on Road Trip Fuel and Charging Cost, a program or AI agent can do with the same inputs and get the identical result.

HTTP API

Road Trip Fuel and Charging Cost

Enter the legs of a road trip with the price per litre or kWh you expect in each country, your car’s consumption and extras such as tolls, vignettes or ferries. You get the energy and cost per leg, the total, the cost per 100 km and each person’s share to the cent. No routing service is used: enter the kilometres yourself or let two coordinates give an estimate.

Inputs of Road Trip Fuel and Charging Cost
FieldTypeDefaultDescription
energyselect (fuel, electric)"fuel"Vehicle
consumptionnumber6.5Consumption per 100 km (litres or kWh)
lossPercentnumber0Charging losses (%, electric only). Energy you pay for at the charger that does not reach the battery. Enter your own figure if you know it.
roundTripbooleanfalseDrive every leg there and back
legstable[{"label":"Munich to the Brenner","country":"Germany and Austria","km":160,"pricLegs
extrastable[]Tolls, vignettes, ferries, parking (optional)
peopleinteger2Split between (people)
namestext—Names (optional, comma-separated)
currencytext"EUR"Currency code
fromtext—Estimate from (latitude, longitude; optional). With “to”, the straight-line distance × 1.46 (European road circuity) fills one leg without kilometres.
totext—Estimate to (latitude, longitude; optional)

Example request

Munich to Venice by petrol car, Brennero toll, three people

curl -X POST https://hearthtripenergycost.usefulweb.site/api/v1/calculate -H 'content-type: application/json' -d '{"energy":"fuel","consumption":6.5,"legs":[{"label":"Munich to the Brenner","country":"Germany and Austria","km":160,"price":1.75},{"label":"Brenner to Venice","country":"Italy","km":290,"price":1.85}],"extras":[{"label":"Austrian vignette (10 days)","amount":12.4},{"label":"Brenner motorway toll","amount":11.5}],"people":3,"names":"Alex, Sam, Robin","currency":"EUR"}'

Every result contains

inputs (normalised, defaults applied), summary, result (validated against the published schema), units, assumptions, sources, warnings, computedAt and links.

MCP (Model Context Protocol)

{
  "mcpServers": {
    "hearth-trip-energy-cost": { "type": "http", "url": "https://hearthtripenergycost.usefulweb.site/mcp" }
  }
}