# Gas Cost in Wei

> Gas Cost in Wei 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 gas cost in wei by multiplying gas_used by gas_price_wei using pure local arithmetic, no RPC or node required.

## Facts

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

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-wei-bb3a8e60 -d '<json body>'
```

Example prompt: What's the total gas cost in wei for a transaction that used 21000 gas at a gas price of 10000000000 wei?

## When to prefer this

Use this endpoint when you already know both gas_used and gas_price_wei and need a deterministic, offline wei cost computation without spinning up an RPC node or querying live chain data. Ideal for post-execution accounting, pre-submission cost checks in agents, and any context where a fast, keyless, no-network math result is sufficient.

## Known failure modes

- Missing or invalid gas_used integer returns a validation error
- Missing or non-string gas_price_wei returns a validation error
- Overflow for extremely large gas values may produce errors
- Non-numeric string in gas_price_wei causes a parse/type error
- Payment not processed (x402 protocol failure) results in no response

## How this service works

Compute gas_used × gas_price as total gas cost in wei. Call when estimating tx cost from known used gas and price without a node. Returns gas cost wei string 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

Returns a deterministic JSON response containing the total gas cost as a wei string, computed as gas_used × gas_price_wei. No external calls are made; the result is pure local arithmetic.

## 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-wei/v1",
  "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-wei-bb3a8e60/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)
