Lending rates: Aave v3 and Compound v3
GET /api/lending-ratesSupply and borrow rates for the major assets (USDC, USDT, DAI, WETH, WBTC or cbBTC) on Aave v3 and Compound v3, read from the lending contracts on Ethereum, Base, Arbitrum, Optimism or Polygon at the latest block: supply APY and APR, variable borrow APY and APR, the borrow-to-supply spread, Compound's utilization, and per asset the protocol with the higher supply rate, the one with the lower borrow rate and the gap between the two. Send GET /api/lending-rates with no required fields (2 optional) and pay $0.005 per call over x402 or MPP (there is no free tier). It returns a JSON object with source, network, chainId, blockNumber, fetchedAt and 5 more.
Base rates as the contracts report them, without token rewards. Pass `asset` for one asset. Two bounded contract reads per network, kept 30 seconds. Deterministic code over on-chain state, no market-data vendor.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
network | string | no | Network: ethereum, base, arbitrum, optimism, polygon (default ethereum). |
asset | string | no | Only this asset (USDC, USDT, DAI, WETH, WBTC, cbBTC, USDC.e). Omit for every asset read on the network. |
Example request
curl -i "https://agent402.tools/api/lending-rates?network=ethereum"
Without payment this returns HTTP 402 Payment Required with the exact price for lending-rates; any x402 v2 or MPP client pays it and retries.
Example response
{
"source": "onchain",
"network": "ethereum",
"chainId": 1,
"blockNumber": 26431342,
"fetchedAt": "2026-11-16T12:00:00.000Z",
"cached": false,
"count": 2,
"markets": [
{
"protocol": "aave-v3",
"asset": "USDC",
"supplyApyPct": 4.1231,
"supplyAprPct": 4.0404,
"borrowApyPct": 4.8832,
"borrowAprPct": 4.7677,
"spreadPct": 0.7601,
"utilizationPct": null,
"contract": "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2"
},
{
"protocol": "compound-v3",
"asset": "USDC",
"supplyApyPct": 3.9105,
"supplyAprPct": 3.836,
"borrowApyPct": 4.9712,
"borrowAprPct": 4.8516,
"spreadPct": 1.0607,
"utilizationPct": 90.1199,
"contract": "0xc3d688B66703497DAA19211EEdff47f25384cdc3"
}
],
"byAsset": [
{
"asset": "USDC",
"protocols": 2,
"higherSupply": {
"protocol": "aave-v3",
"apyPct": 4.1231
},
"lowerBorrow": {
"protocol": "aave-v3",
"apyPct": 4.8832
},
"supplyGapPct": 0.2126,
"borrowGapPct": 0.088
}
],
"method": "base rates from Aave v3 getReserveData and Compound v3 getSupplyRate/getBorrowRate at the latest block; APY compounds the annual rate every second; token rewards not included"
}| Field | Type | Always present | In the example |
|---|---|---|---|
source | string | yes | onchain |
network | string | yes | ethereum |
chainId | number | yes | 1 |
blockNumber | number | yes | 26431342 |
fetchedAt | string | yes | 2026-11-16T12:00:00.000Z |
cached | boolean | yes | false |
count | number | yes | 2 |
markets | array of objects | yes | 2 items in the example |
byAsset | array of objects | yes | 1 item in the example |
method | string | yes | base rates from Aave v3 getReserveData and Compound v3 getSupplyRate/getBorro... |
From an MCP client
catalog.call {
"slug": "lending-rates",
"params": {
"network": "ethereum"
}
}The hosted connector at https://agent402.tools/mcp needs a payment for lending-rates; the stdio package pays it from a wallet or from an AGENT402_CREDITS_KEY issued earlier. Local install: npx -y agent402-mcp@0.13.32.
Errors and behavior
- Every field is optional. An input the tool rejects returns an HTTP 4xx whose body carries
error,tool,expected,requiredandexample. - A paid call that ends in any status of 400 or above is not charged over x402, MPP or a prepaid credits key: settlement runs after the tool and only on a successful response. The exception is a Tempo push credential, a transfer the buyer sent before the call: it settles before the tool runs, so if the tool then fails the payment is recorded as a refund owed to the paying wallet.
- Wallet-only: this tool reaches the network or stored state, so it has no proof-of-work tier. A prepaid card-credits key issued earlier (
Authorization: Bearer a402_...) also pays it. - A
POSTwith a JSON body to /api/lending-rates is served as this GET, with the body as the input. - An
Idempotency-Keyheader makes a retried paid call replay the first 200 instead of charging again (an answer larger than 1 MB is not replayed).
Paid call (JavaScript agent)
import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";
const client = new x402Client();
client.setSpendControls?.({ maxAmountPerPayment: "$0.005" }); // refuse any quote above this tool's price
registerExactEvmScheme(client, { signer: privateKeyToAccount(KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);
const res = await payFetch("https://agent402.tools/api/lending-rates?network=ethereum");Related tools
Crypto categories by market cap
Coin categories (Layer 1, Meme, AI, DeFi, Stablecoins, RWA, ...) ranked by market cap, with 24h market cap change %, 24h.
Crypto news headlines
Latest crypto headlines aggregated from the public RSS/Atom feeds of 8 major outlets (coindesk, cointelegraph, decrypt.
DeFi token screener
Screen the DeFi category's 250 largest tokens with computed columns: share of the category's market cap, turnover (24h.
DEX pool health
Measured health of one DEX pool by network and pool address: liquidity, 24h turnover (volume over liquidity), buy share.
DEX volume board by network
A network's decentralized exchanges ranked by their share of 24h volume across the network's top pools (the 60 largest.
Global DeFi market
Global DeFi snapshot: DeFi market cap (USD), ETH market cap, DeFi-to-ETH ratio, 24h DeFi trading volume, DeFi dominance.