agentsvc.io

services / crypto-prices

financeoperational · 402 ms

Crypto Price Lookup

Real-time crypto prices, market caps, and 24h % changes via CoinGecko. Pass coins as CoinGecko IDs (['bitcoin','ethereum','solana']) or tickers. Max 25 coins per call. Returns usd, usd_24h_change, usd_market_cap per coin. Add currencies param for multi-currency output (['usd','eur','gbp']).

Run free trial ↗3 free calls per day with the example input. Paid: $0.002 USDC, no limit.

Call it

import { wrapFetchWithPayment, x402Client } from "@x402/fetch";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = new x402Client();
registerExactEvmScheme(client, { signer: privateKeyToAccount(process.env.EVM_PRIVATE_KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);

const res = await payFetch("https://agentsvc.io/api/v1/proxy/crypto-prices", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({"coins":["bitcoin","ethereum"],"currencies":["usd"]}),
});
const { data, payment } = await res.json();  // payment.transaction = on-chain receipt

Input

FieldTypeDescription
coins *arrayList of coin IDs or ticker symbols. Accepts CoinGecko IDs (e.g. 'bitcoin', 'ethereum') or common tickers (e.g. 'BTC', 'ETH', 'SOL'). Max 25 coins per call.
currenciesarray = ["usd"]Target fiat currencies. Default: ['usd']. Supported: usd, eur, gbp, jpy, chf, aud, cad, btc, eth.

Output

FieldTypeDescription
pricesobjectMap of coin_id → price data. Each entry contains price(s) in requested currencies, 24h change, and market cap.
fetched_atstringISO 8601 timestamp of the data
sourcestringAlways: 'CoinGecko'
not_foundarrayCoin IDs or tickers that could not be resolved

Example response (data)

{
  "prices": {
    "bitcoin": {
      "name": "Bitcoin",
      "symbol": "BTC",
      "usd": 71923,
      "usd_24h_change": 1.42,
      "usd_market_cap": 1419000000000
    },
    "ethereum": {
      "name": "Ethereum",
      "symbol": "ETH",
      "usd": 2188,
      "usd_24h_change": 0.41,
      "usd_market_cap": 263000000000
    }
  },
  "fetched_at": "2026-04-10T14:00:00.000Z",
  "source": "CoinGecko",
  "not_found": []
}