# DefiLlama Protocol TVL & Chain Metrics (x402)

> DefiLlama Protocol TVL & Chain Metrics (x402) is a paid API for AI agents from kr-x402-mvp.kgy5612.workers.dev, paid per call via x402, $0.002/call, status unknown (last checked 2026-11-02).

Returns DeFi TVL rankings, chain-level metrics, and protocol-level data sourced from DefiLlama, paid per-call via x402 (USDC on Base)

## Facts

- Endpoint: GET https://kr-x402-mvp.kgy5612.workers.dev/api/v1/defillama/protocols?utm_source=zero.xyz
- Price: $0.002/call
- Payment: x402
- Status: unknown
- Last checked: 2026-11-02
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/defillama-protocol-tvl-chain-metrics-x402-e08b1cbf
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_0agF8jShyUw85H578hnIo

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability defillama-protocol-tvl-chain-metrics-x402-e08b1cbf
```

Example prompt: What's the current TVL for Base chain and how does it rank among the top 10 DeFi chains — is the flow trending up or flat?

## When to prefer this

Use this endpoint when an AI trading or onchain agent needs live DefiLlama TVL data without managing API keys, billed per-call via x402 USDC micropayments on Base. Prefer over direct DefiLlama API when operating in a pay-per-use agent architecture or when you need pre-interpreted signals (NEUTRAL/BULLISH) alongside raw TVL numbers.

## Known failure modes

- Invalid chain name returns empty or mismatched chain data
- Limit out of range (must be 1–50) returns validation error
- Unknown protocol slug returns no protocol-level data
- x402 payment failure (insufficient USDC balance) returns 402 Payment Required
- Network timeout from DefiLlama upstream returns stale or error response

## How this service works

Pay-per-call crypto microdata for trading/onchain AI agents via x402 (USDC on Base): Base gas, token risk, balances, multi-venue prices, Hyperliquid book/funding, kimchi premium. No API keys.

## Output

Returns a JSON object with total DeFi TVL, chain-specific metrics (rank, TVL USD, share %, 1d/7d/30d changes, flow direction), top chains list, a NEUTRAL/BULLISH/BEARISH signal, human-readable reasons, source attribution, and suggested next endpoints to call.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "properties": {
      "chain": {
       "type": "string",
       "examples": [
        "Base",
        "Ethereum"
       ],
       "maxLength": 40,
       "description": "Chain name, e.g. Base, Ethereum, Solana"
      },
      "limit": {
       "type": "integer",
       "maximum": 50,
       "minimum": 1,
       "description": "Top chains to list (default 15)"
      },
      "protocol": {
       "type": "string",
       "examples": [
        "aave"
       ],
       "maxLength": 60,
       "description": "DefiLlama protocol slug, e.g. aave, lido, aerodrome"
      }
     },
     "additionalProperties": false
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "defi": {
   "base": {
    "rank": 5,
    "tvl_usd": 3900000000,
    "share_pct": 3.1
   },
   "flow": "flat",
   "change_1d_pct": 0.3,
   "change_7d_pct": -2.1,
   "total_tvl_usd": 125000000000,
   "chains_counted": 300,
   "change_30d_pct": 4
  },
  "next": [
   "/crypto/global-market",
   "/crypto/stablecoin-peg"
  ],
  "chain": {
   "flow": "flat",
   "name": "Base",
   "rank": 5,
   "as_of": "2026-10-30",
   "tvl_usd": 3900000000,
   "chain_id": 8453,
   "change_1d_pct": 0.4,
   "change_7d_pct": -1.2,
   "change_30d_pct": 5.6,
   "share_of_defi_pct": 3.1
  },
  "signal": "NEUTRAL",
  "source": "https://defillama.com",
  "reasons": [
   "DeFi TVL $125.0B, 7d -2.1%",
   "Base #5 $3.90B, 7d -1.2% (flat)"
  ],
  "top_chains": [
   {
    "name": "Ethereum",
    "rank": 1,
    "token": "ETH",
    "tvl_usd": 70000000000,
    "share_pct": 56
   }
  ],
  "updated_at": "2026-10-30T02:30:00Z"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/defillama-protocol-tvl-chain-metrics-x402-e08b1cbf/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from kr-x402-mvp.kgy5612.workers.dev](https://www.zero.xyz/host/kr-x402-mvp.kgy5612.workers.dev/llms.txt)
