# Gas Cost Comparison Across EVM Chains

> Gas Cost Comparison Across EVM Chains is a paid API for AI agents from kr-x402-mvp.kgy5612.workers.dev, paid per call via x402, $0.002/call, status unknown (last checked 2026-10-31).

Returns real-time gas prices and USD transaction costs for common EVM operations (transfer, ERC-20, swap) across major chains, with a cheapest-chain recommendation.

## Facts

- Endpoint: GET https://kr-x402-mvp.kgy5612.workers.dev/api/gas-compare?utm_source=zero.xyz
- Price: $0.002/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-31
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/gas-cost-comparison-across-evm-chains-5ba25e62
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_3KYPq6JG0A9_5nrGeAYIV

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 gas-cost-comparison-across-evm-chains-5ba25e62
```

Example prompt: What's the cheapest chain to do a token swap on right now — compare Base, Ethereum, and Arbitrum and tell me the gas cost in USD for a 200,000-gas swap.

## When to prefer this

Use this endpoint when an AI agent needs to make real-time chain-routing decisions based on gas cost — e.g. before executing a swap, transfer, or contract call across multiple EVM networks. Prefer this over static fee estimates when freshness matters. It requires no API key, charges micro-payments via x402 USDC, and is purpose-built for autonomous agents needing machine-readable gas cost comparisons with built-in recommendations.

## Known failure modes

- Upstream RPC timeout causing stale or missing chain data
- Invalid chain name in 'chains' query param returns 400 or ignores unknown chains
- Gas units outside allowed range (21000–30000000) rejected
- Payment failure via x402 (insufficient USDC balance) blocks the request
- Single-chain outage causes that chain to be omitted from results

## How this service works

Pay-per-call crypto microdata for trading/onchain AI agents via x402 (USDC on Base): Base gas, token risk, balances, multi-venue prices, Hyperliquid book/funding, kimchi premium. No API keys.

## Output

A JSON object containing per-chain gas prices (in gwei and USD) for standard operations (ETH transfer, ERC-20 transfer, swap), the cheapest chain, a multiplier showing how much cheaper it is than Ethereum L1, the ETH/USD price used, upstream RPC latency, an L1 rollup fee flag, and a plain-English recommendation string. Updated in near real-time.

## 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",
     "properties": {
      "gas": {
       "type": "integer",
       "maximum": 30000000,
       "minimum": 21000,
       "examples": [
        200000
       ],
       "description": "Optional custom gas units; result sorted by custom_usd"
      },
      "chains": {
       "type": "string",
       "examples": [
        "base,ethereum,arbitrum"
       ],
       "description": "Comma list subset of base,ethereum,arbitrum,optimism,polygon,bsc (default all)"
      }
     },
     "additionalProperties": false
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "chains": [
   {
    "chain": "base",
    "native": "ETH",
    "chain_id": 8453,
    "swap_usd": 0.0011,
    "upstream": "https://base.drpc.org",
    "latency_ms": 80,
    "native_usd": 3850.1,
    "transfer_usd": 0.000154,
    "gas_price_gwei": 0.0019,
    "erc20_transfer_usd": 0.000476,
    "rollup_l1_fee_extra": true
   }
  ],
  "cheapest": "base",
  "gas_units": {
   "swap": 150000,
   "transfer": 21000,
   "erc20_transfer": 65000
  },
  "sorted_by": "swap_usd",
  "updated_at": "2026-10-30T01:30:00Z",
  "recommendation": "Execute on base (~180x cheaper than Ethereum L1); ...",
  "cheapest_swap_usd": 0.0011,
  "ethereum_vs_cheapest_x": 180
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/gas-cost-comparison-across-evm-chains-5ba25e62/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from kr-x402-mvp.kgy5612.workers.dev](https://www.zero.xyz/host/kr-x402-mvp.kgy5612.workers.dev/llms.txt)
