agentsvc.io

services / crypto-prices

financeoperational · 273 ms

Crypto Price Lookup

Crypto price and token price lookup: live spot price and 24h change for BTC, ETH, SOL and other coins by ticker, or for any DEX-traded token by chain:address, in USD and other currencies. Data from DefiLlama. Three modes: (1) coins as CoinGecko-style IDs or tickers (up to 50) for live price and 24h change, converted to the requested currencies; (2) tokens as chain:address (e.g. base:0x833589fC…, ethereum:0x6982…) for any DEX-traded token; (3) at (past ISO date or unix seconds) for historical USD prices of coins and tokens. Params: coins, tokens, currencies (default ['usd']), at.

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.status "settling"; header X-Payment-Settle: sync returns payment.transaction

Input

FieldTypeDescription
tokensarrayTokens as chain:address, e.g. base:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
atstringPast ISO date or unix seconds for historical USD prices
coinsarray = ["bitcoin","ethereum"]List 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. Default when omitted: ['bitcoin', 'ethereum'].
currenciesarray = ["usd"]Target currencies. Default: ['usd']. Supported: usd, btc, eth and every ECB currency (eur, gbp, jpy, chf, aud, cad, ...).

Output

FieldTypeDescription
pricesobjectMap of coin_id to price data: price(s) in the requested currencies, 24h change in USD terms and price time.
fetched_atstringISO 8601 timestamp of the data
sourcestring'DefiLlama coins API', plus 'ECB reference rates' when fiat conversion was needed
not_foundarrayCoin IDs or tickers that could not be resolved

Example response (data)

{
  "prices": {
    "bitcoin": {
      "symbol": "BTC",
      "usd": 71923,
      "usd_24h_change": 1.42,
      "price_time": "2026-04-10T13:59:41.000Z"
    },
    "ethereum": {
      "symbol": "ETH",
      "usd": 2188,
      "usd_24h_change": 0.41,
      "price_time": "2026-04-10T13:59:38.000Z"
    }
  },
  "fetched_at": "2026-04-10T14:00:00.000Z",
  "source": "DefiLlama coins API",
  "not_found": []
}