{"uid":"cap_hRUY8ZY8QHoddXB6kyz7F","slug":"onchain-query-api-gas-market-data-cc95c58b","name":"Onchain Query API – Gas Market Data","description":"Live gas market on any major EVM chain: current gas price, base fee and priority-fee percentiles (p25/p50/p75) in gwei, plus the estimated cost in native token and USD for a plain transfer (21k gas) and a typical DEX swap (200k gas). Lets an agent decide whether a transaction is worth sending right now or should wait for cheaper gas, and budget the fee before signing.","url":"https://chain.cyberwarex.com/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","HEAD","DELETE"],"type":"string"},"queryParams":{"type":"object","required":[],"properties":{"chain":{"enum":["base","ethereum","arbitrum","optimism","polygon"],"type":"string","default":"base","description":"EVM chain to query."}},"additionalProperties":false}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object","properties":{"chain":{"type":"string"},"native":{"type":"string"},"est_cost":{"type":"object","description":"Estimated native + USD cost for transfer_21k and swap_200k."},"native_usd":{"type":["number","null"]},"base_fee_gwei":{"type":["number","null"]},"gas_price_gwei":{"type":"number"},"priority_fee_gwei":{"type":["object","null"],"description":"Priority fee percentiles p25/p50/p75 in gwei."}}}}}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.002","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.002/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.002","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.002","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_5qi4pjXqbnSCz9V8wu-Y-","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.002","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Returns current gas market data for a specified EVM chain, including gas price, base fee, priority fee percentiles, and estimated transaction costs in native token and USD.","exampleAgentPrompt":"What are the current gas prices on Ethereum right now — including base fee, priority fee percentiles, and estimated cost for a token swap?","exampleUseCases":[{"title":"DeFi bot gas optimization","prompt":"Before executing this swap on Arbitrum, check the current gas market — what's the base fee, priority fee, and estimated cost for a 200k gas swap right now?"},{"title":"Cross-chain cost comparison","prompt":"Compare gas fees across Base, Ethereum, and Polygon right now so I can figure out which chain is cheapest for my transaction."},{"title":"Gas spike alerting","prompt":"What's the current gas price on Ethereum mainnet in gwei, and how much would a standard transfer cost me in USD at current prices?"}],"resultDescription":"Returns a JSON object with: chain name, native token symbol, current gas price in gwei, base fee in gwei (if EIP-1559), priority fee percentiles (p25/p50/p75 in gwei), native token USD price, and estimated transaction costs (in native token and USD) for a standard transfer (~21k gas) and a token swap (~200k gas).","failureModes":["Unsupported chain name returns validation error","Chain RPC temporarily unavailable returns error or null fields","Native USD price unavailable returns null for native_usd and USD cost estimates","Malformed query parameters return 400-level error"],"whenToPreferThis":"Use this endpoint when you need real-time gas market data for EVM chains (Base, Ethereum, Arbitrum, Optimism, Polygon) without managing your own RPC infrastructure or API keys. Ideal for agents making gas-aware transaction decisions, cost estimation before submitting transactions, or monitoring gas conditions across multiple chains. Prefer this over raw RPC calls for simplicity, and over general blockchain explorers when you need structured, deterministic JSON responses with USD cost estimates.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-14T18:36:33.230Z","isFirstParty":false}