{"uid":"cap_DYy6xXJvL2uMj2jn5FVRL","slug":"gas-prices-base-optimism-ethereum-mainnet-37161a66","name":"Gas Prices — Base, Optimism & Ethereum Mainnet","description":"Pay-per-call on-chain API for AI agents and developers: wallet audits, token safety audits (honeypot detection), live gas prices, token prices, transaction receipts, balances, ENS resolution, block data, ERC-20 allowances, transaction simulation, swap quotes and multicall batches — all computed on-chain via public RPCs (no external market API). Pay per request in USDC on Base via the x402 exact scheme (EIP-3009 transferWithAuthorization). No API key, no signup, no subscription.","url":"https://x402-audit.tatschluizguilherme.workers.dev/gas","method":"GET","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method"],"properties":{"type":{"type":"string","const":"http"},"method":{"enum":["GET"],"type":"string"},"queryParams":{"type":"object","properties":{"chain":{"enum":["base","op","mainnet","all"],"type":"string","description":"Chain(s) to query — comma-separated or 'all' (default)"}}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object","required":["chains"],"properties":{"chains":{"type":"object"},"requestedAt":{"type":"string"}}}}}}},"responseSchema":{"type":"json","example":{"chains":{"base":{"chain":"base","timestamp":"2026-08-04T22:00:00.000Z","blockNumber":24400000,"gasPriceGwei":0.021,"maxPriorityFeeGwei":0.002}},"requestedAt":"2026-08-04T22:00:00.000Z"}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.1","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.1/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.1","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.1","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_76EcG_YOPtm4Pddlpy5PK","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.1","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Returns live gas prices (gasPrice, maxPriorityFee EIP-1559) and latest block number for Base, Optimism, and/or Ethereum Mainnet via public RPCs.","exampleAgentPrompt":"What are the current gas prices on Base, Optimism, and Ethereum Mainnet right now — including gasPrice and maxPriorityFee for EIP-1559?","exampleUseCases":[{"title":"Pre-flight gas cost estimation","prompt":"Before I submit this transaction on Base, can you check what the current gasPrice and maxPriorityFee are so I can estimate the fee?"},{"title":"Cross-chain gas comparison","prompt":"Compare live gas prices across Base, Optimism, and Ethereum Mainnet — I want to see which chain is cheapest to transact on right now."},{"title":"Gas spike monitoring alert","prompt":"Fetch the current gas price on Ethereum Mainnet and tell me if it's above 30 gwei — I'm waiting for a low-gas window to execute a swap."}],"resultDescription":"A JSON object with a 'chains' map keyed by chain name (base, op, mainnet), each containing gasPrice in wei, maxPriorityFee in wei (EIP-1559), and latest block number, plus a top-level requestedAt ISO timestamp.","failureModes":["Public RPC unavailable or rate-limited — upstream provider error returned","Invalid chain enum value — query param ignored or error returned","Network timeout — Cloudflare Worker fails to fetch from public RPC in time","Payment not fulfilled — x402 payment required, 402 returned if USDC not sent"],"whenToPreferThis":"Choose this endpoint when you need real-time, cross-chain gas price data (gasPrice + EIP-1559 maxPriorityFee) for Base, Optimism, and/or Ethereum Mainnet without managing your own RPC connections or API keys. It's ideal for pre-transaction gas estimation, cross-chain fee comparison, or monitoring gas conditions programmatically. It supports querying all three chains in a single call via 'all'.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-14T00:45:28.593Z","isFirstParty":false}