chain-ops-mgo
Multi-chain Gas Optimizer — Compare real-time gas prices across 9 EVM chains and get the cheapest-chain recommendation. Pay-per-call via x402 on Base. No API key, no signup.
When to use: call it before any EVM transaction (bridge, deploy, swap) to route to the lowest-fee chain — e.g. "Use Base — saves 99.8% vs Ethereum". Built for AI agents: one USDC microtransaction per call, ERC-8004 identity handled automatically.

Install
Free endpoints only:
npm install chain-ops-mgo
Auto-payment (recommended for paid endpoints):
npm install chain-ops-mgo @chain-ops/agent-sdk viem
Quick Start
Free — no payment
const { getCheapestChain } = require('chain-ops-mgo');
const result = await getCheapestChain();
console.log(result);
Paid — auto-payment via SDK (recommended)
const { getGasBasicWithPayment } = require('chain-ops-mgo');
const data = await getGasBasicWithPayment({
account: process.env.PRIVATE_KEY,
network: 'base',
});
console.log(data.recommendation.action);
The SDK handles ERC-8004 identity, EIP-712 signing, and the x402 402-handshake automatically. One USDC microtransaction per call ($0.001 basic, $0.002 premium).
Endpoints
getGasDemo() | Free | 4 | Raw gas prices, rate limited 10/hr |
getCheapestChain() | Free | 4 | Simple cheapest chain helper |
getGasBasicWithPayment({ account }) | $0.001 USDC | 4 | Auto-pay via SDK + recommendation |
getGasPremiumWithPayment({ account }) | $0.002 USDC | 9 | Auto-pay via SDK + 9 chains incl. BNB, Polygon, Avalanche, zkSync, Hyperliquid |
getGasBasic({ paymentHeader }) | $0.001 USDC | 4 | Manual mode — bring your own x402 header |
getGasPremium({ paymentHeader }) | $0.002 USDC | 9 | Manual mode — bring your own x402 header |
Auto-pay options
await getGasPremiumWithPayment({
account: '0x...',
network: 'base',
maxPrice: 5_000n,
});
If @chain-ops/agent-sdk is not installed, the auto-pay functions throw a clear error pointing to the install command. Free functions work without it.
Manual mode (advanced)
If you build your own x402 client, you can supply a pre-built header:
const { getGasBasic } = require('chain-ops-mgo');
const data = await getGasBasic({
paymentHeader: { 'X-PAYMENT': '<your encoded payment>' },
});
Without a payment header, paid functions throw Error: Payment required with err.status === 402 and err.paymentInfo for inspection.
Payment
Uses x402 protocol on Base (eip155:8453) with USDC. No API key, no subscription, no account required.
Links
License
MIT