Gas Compare
by Saylor Innovations Data Desk in Onchain & crypto
Cheapest chain for a transaction - USD cost of a transfer, token transfer, swap or NFT mint across Ethereum, Base, Arbitrum, Optimism, Polygon, BSC, Avalanche and Linea
https://saylorinnovations.com/api/gas/compare- Price
- $0.01
- per call in USDC
- Uptime
- 100%
- last 30 days
- Response time
- 660 ms
- 808 ms slowest 5%
- Last check
- Passed
- 2 h ago, next any minute now
Reliability
Status and outage history · Atom feed · Watch with other listings
How to call it
GET https://saylorinnovations.com/api/gas/compare
Each call costs $0.01 in USDC on Base, paid with the request over x402.
Run a free test callOne unpaid request, the way an agent sends it. You see the payment challenge it gets back. Nothing is charged.
Example request
From the listing.
GET https://saylorinnovations.com/api/gas/compare?action=swapParameters
| Parameter | Type | Required | Description |
|---|---|---|---|
action | string | No | optional transfer, erc20-transfer, nft-transfer, nft-mint, swap, or a gas-unit number; default transfer |
Example response
The provider's example. We can't check it without paying.
Example response, 106 lines
{
"action": "swap",
"chains": [
{
"base_fee_gwei": 0.000001021,
"chain": "optimism",
"cost_native": 3.3911e-9,
"cost_usd": 0.00000856,
"gas_price_gwei": 0.00000152,
"l1_data_fee_native": 3.118e-9,
"native_price_usd": 2523.32,
"native_token": "ETH",
"priority_tip_gwei": 4.99e-7
},
{
"base_fee_gwei": 0.005,
"chain": "base",
"cost_native": 0.0000010839,
"cost_usd": 0.00273,
"gas_price_gwei": 0.00601,
"l1_data_fee_native": 2.06e-9,
"native_price_usd": 2523.32,
"native_token": "ETH",
"priority_tip_gwei": 0.00101
},
{
"base_fee_gwei": 245.69,
"chain": "polygon",
"cost_native": 0.059813,
"cost_usd": 0.00613,
"gas_price_gwei": 332.29,
"l1_data_fee_native": 0,
"native_price_usd": 0.10247,
"native_token": "POL",
"priority_tip_gwei": 86.598
},
{
"base_fee_gwei": 0,
"chain": "bsc",
"cost_native": 0.0000091133,
"cost_usd": 0.00681,
"gas_price_gwei": 0.050629,
"l1_data_fee_native": 0,
"native_price_usd": 747.08,
"native_token": "BNB",
"priority_tip_gwei": 0.050629
},
{
"base_fee_gwei": 0.020158,
"chain": "arbitrum",
"cost_native": 0.000003653,
"cost_usd": 0.00922,
"gas_price_gwei": 0.020158,
"l1_data_fee_native": 2.451e-8,
"native_price_usd": 2523.32,
"native_token": "ETH",
"priority_tip_gwei": 0
},
{
"base_fee_gwei": 5.0005,
"chain": "avalanche",
"cost_native": 0.0013501,
"cost_usd": 0.0143,
"gas_price_gwei": 7.5005,
"l1_data_fee_native": 0,
"native_price_usd": 10.568,
"native_token": "AVAX",
"priority_tip_gwei": 2.5
},
{
"base_fee_gwei": 0.11063,
"chain": "ethereum",
"cost_native": 0.000035339,
"cost_usd": 0.0892,
"gas_price_gwei": 0.19633,
"l1_data_fee_native": 0,
"native_price_usd": 2523.32,
"native_token": "ETH",
"priority_tip_gwei": 0.085694
},
{
"base_fee_gwei": 7e-9,
"chain": "linea",
"cost_native": 0.000043667,
"cost_usd": 0.1102,
"gas_price_gwei": 0.24259,
"l1_data_fee_native": 0,
"native_price_usd": 2523.32,
"native_token": "ETH",
"priority_tip_gwei": 0.24259
}
],
"chains_checked": 8,
"chains_responding": 8,
"cheapest": {
"chain": "optimism",
"cost_usd": 0.00000856
},
"cheapest_vs_most_expensive_x": 12873.8,
"gas_units": 180000,
"most_expensive": {
"chain": "linea",
"cost_usd": 0.1102
},
"note": "Gas price is the next-block base fee plus the median priority tip of the last 4 blocks. Base, Optimism and Arbitrum rows include an estimated L1 data fee for a typical signed payload of this action."
}Call it from code
The curl command shows the payment challenge. The JavaScript and Python versions pay and call, and never pay more than $0.01.
curl: see the payment challenge
# bash or zsh: see the payment challenge. Nothing is charged.
curl -sS -g -i 'https://saylorinnovations.com/api/gas/compare?action=swap'
# x402 v2 sends the challenge base64-encoded in the PAYMENT-REQUIRED header (v1 sends it in the body).
# To read the header:
curl -sS -g -o /dev/null -D - 'https://saylorinnovations.com/api/gas/compare?action=swap' \
| grep -i '^payment-required:' | cut -d' ' -f2 | tr -d '\r' | base64 --decodeJavaScript: pay and call
// npm i @x402/fetch @x402/evm viem
import { wrapFetchWithPayment, x402Client } from "@x402/fetch";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";
// Pays at most $0.01 per call.
const client = new x402Client().setSpendControls({ maxAmountPerPayment: "$0.01" });
registerExactEvmScheme(client, { signer: privateKeyToAccount(process.env.EVM_PRIVATE_KEY) });
const pay = wrapFetchWithPayment(fetch, client);
// Not sure it's safe to pay? ToolVet checks it first for $0.005. Pay for that from a separate
// client: this one is capped at $0.01 per payment. GET https://toolvet.app/api/v1/check?url=https%3A%2F%2Fsaylorinnovations.com%2Fapi%2Fgas%2Fcompare
const res = await pay("https://saylorinnovations.com/api/gas/compare?action=swap");
console.log(res.status, await res.text());Python: pay and call
# pip install "x402[requests,evm]"
import os
from eth_account import Account
from x402 import x402ClientSync
from x402.http.clients import x402_requests
from x402.mechanisms.evm import EthAccountSigner
from x402.mechanisms.evm.exact.register import register_exact_evm_client
# Pays at most $0.01 per call.
client = x402ClientSync().set_spend_controls({"max_amount_per_payment": "$0.01"})
register_exact_evm_client(client, EthAccountSigner(Account.from_key(os.environ["EVM_PRIVATE_KEY"])))
with x402_requests(client) as session:
res = session.get("https://saylorinnovations.com/api/gas/compare?action=swap")
print(res.status_code, res.text)Security scan
No findings
We scan names, descriptions and tool definitions for hidden instructions and other prompt-injection patterns.
Recent checks
| When | Result | HTTP | Time | Price |
|---|---|---|---|---|
| 2 h ago | Passed | 402 | 516 ms | $0.01 |
| 7 h ago | Passed | 402 | 808 ms | $0.01 |
| 12 h ago | Passed | 402 | 551 ms | $0.01 |
| 17 h ago | Passed | 402 | 564 ms | $0.01 |
| 22 h ago | Passed | 402 | 750 ms | $0.01 |
Show 2 older checks
| 26 h ago | Passed | 402 | 660 ms | $0.01 |
| 31 h ago | Passed | 402 | 679 ms | $0.01 |