# x402-crosschain-gas

> x402-crosschain-gas is a paid API for AI agents from x402-catalog-history.ai-business-surface.workers.dev, paid per call via x402, $0.001/call, status unknown (last checked 2026-10-18).

Returns real-time gas prices (in gwei and wei) for up to five EVM chains — Base, Ethereum, Arbitrum, Optimism, and Polygon — including base fee, priority fee, next block base fee, and block metadata, sourced directly from public RPCs.

## Facts

- Endpoint: GET https://x402-catalog-history.ai-business-surface.workers.dev/gas?utm_source=zero.xyz
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-18
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/x402-crosschain-gas-2856a74e
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_-bRXvYnlI3JTGCuPFo-X5

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 x402-crosschain-gas-2856a74e
```

Example prompt: What are the current gas prices on Base and Ethereum right now — give me the base fee, priority fee, and what the next block base fee is expected to be on each chain?

## When to prefer this

Choose this endpoint when you need fresh, RPC-sourced gas data across multiple EVM chains in a single call — especially when you need EIP-1559 breakdown (base fee + priority fee + next block estimate) rather than just a legacy gas price. It's ideal for agents making cross-chain routing decisions, DeFi bots sizing transaction fees, or dashboards monitoring gas in real time. Prefer it over manually querying five separate RPC endpoints or scraping block explorers.

## Known failure modes

- A chain's public RPC is unreachable — that chain appears in chains_unavailable with an error reason rather than in the gas array
- A specific metric (e.g. priority fee) could not be measured — that field is null in the response
- Invalid chain alias provided — may be ignored or cause an error response
- Network timeout on the Cloudflare Worker — HTTP 5xx returned
- Payment not received or x402 payment flow fails — request is rejected with 402

## How this service works

Stop opening five explorers to price one transaction: one GET returns what each chain is charging for gas right now — for base, eth, arbitrum, optimism and polygon: the current gas price in gwei (with the raw wei the RPC returned), the latest block's base fee, the priority fee a 50th-percentile transaction actually paid across the last five blocks, the next block's base fee under the EIP-1559 formula, the block number and timestamp those numbers came from, and the public RPC that answered. curl: GET /gas?chains=base,eth (omit chains for all five; aliases like ethereum or arb work). Response: {gas:[{chain,chain_id,gas_price_gwei,base_fee_gwei,priority_fee_gwei,block:{number,timestamp},source_rpc,fetched_at}]}. Every value is a measurement from a public RPC, never an estimate: a chain no RPC answered for is listed in chains_unavailable with the reason, and a figure that could not be measured is null. Values are cached for 15 seconds, and each one carries the fetched_at of the measurement (not of this response). No keys, no account, read-only, one GET, one delivery — 0.001 USDC. A purchase is two calls by design: this first call returns 402 with the price and the payment terms, and you then repeat the same request with the PAYMENT-SIGNATURE header to receive the 200 delivery.

## Output

A JSON object with a `gas` array, where each entry contains: chain name and chain ID, gas price in gwei (and raw wei), base fee in gwei, 50th-percentile priority fee in gwei, estimated next block base fee under EIP-1559, block number and timestamp of the measurement, the public RPC that answered, and a fetched_at timestamp. Chains that could not be reached are listed in a `chains_unavailable` field with the reason. Values are cached for up to 15 seconds; individual unmeasurable fields are null rather than omitted.

## 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",
      "HEAD",
      "DELETE"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "properties": {
      "chains": {
       "type": "string"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/x402-crosschain-gas-2856a74e/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402-catalog-history.ai-business-surface.workers.dev](https://www.zero.xyz/host/x402-catalog-history.ai-business-surface.workers.dev/llms.txt)
