Gas Fee Predictor

Free Ethereum Gas API

Free · no API key

Public JSON endpoints serving live Ethereum gas prices, L2 gas across Arbitrum / Optimism / Base / Polygon, recent gas history, ETH/USD price, and a pattern-based 24-hour gas forecast. No API key, no signup. Built for indie devs, dashboards, bots, and learning.

Hit any endpoint from a browser, your backend, or curl — see the responses below.

GET/api/dashboardRefresh: 30 seconds

Aggregated payload for the homepage dashboard. Returns the current gas snapshot, ETH/USD price, 24h prediction series, and the next-best-time recommendation in one round trip.

curl "https://www.gasfeepredictor.com/api/dashboard"
{
  "current":     { "low": 0.12, "average": 0.18, "high": 0.31, "source": "..." },
  "ethPrice":    { "usd": 2305.12, "lastUpdated": "..." },
  "predictions": [
    { "timestamp": "2026-05-16T05:00:00Z", "low": 0.10, "average": 0.16, "high": 0.28, "isLowFeeWindow": true }
    /* … 24 hourly points */
  ],
  "nextBest":    { "timestamp": "...", "gasPrices": { "low": 0.08, "average": 0.14, "high": 0.22 }, "confidence": 0.82 }
}
GET/api/gas-predictionsRefresh: 30 seconds

Predictor output only — gas snapshot plus a forecast series of configurable length. Use this when you need the full prediction with confidence scores and low-fee-window flags but not the rest of the dashboard payload.

  • timeframe Forecast horizon: `6h`, `12h`, `24h` (default), or `7d`.
curl "https://www.gasfeepredictor.com/api/gas-predictions?timeframe=24h"
{
  "current":      { "low": 0.12, "average": 0.18, "high": 0.31 },
  "predictions":  [ /* hourly Prediction objects */ ],
  "nextBestTime": { "timestamp": "...", "confidence": 0.82, "message": "..." },
  "decision":     { "action": "wait" | "send_now", "reason": "..." }
}
GET/api/gas-historyRefresh: 30 seconds at the edge; underlying data writes every 90s

Historical gas prices over a chosen window, downsampled into bucketed averages. Sourced from a 90-second-cadence writer that persists each snapshot to Postgres, so coverage is dense.

  • range One of `10m`, `30m`, `2h`, `6h`, `1d`, or `7d`. Sets both the look-back window and the bucket size.
curl "https://www.gasfeepredictor.com/api/gas-history?range=24h"
{
  "range": "1d",
  "points": [
    { "timestamp": "2026-05-15T05:00:00Z", "gasPrice": 0.16 }
    /* up to 300 bucketed points */
  ],
  "meta":   { "pointCount": 286, "renderedRangeStart": "...", "renderedRangeEnd": "..." }
}
GET/api/l2-gasRefresh: 60 seconds

Live execution gas prices for the four headline L2s — Arbitrum, Optimism, Base, and Polygon — pulled directly from each network's public RPC. Includes per-network native-token USD and a fee-completeness flag.

curl "https://www.gasfeepredictor.com/api/l2-gas"
{
  "networks": [
    {
      "id": "arbitrum",
      "name": "Arbitrum",
      "gasPriceGwei": 0.0202,
      "nativeToken": "ETH",
      "nativeUsd": 2305.12,
      "executionGasCostUsd": 0.000970,
      "feeCompleteness": "execution_only"
    }
    /* … one row per network */
  ],
  "fetchedAt": "2026-05-16T05:00:00Z"
}
GET/api/l2-gas-historyRefresh: 15 seconds at the edge

Historical L2 gas for a chosen network, sampled every 90s by a background writer and stored in Postgres.

  • network `arbitrum`, `optimism`, `base`, or `polygon`.
  • hours `1`, `6`, `24`, or `168` (7 days).
curl "https://www.gasfeepredictor.com/api/l2-gas-history?network=arbitrum&hours=24"
{
  "network": "arbitrum",
  "hours":   24,
  "points":  [
    { "timestamp": "...", "gas_price_gwei": 0.0202, "execution_gas_cost_usd": 0.000970 }
    /* up to ~960 raw samples; UI typically downsamples client-side */
  ]
}
GET/api/eth-priceRefresh: 30 seconds

Live ETH/USD price plus a 7-day sparkline. Pulled from CoinGecko and edge-cached so you can hammer this endpoint without ratelimits propagating back to the upstream.

curl "https://www.gasfeepredictor.com/api/eth-price"
{
  "usd": 2305.12,
  "lastUpdated": "...",
  "sparkline_7d": [ /* 168 hourly values */ ],
  "price_change_percentage_24h": 1.42
}

Quick fetch example

Browser-side JavaScript:

const res = await fetch('https://www.gasfeepredictor.com/api/dashboard')
const data = await res.json()
console.log('Current gas (Gwei):', data.current.average)
console.log('Next best time:', data.nextBest?.timestamp)

Node / server-side:

const res = await fetch('https://www.gasfeepredictor.com/api/l2-gas', {
  next: { revalidate: 60 }   // Next.js fetch caching
})
const { networks } = await res.json()
const cheapest = networks.sort(
  (a, b) => a.executionGasCostUsd - b.executionGasCostUsd
)[0]

Fair use

These endpoints are edge-cached on Cloudflare, so polling every few seconds from your app costs us roughly nothing. We don't require an API key. If your usage pattern starts hurting our upstreams (RPCs, CoinGecko, Supabase) we'll ratelimit the offending IP range — please don't turn this into your free CDN for unrelated workloads. For production apps that need contractual reliability, run your own RPC and your own CoinGecko key.

Frequently asked questions

Is this Ethereum gas API really free?

Yes. No API key, no signup, no usage cap published. Be reasonable — if you need millions of requests per day or low-latency guarantees, run your own RPC. We reserve the right to ratelimit if anyone hammers the endpoints, but normal hobby and small-app usage is fine.

How fresh is the data?

Mainnet snapshots refresh every 30 seconds via the public Ethereum gas tracker pipeline. L2 RPC reads run every 60 seconds. Historical writes happen every 90 seconds on a background timer. Edge caching adds at most ~30 seconds of staleness on top.

Where does the underlying gas data come from?

Mainnet: aggregated from public Ethereum gas trackers and recent block base fees. L2: official RPC endpoints for each chain (arb1.arbitrum.io, mainnet.optimism.io, mainnet.base.org, polygon-bor-rpc.publicnode.com). ETH/USD: CoinGecko free public API.

Can I use these endpoints in my dApp?

Yes, the JSON contract is stable and we treat it as effectively public. We make no formal uptime SLA — production apps with hard reliability requirements should fall back to direct RPC reads or a paid provider.

Is there CORS / cross-origin access?

All endpoints serve CORS-permissive responses (the Cloudflare edge does not block cross-origin reads). You can fetch directly from a browser running on any origin.

How do I get alerted when gas drops below a threshold?

Use the alerts page rather than polling the API. We push a confirmation email when you save the alert, and (separately) when the threshold is met. Polling at 30-second intervals just to check a threshold burns your own infra for no reason.

Do you support L2 prediction or just snapshots?

L2 endpoints today expose live snapshots and historical samples. Mainnet has the full prediction series via /api/gas-predictions. L2 prediction is on the roadmap once we have 30+ days of stored L2 history.

Related ETH gas tools and guides

Want the data on your own site?

One-line embed of a live gas widget — no API integration needed. Drop the script tag and it renders the current Gwei + USD on your page.

Get the embed widget →