x402hub
← Finance & Markets

CoinGecko

pro-api.coingecko.com · https://pro-api.coingecko.com/api/v3/x402/onchain/simple/networks/base/token_price/0x0b3e328455c4059eeb9e3f84b5543f74e24e7e1b,0x22af33fe49fd1fa80c7149773dde5890d3c76f3b,0xacfe6019ed1a7dc6f7b508c02d1b04ec88cc21bf,0x9b5e262cf9bb04869ab40b19af91d2dc85761722,0x296eb9c4d8fcbd00fbc6d5027e4202bf955fa76f
💵 $0.01 USDC per call 🌐 Base, Solana 📈 2 calls / 30d · 2 unique payers

Query onchain DEX token price & market data based on the provided token contract addresses on a network.

This endpoint speaks x402: an unpaid request returns HTTP 402 with machine-readable payment terms, your agent pays the $0.01 USDC in USDC on-chain, and retries automatically. Pays to 0x110cdBba7FE6434Ec4CE3464CC523942ad6Fb784.

Call it in 30 seconds

JavaScriptPythoncurl
// npm i x402-fetch viem
import { wrapFetchWithPayment } from "x402-fetch";
import { createWalletClient, http } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { base } from "viem/chains";

const account = privateKeyToAccount(process.env.PRIVATE_KEY); // funds USDC on Base
const wallet = createWalletClient({ account, chain: base, transport: http() });
const fetchWithPay = wrapFetchWithPayment(fetch, wallet);

// Pays the $0.01 USDC automatically on the 402, then returns the real response:
const res = await fetchWithPay("https://pro-api.coingecko.com/api/v3/x402/onchain/simple/networks/base/token_price/0x0b3e328455c4059eeb9e3f84b5543f74e24e7e1b,0x22af33fe49fd1fa80c7149773dde5890d3c76f3b,0xacfe6019ed1a7dc6f7b508c02d1b04ec88cc21bf,0x9b5e262cf9bb04869ab40b19af91d2dc85761722,0x296eb9c4d8fcbd00fbc6d5027e4202bf955fa76f", { method: "GET" });
console.log(await res.json());
# pip install x402 eth-account httpx
import os, asyncio
from eth_account import Account
from x402.clients.httpx import x402HttpxClient

account = Account.from_key(os.environ["PRIVATE_KEY"])  # funds USDC on Base

async def main():
    async with x402HttpxClient(account=account) as client:
        # x402 handles the 402 -> pay ($0.01 USDC) -> retry automatically
        r = await client.get("https://pro-api.coingecko.com/api/v3/x402/onchain/simple/networks/base/token_price/0x0b3e328455c4059eeb9e3f84b5543f74e24e7e1b,0x22af33fe49fd1fa80c7149773dde5890d3c76f3b,0xacfe6019ed1a7dc6f7b508c02d1b04ec88cc21bf,0x9b5e262cf9bb04869ab40b19af91d2dc85761722,0x296eb9c4d8fcbd00fbc6d5027e4202bf955fa76f")
        print((await r.aread()).decode())

asyncio.run(main())
# 1) An unpaid request returns HTTP 402 with the exact payment terms:
curl -i "https://pro-api.coingecko.com/api/v3/x402/onchain/simple/networks/base/token_price/0x0b3e328455c4059eeb9e3f84b5543f74e24e7e1b,0x22af33fe49fd1fa80c7149773dde5890d3c76f3b,0xacfe6019ed1a7dc6f7b508c02d1b04ec88cc21bf,0x9b5e262cf9bb04869ab40b19af91d2dc85761722,0x296eb9c4d8fcbd00fbc6d5027e4202bf955fa76f?include_24hr_price_change=True&include_24hr_vol=True&include_inactive_source=True&include_market_cap=True&include_total_reserve_in_usd=True&mcap_fdv_fallback=True"

# 2) Paying + retrying requires an x402 client that can sign the USDC
#    authorization (curl alone cannot). See the JS / Python tabs below.

New to x402? Read the 5-minute quickstart →

ad slot · a crypto-native, no-tracking ad loads here in production
Query this registry programmatically. Every service here is searchable through the x402hub API, an x402-payable endpoint your agents call and pay per request in USDC.
https://api-service-sandy.vercel.app · GET /api/search?q=... · $0.002 / call
Prefer to just support the project? Tip USDC on Base to 0x40BbeB1BEd1D4ba6f1d4C0eE0C9D93e2dA3347C6. This hub is free and ad-light.