# Chain Fee History — Gas Fee Analysis API

> Chain Fee History — Gas Fee Analysis API is a paid API for AI agents from store.agentexchange.work, paid per call via x402, $0.09/call, status unknown (last checked 2026-09-14).

Returns recent gas fee statistics (base fee, priority fee, trend, and recommended max fees) for a specified EVM-compatible blockchain by sampling recent blocks.

## Facts

- Endpoint: GET https://store.agentexchange.work/chain/fee-history
- Price: $0.09/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/chain-fee-history-gas-fee-analysis-api-9fce6fcb
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_m9qzrzcsriBI7NYJKvkuR

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 chain-fee-history-gas-fee-analysis-api-9fce6fcb
```

Example prompt: What are the current gas fees on Base — is the base fee trending up or down, and what max fee per gas should I set for my next transaction? Sample the last 20 blocks.

## When to prefer this

Choose this endpoint when an agent needs real-time gas fee intelligence for EVM chains — specifically when you need not just a spot price but a trend, percentile breakdown, and ready-to-use recommended fee values. Prefer this over raw RPC calls (eth_gasPrice, eth_feeHistory) when you want the analysis pre-computed and normalized. Especially useful for DeFi automation agents, transaction cost estimation, and multi-chain fee routing decisions.

## Known failure modes

- Unsupported chain name returns an error — only base, ethereum, optimism, arbitrum, polygon, gnosis are valid
- Block count out of range (< 1 or > 100) returns a validation error
- Payment failure (insufficient USDC or missing x402 header) returns HTTP 402
- RPC node temporarily unavailable for the requested chain returns a 503 or timeout
- Stale data if the underlying RPC is lagging behind the chain tip

## How this service works

Live data APIs for AI agents and analysts. Buy an all-access API key for $29/month with a credit card, or pay per call in USDC. No sales call.

## Output

Returns a JSON object with: the sampled chain name, number of blocks sampled, fee trend label (e.g. 'flat', 'rising', 'falling'), percent change over the sample window, recommended max_fee_per_gas and max_priority_fee_per_gas in gwei, base fee statistics (min, max, mean, current in gwei), and priority fee percentiles (p10, p50, p90 in gwei).

## 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": {
      "chain": {
       "type": "string",
       "description": "base|ethereum|optimism|arbitrum|polygon|gnosis (default base)"
      },
      "blocks": {
       "type": "number",
       "description": "How many recent blocks to sample, 1-100 (default 20)"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object",
     "properties": {
      "trend": {
       "type": "string"
      },
      "change_pct": {
       "type": "number"
      },
      "recommended": {
       "type": "object"
      }
     }
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "chain": "base",
  "trend": "flat",
  "blocks": 20,
  "change_pct": -1.2,
  "recommended": {
   "max_fee_per_gas_gwei": 0.0112,
   "max_priority_fee_per_gas_gwei": 0.0012
  },
  "base_fee_gwei": {
   "max": 0.009,
   "min": 0.004,
   "mean": 0.005,
   "current": 0.005
  },
  "priority_fee_gwei": {
   "p10": 0.001,
   "p50": 0.0012,
   "p90": 0.005
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/chain-fee-history-gas-fee-analysis-api-9fce6fcb/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from store.agentexchange.work](https://www.zero.xyz/host/store.agentexchange.work/llms.txt)
