30trust / 100

Crypto Gas Fee Calculator

by AgentTools in Onchain & crypto

x402 APIFailing, checked 1 h ago

Calculate a transaction's gas fee: gas units × gas price (gwei) gives the ETH cost, multiplied by the ETH price for USD. Exact BigInt math for the wei amounts. Use this when an agent needs to transaction cost in ETH and USD from gas × gwei.

GET https://agenttools-hub.vercel.app/api/v1/crypto/gas-fee-calculator

Last 30 days

All checks passedSome failedAll failedNot checked
Uptime
13.3%
Response time
166 ms typical, 166 ms slowest 5%
Last check
1 h ago: Expected HTTP 402, got 308
Next check
any minute now

How to call it

# See the payment challenge (nothing is charged)
curl -i -X GET "https://agenttools-hub.vercel.app/api/v1/crypto/gas-fee-calculator?ethPriceUsd=3000&gasUnits=21000&gweiPrice=10"
import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { ExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = new x402Client().register(
  "eip155:8453",
  new ExactEvmScheme(privateKeyToAccount(process.env.AGENT_KEY)),
);
const pay = wrapFetchWithPayment(fetch, client);

// Not sure it's safe to pay? Preflight it first for $0.005:
// GET https://toolvet.app/api/v1/check?url=https%3A%2F%2Fagenttools-hub.vercel.app%2Fapi%2Fv1%2Fcrypto%2Fgas-fee-calculator
const res = await pay("https://agenttools-hub.vercel.app/api/v1/crypto/gas-fee-calculator?ethPriceUsd=3000&gasUnits=21000&gweiPrice=10");
console.log(await res.json());

Example input

{
  "ethPriceUsd": 3000,
  "gasUnits": 21000,
  "gweiPrice": 10
}

Example output

{
  "result": {
    "answer": "$0.63",
    "answerLabel": "Transaction fee (USD)",
    "details": [
      {
        "label": "Fee in ETH",
        "value": "0.000210000000000000"
      },
      {
        "label": "Fee in wei (exact)",
        "value": "210000000000000"
      },
      {
        "label": "Fee in gwei",
        "value": "210000"
      },
      {
        "label": "ETH price used",
        "value": "$3,000"
      }
    ],
    "steps": [
      "wei = 21000 gas × 10 gwei × 10⁹ = 210000000000000",
      "ETH = 0.000210000000000000 · USD = 0.000210000000000000 × $3,000 = $0.63"
    ],
    "value": 0.63
  },
  "tool": "gas-fee-calculator"
}

Security scan

  • No findings. We scan names, descriptions and tool definitions for hidden instructions and other prompt-injection patterns.

Recent checks

WhenResultHTTPTimePrice
1 h agoExpected HTTP 402, got 308308140 ms-
5 h agoExpected HTTP 402, got 30830873 ms-
10 h agoExpected HTTP 402, got 30830820 ms-
14 h agoExpected HTTP 402, got 30830814 ms-
18 h agoExpected HTTP 402, got 30830816 ms-
22 h agoExpected HTTP 402, got 308308191 ms-
27 h agoExpected HTTP 402, got 30830845 ms-
31 h agoExpected HTTP 402, got 30830848 ms-
35 h agoExpected HTTP 402, got 30830873 ms-
39 h agoExpected HTTP 402, got 30830825 ms-
43 h agoExpected HTTP 402, got 30830814 ms-
47 h agoExpected HTTP 402, got 30830816 ms-
2 days agoExpected HTTP 402, got 30830819 ms-
2 days agoPassed402166 ms$0.003
2 days agoPassed402305 ms$0.003