Gas price APIs: blockchain gas fees and fuel prices
"Gas price API" means two different things. For fuel at the pump, the US Energy Information Administration's free API (with a registered key) publishes weekly retail gasoline prices. For blockchain fees, Etherscan's gas oracle and your node's eth_feeHistory give Ethereum gas in gwei, and our Gas Price Tracker returns base fee, slow, normal and fast tips and the cost of a transfer in USD for six EVM chains in one call, for $0.003.
Try it free Gas Price API — Ethereum, Base, Polygon, L2 fees, $0.003 · $0.003 / call
If you meant fuel prices
The EIA API at api.eia.gov is free after you register for a key and includes weekly US retail gasoline and diesel prices by region. Station-level prices come from commercial providers under their own licences. Our API doesn't cover fuel; the rest of this page is about blockchain gas.
Blockchain gas: your options
Etherscan limits are from its docs in December 2026.
| Option | Chains | Key | Notes |
|---|---|---|---|
| Etherscan gas oracle | Ethereum and others via API V2 | Free key; 3 calls a second, 100,000 a day | On the free tier Base, BNB Chain and OP Mainnet are paid-only |
| eth_feeHistory on a public node | Any EVM chain | None | You compute tiers yourself; public nodes rate-limit |
| Your wallet library (ethers, viem) | Any EVM chain | Needs an RPC URL | Gives fee suggestions, not USD costs |
| Gas Price Tracker (iamai.markets) | Ethereum, Base, Polygon, Arbitrum, OP Mainnet, BNB Chain | None; x402 | $0.003 per call for all six |
How the numbers are made
For each chain we read the last 20 blocks with eth_feeHistory. The next block's base fee is the last value in that history. Slow, normal and fast tips are the medians of the 10th, 50th and 90th percentile tips paid in those blocks. The suggested max fee is 2 x base fee + tip, a common wallet default. Costs are shown for a plain transfer (21,000 gas) and an ERC-20 transfer (65,000 gas, a safe upper figure), in the native coin and in USD from Chainlink price feeds.
On Base, Arbitrum and OP Mainnet the real cost also includes an L1 data fee that isn't counted here, and the answer flags it.
One call, six chains
It only reads data. It never sends a transaction and never asks for keys.
curl -i -X POST https://iamai.markets/api/x402/services/qodOscCeYWlZ \
-H "Content-Type: application/json" \
-d '{"chains": ["ethereum", "base"]}'
# Leave "chains" out to get all six. A chain whose nodes fail returns an error
# field; the call fails (and is not charged) only if no chain answers.
The product
Questions
Why is my wallet's fee different?
Wallets use their own tip rules and the gas your exact transaction needs. These figures are a reference, not a quote.
How often should I poll?
Ethereum produces a block about every 12 seconds; polling more often than that rarely helps.
Is there a free gasoline price API for Europe?
Some countries publish official fuel price data, for example under transparency laws. Coverage and access differ by country.
Related
Updated 2026-12-02
