Choreograph: AI-Powered Gas Optimization API

Save 60-99% on transaction costs through intelligent cross-chain routing

What We Built

A production-ready API that analyzes gas costs across Ethereum, Base, Arbitrum, and Polygon in real-time, then recommends the optimal chain for any transaction using ML-enhanced confidence scoring.

Live API: https://choreograph-metamask-api.fly.dev

How It Works

Your Transaction → Choreograph API → Cost Analysis → ML Scoring → Recommendation ↓ [Blocknative Gas Prices] [Real-time ETH Pricing] [ML Confidence Algorithm] [All-chain Comparison]

Input: Transaction details (amount, current chain, priority)

Output: Best chain recommendation with savings breakdown and ML confidence score

Key Feature: Compares all chains against all chains, not just Ethereum vs L2s. If you're on Polygon and Base is cheaper, we'll recommend Base.

Real Example

Current: Ethereum transaction costs $0.0321
Recommended: Base transaction costs $0.0016
Savings: $0.03 (95.1%)
ML Confidence: 95%

ML Confidence Scoring

Our lightweight ML engine adjusts confidence based on learned patterns:

Time-of-Day Patterns:

Volatility Analysis:

Extreme Savings Detection:

Result: Confidence scores range from 65% to 95%, giving you transparency on recommendation certainty.

Test the API

Quick Test (30 seconds)

curl -X POST https://choreograph-metamask-api.fly.dev/api/v1/route \ -H "Content-Type: application/json" \ -d '{ "amount": 100, "current_chain": "ethereum", "tx_type": "transfer", "priority": "cost" }'

Expected Response:

{ "recommended_chain": "base", "current_chain": "ethereum", "current_cost_usd": 0.0321, "recommended_cost_usd": 0.0016, "savings_usd": 0.0305, "savings_percent": 95.1, "confidence": 0.95, "costs": { "ethereum": 0.0321, "base": 0.0016, "arbitrum": 0.0019, "polygon": 4.5916 }, "reasoning": [ "Cost priority: base saves $0.03", "base is 95.1% cheaper" ], "eth_price_usd": 4372.92 }

API Parameters

Parameter Type Options Description
amount float 0.001-1000 Transaction value in USD
current_chain string ethereum, base, arbitrum, polygon Current blockchain
tx_type string transfer, swap, erc20_transfer, nft_mint, contract_interaction Transaction type
priority string cost, speed, reliability, balanced User preference

Try Different Scenarios

1. Small transaction on expensive chain:

curl -X POST https://choreograph-metamask-api.fly.dev/api/v1/route \ -H "Content-Type: application/json" \ -d '{"amount": 10, "current_chain": "ethereum", "tx_type": "transfer", "priority": "cost"}'

2. Large transaction (reliability matters):

curl -X POST https://choreograph-metamask-api.fly.dev/api/v1/route \ -H "Content-Type: application/json" \ -d '{"amount": 50000, "current_chain": "polygon", "tx_type": "swap", "priority": "reliability"}'

3. Speed-critical transaction:

curl -X POST https://choreograph-metamask-api.fly.dev/api/v1/route \ -H "Content-Type: application/json" \ -d '{"amount": 500, "current_chain": "arbitrum", "tx_type": "transfer", "priority": "speed"}'

4. Starting from L2:

curl -X POST https://choreograph-metamask-api.fly.dev/api/v1/route \ -H "Content-Type: application/json" \ -d '{"amount": 100, "current_chain": "base", "tx_type": "transfer", "priority": "cost"}'

Integration Example (Python)

import requests def get_routing_recommendation(amount_usd, current_chain, priority='cost'): response = requests.post( 'https://choreograph-metamask-api.fly.dev/api/v1/route', json={ 'amount': amount_usd, 'current_chain': current_chain, 'tx_type': 'transfer', 'priority': priority } ) return response.json() # Example usage recommendation = get_routing_recommendation(100, 'ethereum') print(f"Recommended chain: {recommendation['recommended_chain']}") print(f"Save ${recommendation['savings_usd']:.2f} ({recommendation['savings_percent']:.1f}%)") print(f"ML Confidence: {recommendation['confidence']*100:.0f}%")

Integration Example (JavaScript/TypeScript)

async function getRoutingRecommendation( amountUsd, currentChain, priority = 'cost' ) { const response = await fetch( 'https://choreograph-metamask-api.fly.dev/api/v1/route', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ amount: amountUsd, current_chain: currentChain, tx_type: 'transfer', priority: priority }) } ); return response.json(); } // Example usage const rec = await getRoutingRecommendation(100, 'ethereum'); console.log(`Recommended: ${rec.recommended_chain}`); console.log(`Save $${rec.savings_usd.toFixed(2)} (${rec.savings_percent.toFixed(1)}%)`); console.log(`ML Confidence: ${(rec.confidence * 100).toFixed(0)}%`);

Test the MetaMask Snap (Optional)

We built a consumer-facing MetaMask Snap that shows gas recommendations before transaction confirmation.

Prerequisites

Installation Steps

1. Install MetaMask Flask

2. Get Test ETH (for Sepolia testnet)

3. Install Choreograph Snap

4. Run the Snap Server (Required)

# Contact us for the Snap source code git clone [snap-repo-url] cd choreograph-snap npm install npm run serve # Server will start on http://localhost:8081

5. Test a Transaction

What You'll See

⚡ Choreograph Gas Optimizer Current chain: ethereum Current cost: $0.0377 Recommended: base Recommended cost: $0.0008 Potential savings: $0.0369 (97.9%) Confidence: 95% Reasoning: • Cost priority: base saves $0.04 • base is 97.9% cheaper

Testing on Mainnet

Warning: Only test with small amounts you're comfortable losing ($0.50-1.00)

  1. Switch MetaMask Flask to Ethereum Mainnet
  2. Initiate a small transaction
  3. Review the recommendation (real mainnet gas prices)
  4. Note: The Snap shows recommendations but doesn't execute cross-chain routing (yet)

Technical Details

Data Sources

Performance

Smart Routing Logic

ML Confidence Algorithm

API Health Check

curl https://choreograph-metamask-api.fly.dev/health

Response:

{ "service": "Choreograph MetaMask Routing API", "status": "healthy", "version": "1.0.0" }

About Choreograph

AI-powered infrastructure to optimize blockchain transaction costs. Currently validating with launch customers.

Current Status:

Contact

Telegram: @boggsss


© 2025 Choreograph. API operational and ready for testing.