Token Price
Token price lookup built for high-frequency agent use. Ask for up to 10 tokens in one call, addressed exactly how agents hold them: <chain>:<contract-address> for anything on Base, Ethereum, Arbitrum, Optimism, Polygon, Solana and 100+ other chains, or coingecko:<id> for majors (coingecko:ethereum, coingecko:bitcoin). Each answer carries the aggregated USD price, symbol, decimals, a CONFIDENCE score (how solid the price source mix is — thin DEX-only pricing scores lower) and the price timestamp, with unknown tokens listed separately in missing[] instead of failing the whole call. Source is DefiLlama's open price engine, which aggregates DEX and CEX sources. At $0.002 per call (first call free for new wallets, volume discounts advertised in every 402), it is priced to be called before every trade decision. Pairs with token-risk (is this token safe?) and stablecoin-stats (is my settlement currency on peg?).
Call with x402
1. Send the request. 2. Receive 402 with accepts[]. 3. Sign the payment and retry with the X-PAYMENT header.
curl -X POST https://agentbit.app/v1/defi/price \
-H 'Content-Type: application/json' \
-d '{"tokens":["base:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","coingecko:ethereum"]}'
Input schema
{
"type": "object",
"properties": {
"token": {
"type": "string",
"description": "Single token: <chain>:<address> or coingecko:<id>"
},
"tokens": {
"type": "array",
"items": {
"type": "string"
},
"description": "Up to 10 tokens per call"
}
}
}Output schema
{
"type": "object",
"properties": {
"prices": {
"type": "array",
"items": {
"type": "object",
"properties": {
"token": {
"type": "string"
},
"symbol": {
"type": [
"string",
"null"
]
},
"price_usd": {
"type": "number"
},
"decimals": {
"type": [
"integer",
"null"
]
},
"confidence": {
"type": [
"number",
"null"
]
},
"as_of": {
"type": [
"string",
"null"
]
}
}
}
},
"found": {
"type": "integer"
},
"missing": {
"type": "array",
"items": {
"type": "string"
}
},
"source": {
"type": "string"
}
}
}Code examples
// JavaScript (x402-fetch)
import { wrapFetchWithPayment } from "x402-fetch";
const fetchWithPay = wrapFetchWithPayment(fetch, wallet);
const r = await fetchWithPay("https://agentbit.app/v1/defi/price", {
method: "POST",
headers: {"Content-Type": "application/json"},
body: JSON.stringify({"tokens":["base:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","coingecko:ethereum"]})
});
console.log(await r.json());
# Python (x402 client)
from x402.clients.requests import x402_requests
s = x402_requests(account)
r = s.post("https://agentbit.app/v1/defi/price",
json={"tokens":["base:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","coingecko:ethereum"]})
print(r.json())
// PHP
$r = Http::withHeaders(['X-PAYMENT' => $signedPayment])
->post('https://agentbit.app/v1/defi/price',
array (
'tokens' =>
array (
0 => 'base:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
1 => 'coingecko:ethereum',
),
));
$data = $r->json();