# Base Gas & Fee Oracle (Live On-Chain)

> Base Gas & Fee Oracle (Live On-Chain) is a paid API for AI agents from x402-data-api.bodhinindustries.workers.dev, paid per call via x402, $0.01/call, status unknown (last checked 2026-09-16).

Returns live Base network gas prices, fee tiers (slow/avg/fast), next-block base fee prediction, congestion status, and self-computed ETH/USD price — all derived directly from the Base blockchain with no third-party data.

## Facts

- Endpoint: GET https://x402-data-api.bodhinindustries.workers.dev/gas
- Price: $0.01/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-16
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/base-gas-fee-oracle-live-on-chain-0f876b73
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_i7ImrzBBsJbXsD3RcN_rT

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability base-gas-fee-oracle-live-on-chain-0f876b73
```

Example prompt: What are the current gas fees on Base right now — give me slow, average, and fast tiers in gwei and estimated USD cost for a standard ETH transfer (21000 gas), and tell me if the network is congested or if fees are trending up or down?

## When to prefer this

Use this endpoint when you need live, self-computed Base network gas fees with no dependency on third-party oracles like Etherscan or CoinGecko. Ideal for AI agents that need to price transactions, decide when to submit a tx (congestion awareness), or display current ETH/USD pricing — all sourced trustlessly from raw Base chain data. Prefer this over general Ethereum gas APIs when operating specifically on Base (chainId 8453).

## Known failure modes

- Base RPC node unavailable — returns 5xx with no gas data
- Invalid rewardPercentiles format (e.g. non-ascending or out-of-range values) — likely returns 400 or malformed response
- gasLimit of 0 or negative may produce nonsensical USD estimates
- ETH/USD price unavailable if Uniswap v3 WETH/USDC pool cannot be read — thirdPartyDataUsed remains false but ethUsd may be null
- Payment not included or invalid x402 payment header — returns 402 Payment Required

## How this service works

Self-computed Base onchain toolkit for AI agents: ERC-20 safety scan, manipulation-resistant TWAP price oracle, gas/fee oracle, calldata decoder, token/address/contract intel, wallet approval-risk audit, and batch token triage — all computed live from raw Base chain, no third-party data.

## Output

Returns current Base block height, base fee and predicted next-block base fee in gwei, three fee tiers (slow/avg/fast) each with maxFeePerGas, maxPriorityFeePerGas, and estimated USD cost, a self-computed ETH/USD spot price from Uniswap v3 on-chain, and a congestion/trend summary (direction: rising|falling|flat, congestion: low|medium|high, % change over last 10 blocks). No third-party oracle data is used.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "gasLimit": {
   "type": "integer",
   "description": "Gas units to price the tx for (default 21000 = a plain ETH transfer)."
  },
  "rewardPercentiles": {
   "type": "string",
   "description": "Three ascending priority-fee percentiles (0–100) mapped to slow,avg,fast. Default '25,50,90'."
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "block": {
   "type": "integer",
   "description": "Base block height"
  },
  "chain": {
   "type": "string",
   "description": "base"
  },
  "tiers": {
   "type": "object",
   "properties": {
    "avg": {
     "type": "object",
     "properties": {
      "estCostUsd": {
       "type": "number",
       "description": "estimated cost in USD"
      },
      "maxFeePerGasGwei": {
       "type": "number",
       "description": "max fee (gwei)"
      },
      "maxPriorityFeePerGasGwei": {
       "type": "number",
       "description": "priority fee (gwei)"
      }
     }
    },
    "fast": {
     "type": "object",
     "properties": {
      "estCostUsd": {
       "type": "number",
       "description": "estimated cost in USD"
      },
      "maxFeePerGasGwei": {
       "type": "number",
       "description": "max fee (gwei)"
      },
      "maxPriorityFeePerGasGwei": {
       "type": "number",
       "description": "priority fee (gwei)"
      }
     }
    },
    "slow": {
     "type": "object",
     "properties": {
      "estCostUsd": {
       "type": "number",
       "description": "estimated cost in USD"
      },
      "maxFeePerGasGwei": {
       "type": "number",
       "description": "max fee (gwei)"
      },
      "maxPriorityFeePerGasGwei": {
       "type": "number",
       "description": "priority fee (gwei)"
      }
     }
    }
   }
  },
  "ethUsd": {
   "type": "number",
   "description": "self-computed ETH/USD from Uniswap v3 WETH/USDC"
  },
  "method": {
   "type": "string",
   "description": "self_computed_eth_feeHistory"
  },
  "chainId": {
   "type": "integer",
   "description": "8453"
  },
  "gasLimit": {
   "type": "integer",
   "description": "gas units priced"
  },
  "computedAt": {
   "type": "string",
   "description": "ISO-8601 timestamp"
  },
  "baseFeeTrend": {
   "type": "object",
   "properties": {
    "direction": {
     "type": "string",
     "description": "rising|falling|flat"
    },
    "congestion": {
     "type": "string",
     "description": "low|medium|high"
    },
    "changePctOver10Blocks": {
     "type": "number",
     "description": "base-fee change %"
    }
   }
  },
  "baseFeePerGasGwei": {
   "type": "number",
   "description": "current base fee (gwei)"
  },
  "thirdPartyDataUsed": {
   "type": "boolean",
   "description": "always false"
  },
  "nextBlockBaseFeePerGasGwei": {
   "type": "number",
   "description": "predicted next-block base fee (gwei)"
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/base-gas-fee-oracle-live-on-chain-0f876b73/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402-data-api.bodhinindustries.workers.dev](https://www.zero.xyz/host/x402-data-api.bodhinindustries.workers.dev/llms.txt)
