# Gas Cost in Ether

> Gas Cost in Ether is a paid API for AI agents from api.delx.ai, paid per call via x402, $0.001/call, status unknown (last checked 2026-09-15).

Computes total Ethereum transaction gas cost in ETH from gas used and gas price in wei using deterministic local math.

## Facts

- Endpoint: POST https://api.delx.ai/api/v1/x402/gas-cost-eth
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/gas-cost-in-ether-ae1d8844
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_-ebvrMaqqXO3v89hlZgxS

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-in-ether-ae1d8844 -d '<json body>'
```

Example prompt: What's the total ETH cost for a transaction that uses 21000 gas at a gas price of 15000000000 wei?

## When to prefer this

Choose this endpoint when you need a fast, cheap, self-contained conversion from raw gas parameters (gas used + gas price in wei) to ETH cost, without needing live gas price data, RPC access, or market feeds. Ideal for budgeting pipelines, transaction logging, and UI display layers where the gas values are already known and only the ETH denomination is needed.

## Known failure modes

- Missing or invalid gas_used (non-integer) returns an error
- Missing or malformed gas_price_wei (non-numeric string) returns an error
- Payment not fulfilled (x402 protocol) results in 402 response blocking the computation
- Extremely large values may cause precision issues depending on implementation

## How this service works

Compute total gas cost in ether from used gas and price wei. Call when budgeting ETH spend for a planned or observed transaction. Returns gas cost in eth as deterministic JSON for $0.001 USDC via x402 on Base. First-party local math only—no RPC, live market feed, API keys, storage, or mediagen. Advisory only; the caller owns capital, risk, and production controls.

## Output

A deterministic JSON response containing the computed gas cost in ETH, derived purely from the formula gas_used × gas_price_wei / 1e18. No external data sources or network calls are involved; the result is exact given the inputs.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "gas_used": {
   "type": "integer",
   "description": "Input field: gas used."
  },
  "gas_price_wei": {
   "type": "string",
   "description": "Input field: gas price wei."
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "schema": "delx/util-gas-cost-eth/v1",
  "cost_eth": 0.000021,
  "cost_wei": "21000000000000",
  "gas_used": 21000,
  "gas_price_wei": "1000000000"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/gas-cost-in-ether-ae1d8844/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.delx.ai](https://www.zero.xyz/host/api.delx.ai/llms.txt)
