# HTTPay Gas Compare API

> HTTPay Gas Compare API is a paid API for AI agents from httpay.xyz, paid per call via x402, $0.01/call, status unknown (last checked 2026-09-13).

Compares current gas prices and transaction costs across EVM chains (Base vs Ethereum) for swaps and ETH transfers

## Facts

- Endpoint: POST https://httpay.xyz/api/gas-compare
- Price: $0.01/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-13
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/httpay-gas-compare-api-5c821c43
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_q4KbJPTrLFS03NjZhbrlc

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 httpay-gas-compare-api-5c821c43 -d '<json body>'
```

Example prompt: Hey, can you check whether it's cheaper to do a token swap on Base or Ethereum right now, and tell me the actual gas costs in USD for both a swap and a simple ETH transfer on each chain?

## When to prefer this

Use this endpoint when an agent needs to decide which EVM chain to route a transaction through to minimize gas costs, or when a user wants a quick real-time cost comparison between Base and Ethereum. Ideal for DeFi automation, cost-optimization workflows, and cross-chain routing decisions.

## Known failure modes

- Gas oracle unavailable for one or more chains — chain entry may show ok:false
- Stale gas data if upstream RPC is lagging
- Network timeout if Base or Ethereum RPC is unresponsive
- Payment failure if x402 USDC payment on Base is not completed

## How this service works

Compare real-time gas costs across 10 chains in USD

## Output

Returns a list of chains (Base and Ethereum) with current gas price in Gwei, estimated swap cost in USD, ETH transfer cost in USD, current ETH price in USD, and which chain is cheapest for swaps and transfers.

## Example request

```json
{
 "chains": [
  "base",
  "ethereum"
 ],
 "operations": [
  "swap",
  "transfer"
 ]
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "chains": [
   {
    "ok": true,
    "name": "Base",
    "swapUSD": "$0.003200",
    "gasPriceGwei": "0.0050",
    "ethTransferUSD": "$0.000336"
   },
   {
    "ok": true,
    "name": "Ethereum",
    "swapUSD": "$9.600000",
    "gasPriceGwei": "15.0000",
    "ethTransferUSD": "$1.008000"
   }
  ],
  "ethPriceUSD": 3200,
  "cheapestForSwap": "Base",
  "cheapestForTransfer": "Base"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/httpay-gas-compare-api-5c821c43/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from httpay.xyz](https://www.zero.xyz/host/httpay.xyz/llms.txt)
