# Base Gas Price API (x402)

> Base Gas Price API (x402) is a paid API for AI agents from base-gas-x402-production.up.railway.app, paid per call via x402, $0.005/call, status unknown (last checked 2026-09-13).

Returns live Base mainnet gas prices including base fee, priority fees, and estimated transfer costs, gated by x402 micropayment.

## Facts

- Endpoint: GET https://base-gas-x402-production.up.railway.app/gas
- Price: $0.005/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-13
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/base-gas-price-api-x402-8c821b14
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_FPeAOaaZZbB9_SXBrR4zD

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-price-api-x402-8c821b14
```

Example prompt: What's the current gas price on Base mainnet — give me the base fee, low/medium/high priority fees, and how much a standard ETH transfer would cost right now?

## When to prefer this

Choose this endpoint when you need live, real-time Base mainnet gas data including tiered priority fees and transfer cost estimates. Prefer it over generic Ethereum gas APIs when your transactions target the Base L2 specifically, or when you need a pay-per-call micropayment model (x402) rather than a subscription API key. Ideal for agents that check gas only occasionally and want to avoid recurring subscription costs.

## Known failure modes

- Payment not provided or invalid x402 payment header — returns 402 Payment Required
- Network connectivity issues fetching live Base RPC data — may return stale or error response
- Base RPC node unavailability — upstream error causing failure to retrieve current block data
- Malformed request — returns 400 Bad Request if unexpected parameters are sent

## How this service works

Live Base mainnet gas: EIP-1559 base fee, low/medium/high priority tiers in gwei, and a transaction cost estimate for any gas limit.

## Output

A JSON object containing chain name and ID (base-mainnet, 8453), current gas price in gwei, base fee per gas, low/medium/high priority fees, the latest block number, estimated transfer cost for a standard 21,000 gas transaction in both ETH and gwei, and a fetchedAt timestamp indicating when the data was retrieved.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [],
     "properties": {
      "gasLimit": {
       "type": "integer",
       "default": 21000,
       "maximum": 30000000,
       "minimum": 21000,
       "description": "Gas units to price the cost estimate against. Defaults to 21000 (a plain ETH transfer). Use ~65000 for an ERC-20 transfer, ~85000 for an NFT mint, ~180000 for a Uniswap swap, or ~1500000 for a contract deploy."
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "chain": "base-mainnet",
  "chainId": 8453,
  "gasPrice": "0.014",
  "fetchedAt": "2026-06-22T00:00:00.000Z",
  "blockNumber": "12345678",
  "baseFeePerGas": "0.012",
  "priorityFeePerGas": {
   "low": "0.001",
   "high": "0.004",
   "medium": "0.002"
  },
  "estimatedTransferCost": {
   "eth": "0.000000294",
   "gwei": "294",
   "gasLimit": 21000
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/base-gas-price-api-x402-8c821b14/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from base-gas-x402-production.up.railway.app](https://www.zero.xyz/host/base-gas-x402-production.up.railway.app/llms.txt)
