# Gas Cost in USD

> Gas Cost in USD 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).

Estimates the USD cost of an Ethereum transaction given gas used, gas price in wei, and a caller-supplied ETH/USD price, using pure local arithmetic with no external calls.

## Facts

- Endpoint: POST https://api.delx.ai/api/v1/x402/gas-cost-usd
- 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-usd-ba7c9856
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_VWFZh7mZpQLWXi_D06ZWS

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-usd-ba7c9856 -d '<json body>'
```

Example prompt: A transaction used 150000 gas at a gas price of 12000000000 wei, and ETH is currently worth $3200 — what's the estimated dollar cost of that gas?

## When to prefer this

Choose this endpoint when you need a fast, purely local, deterministic USD gas cost calculation and you already have the gas_used, gas_price_wei, and an ETH/USD price on hand. Prefer it over live-feed approaches when you want no external dependencies, no API keys, and reproducible results — e.g. for post-trade accounting, pre-flight budget checks, or cost summaries in agent pipelines.

## Known failure modes

- Missing required fields (gas_used, gas_price_wei, or eth_usd) result in a validation error
- Non-numeric or malformed gas_price_wei string causes a parsing error
- Zero or negative eth_usd price may produce a zero or nonsensical result
- Result may diverge from actual on-chain cost if caller-supplied ETH price is stale

## How this service works

Estimate gas cost in USD given used gas, price, and ETH/USD. Call when operator reports that need approximate dollar gas spend. Returns usd cost estimate (caller supplies eth price) 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 estimated USD gas cost, computed locally from the supplied gas_used, gas_price_wei, and eth_usd values — no live market data or RPC calls involved. The result is advisory only and reflects the caller's supplied ETH price.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "eth_usd": {
   "type": "integer",
   "description": "Input field: eth usd."
  },
  "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-usd/v1",
  "eth_usd": 3000,
  "cost_eth": 0.000021,
  "cost_usd": 0.063,
  "gas_used": 21000
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/gas-cost-in-usd-ba7c9856/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)
