{"uid":"cap_m9qzrzcsriBI7NYJKvkuR","slug":"chain-fee-history-gas-fee-analysis-api-9fce6fcb","name":"Chain Fee History — Gas Fee Analysis API","description":"Live data APIs for AI agents and analysts. Buy an all-access API key for $29/month with a credit card, or pay per call in USDC. No sales call.","url":"https://store.agentexchange.work/chain/fee-history","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":{"type":"string","description":"base|ethereum|optimism|arbitrum|polygon|gnosis (default base)"},"blocks":{"type":"number","description":"How many recent blocks to sample, 1-100 (default 20)"}}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object","properties":{"trend":{"type":"string"},"change_pct":{"type":"number"},"recommended":{"type":"object"}}}}}}},"responseSchema":{"type":"json","example":{"chain":"base","trend":"flat","blocks":20,"change_pct":-1.2,"recommended":{"max_fee_per_gas_gwei":0.0112,"max_priority_fee_per_gas_gwei":0.0012},"base_fee_gwei":{"max":0.009,"min":0.004,"mean":0.005,"current":0.005},"priority_fee_gwei":{"p10":0.001,"p50":0.0012,"p90":0.005}}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.09","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.09/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.09","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.09","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_PKbc60gh2DmSmt_zjGVhG","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.09","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Returns recent gas fee statistics (base fee, priority fee, trend, and recommended max fees) for a specified EVM-compatible blockchain by sampling recent blocks.","exampleAgentPrompt":"What are the current gas fees on Base — is the base fee trending up or down, and what max fee per gas should I set for my next transaction? Sample the last 20 blocks.","exampleUseCases":[{"title":"Pre-transaction gas estimation","prompt":"Before I send this ETH transfer on Ethereum, what's the recommended max fee and priority fee right now? Sample the last 20 blocks so I know if fees are rising or stable."},{"title":"DeFi bot fee optimization on Arbitrum","prompt":"Check the gas fee history on Arbitrum over the last 50 blocks — what's the trend and what priority fee percentile should my trading bot use to get included quickly?"},{"title":"Multi-chain gas comparison","prompt":"Pull the current base fee stats and trend for both Base and Optimism so I can decide which chain is cheaper to execute my contract call on right now."}],"resultDescription":"Returns a JSON object with: the sampled chain name, number of blocks sampled, fee trend label (e.g. 'flat', 'rising', 'falling'), percent change over the sample window, recommended max_fee_per_gas and max_priority_fee_per_gas in gwei, base fee statistics (min, max, mean, current in gwei), and priority fee percentiles (p10, p50, p90 in gwei).","failureModes":["Unsupported chain name returns an error — only base, ethereum, optimism, arbitrum, polygon, gnosis are valid","Block count out of range (< 1 or > 100) returns a validation error","Payment failure (insufficient USDC or missing x402 header) returns HTTP 402","RPC node temporarily unavailable for the requested chain returns a 503 or timeout","Stale data if the underlying RPC is lagging behind the chain tip"],"whenToPreferThis":"Choose this endpoint when an agent needs real-time gas fee intelligence for EVM chains — specifically when you need not just a spot price but a trend, percentile breakdown, and ready-to-use recommended fee values. Prefer this over raw RPC calls (eth_gasPrice, eth_feeHistory) when you want the analysis pre-computed and normalized. Especially useful for DeFi automation agents, transaction cost estimation, and multi-chain fee routing decisions.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-14T12:50:00.358Z","isFirstParty":false}