# OneSource Ethereum Gas Estimator

> OneSource Ethereum Gas Estimator is a paid API for AI agents from api.onesource.io, paid per call via x402, $0.004/call, status unknown (last checked 2026-09-15).

Estimates the gas required to execute an Ethereum transaction given recipient, calldata, sender, and optional value

## Facts

- Endpoint: POST https://api.onesource.io/api/chain/estimate-gas
- Price: $0.004/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/onesource-ethereum-gas-estimator-78de69c8
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_ucdsRlu2WZLUOoIcmKlYA

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 onesource-ethereum-gas-estimator-78de69c8 -d '<json body>'
```

Example prompt: How much gas will it take to call this contract — sending from 0xAbCd1234...5678 to 0x1234AbCd...EFGH with calldata 0xa9059cbb000000000000000000000000... and zero ETH value?

## When to prefer this

Use this endpoint when you need to estimate gas for an Ethereum transaction before broadcasting it — especially when building AI agent workflows that must calculate fees, validate feasibility, or budget on-chain interactions without requiring an API key. Prefer this over direct node RPC when you want a pay-per-call model via USDC on Base (x402) without managing infrastructure.

## Known failure modes

- Invalid Ethereum address format for 'to' or 'from' returns a 400 error
- Malformed calldata hex string causes a validation error
- Contract reverts during simulation returns an error indicating execution would fail
- Network congestion or node unavailability may cause timeouts
- Insufficient funds simulation may return an execution error
- Missing required 'to' field returns a bad request error

## How this service works

Estimate the gas a transaction will consume via eth_estimateGas before signing it

## Output

Returns a JSON object with a 'gas_estimate' field containing the estimated gas units as a hex string (e.g. {"gas_estimate": "0x5208"}), representing how much gas the described transaction would consume on Ethereum mainnet.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "to": {
   "type": "string",
   "pattern": "^0x[a-fA-F0-9]{40}$"
  },
  "data": {
   "type": "string",
   "pattern": "^0x[a-fA-F0-9]+$"
  },
  "from": {
   "type": "string",
   "pattern": "^0x[a-fA-F0-9]{40}$"
  },
  "value": {
   "type": "string",
   "pattern": "^0x[a-fA-F0-9]+$"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "data": {
   "gas": "0x5208"
  },
  "meta": {
   "endpoint": "/api/chain/estimate-gas",
   "cost_usdc": "0.001",
   "request_id": "00000000abcdef01",
   "payment_chain": "base",
   "payment_token": "USDC"
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/onesource-ethereum-gas-estimator-78de69c8/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.onesource.io](https://www.zero.xyz/host/api.onesource.io/llms.txt)
