---
title: "DeFi TVL and Yields: DefiLlama Data for AI Agents"
description: "DeFi TVL and yields with your AI agent: read DefiLlama data and find out why two sources disagree before you quote either. Six jobs, one real run for $0.0618."
canonical: "https://dev.monid.ai/tutorial/how-to-monid-defi-research"
---

# What is locked in this protocol, and what does it pay?

> DeFi TVL and yields with your AI agent: read DefiLlama data and find out why two sources disagree before you quote either. Six jobs, one real run for $0.0618.

- Web page: https://dev.monid.ai/tutorial/how-to-monid-defi-research
- Tools for this job: [Defi](https://dev.monid.ai/tools/defi.md)

## Set up

Paste this to your agent once. It installs the Monid skill and asks for an API key from app.monid.ai.

```text
set up https://monid.ai/SKILL.md
```

## Jobs

Each job is a sentence to paste into your agent. Replace the parts in angle brackets.

### 1. What is locked in this protocol

Ask your agent:

```text
get the tvl for <protocol> from the free defillama protocol endpoint on monid, passing the slug as a path parameter rather than a query one. then get the same protocol's per-chain breakdown and tell me the split between deposits and borrowed before you quote a single figure: the two sources count different things and the gap is not a fixed percentage
```

Listed price: $0.0006 the number and its parts.

Endpoints for this job:

- [`defillama /api/tvl/{protocol}`](https://dev.monid.ai/tools/defillama.md), $0.00 (the one this guide ran)
- [`defillama /api/v2/metrics/tvl/protocol/{protocol}`](https://dev.monid.ai/tools/defillama.md), $0.0006 (the one this guide ran)
- [`surf /project/defi/metrics`](https://dev.monid.ai/tools/surf.md), $0.012 (the one this guide ran)

What a real run returned:

- **the gap is real and its size is not**: 68.0% on the first lending protocol and 42.4% on a second; 0.14% on the first staking one and 1.42% on a second. The direction held on all four: lending diverges, staking barely does
- **why**: summing the plain per-chain keys reproduces the free number exactly, and adding the borrowed aggregate reproduces the paid one. One counts deposits, the other deposits plus borrowed
- **and some of the gap is just age**: the paid source was about 28 hours behind on a second run, so on a protocol where deposits and borrowed barely differ, staleness rather than the definition is what a reader will actually see
- **so there is no fix**: borrowed is most of a lending protocol and none of a staking one, so the gap is a property of the protocol and no correction factor exists
- **and one of the two is free**: the all-protocols endpoint costs nothing and returns the TVL and the per-chain breakdown for every protocol in one call, so the paid per-protocol metrics call is usually buying a field you can have for nothing
- **do not sum that object**: its 51 keys mix chains, suffixed chains and bare aggregates in one namespace; adding them all gives $46.043bn and means nothing

### 2. What a pool is actually paying

Ask your agent:

```text
get the pools for <protocol> on <chain> with defillama on monid and give me the current apy next to the 7 day and 30 day averages for each. they are all in the same row, so quote the window i asked for rather than whichever one is highest
```

Listed price: $0.0006 38 pools, three windows each.

Endpoints for this job:

- [`defillama /yields/v2/earn/query`](https://dev.monid.ai/tools/defillama.md), $0.0006 (the one this guide ran)
- [`surf /onchain/yield/ranking`](https://dev.monid.ai/tools/surf.md), $0.012 (the one this guide ran)

What a real run returned:

- **the honest endpoint**: every pool arrives with its current rate, its seven-day average and its thirty-day average side by side, split into base and reward, so there is no excuse for quoting the wrong window
- **how far they drift**: one pool was paying 0.484% against its own 30-day average of 2.864%, a 2.380 point gap in a single row
- **size is not return**: on the first protocol two of the six largest pools paid 0.000%, being collateral assets with nothing in the row saying so. On a second protocol none of its pools did, so check rather than expect it
- **the range**: 0.0000% to 5.2561% across the 38 pools, and their TVL total is a third figure for the protocol because the query is scoped to one version on one chain

### 3. A token's price, for nothing

Ask your agent:

```text
get the current price of <token> with defillama on monid. do not reach for a paid price endpoint first: on our run the free one returned the same number to four decimal places, and it carries a confidence figure the others do not
```

Listed price: $0.00 and a confidence with it.

Endpoints for this job:

- [`defillama /coins/prices/current/{coins}`](https://dev.monid.ai/tools/defillama.md), $0.00 (the one this guide ran)
- [`surf /market/price`](https://dev.monid.ai/tools/surf.md), $0.012 (the one this guide ran)
- [`surf /dex/token/price`](https://dev.monid.ai/tools/surf.md), $0.006 (the one this guide ran)
- [`surf /search/token`](https://dev.monid.ai/tools/surf.md), $0.006 (the one this guide ran)

What a real run returned:

- **identical**: the free call and the paid call returned the same price to four decimal places on both runs, and the whole three-source spread was about a tenth of a percent. It held on a micro-cap priced at a third of a cent, where the paid call bought nothing either
- **what free adds**: a confidence of 0.99 on every row, which neither paid endpoint carries
- **and both id schemes**: it answered the same query keyed by a chain address and by a registry id in one call, so no translation lookup is needed
- **the outlier is unfinished, not stale**: the candle feed's last bar is stamped at its OPEN and is still forming, so it is a partial bar rather than a lagging one. An earlier version of this page called it an hour behind, which sends a reader to apply a time correction to a number that needs none

### 4. A stablecoin's supply and its peg

Ask your agent:

```text
get <stablecoin> with defillama on monid. the call returns a short stub carrying a download link rather than the body itself, and that link expires in an hour, so fetch it in the same run, write it to a file, and pull the circulating balance and the price out of the file in code. it is tens of megabytes of daily history and it must never reach a model whole
```

Listed price: $0.00 21 MB, and two fields you want.

Endpoints for this job:

- [`defillama /stablecoins/stablecoin/{asset}`](https://dev.monid.ai/tools/defillama.md), $0.00 (the one this guide ran)
- [`defillama /stablecoins/stablecoins`](https://dev.monid.ai/tools/defillama.md), $0.00 (the one this guide ran)
- [`defillama /stablecoins/stablecoinprices`](https://dev.monid.ai/tools/defillama.md), $0.00 (the one this guide ran)

What a real run returned:

- **what you wanted**: $183,768,149,251 circulating, a price of 0.9997963 which is 20 basis points under peg, a fiat-backed mechanism and a named price source
- **what you got**: 21.4 MB on the first stablecoin and 10.6 MB on a second, tens of thousands of daily history points across dozens of chains either way
- **and it does not arrive inline**: the run writes a stub of a few hundred bytes carrying a download link that expires in an hour. Neither field this sentence asks for is in that stub, so a reader who stops at the saved output has nothing; an earlier version of this page missed the fetch step entirely
- **free is not cheap**: the call bills $0.0000 and reading the fetched body whole is the most expensive thing in the pipeline; take the two fields in code and drop the history
- **count the live chains**: a quarter of the chains listed reported a zero balance on both stablecoins, and the top two held 90% and 97% of the supply, so the long tail of chains is presentational

### 5. Compare two protocols on one measure

Ask your agent:

```text
get both protocols from the free all-protocols endpoint on monid in a single call, and say so in the answer. one call for both makes the same-source rule structural rather than something you have to remember, and it costs nothing
```

Listed price: $0.00 two protocols, one ruler.

Endpoints for this job:

- [`defillama /api/tvl/{protocol}`](https://dev.monid.ai/tools/defillama.md), $0.00 (the one this guide ran)
- [`surf /project/defi/metrics`](https://dev.monid.ai/tools/surf.md), $0.012 (the one this guide ran)
- [`defillama /api/v2/metrics/tvl/protocol/{protocol}`](https://dev.monid.ai/tools/defillama.md), $0.0006 (the one this guide ran)

What a real run returned:

- **the rule**: one source for a comparison, named in the answer; the two on this page disagree by 68% on one protocol and 0.14% on another
- **why a mixed comparison lies**: reading a lending protocol on the source that counts borrowed and a staking protocol on the one that does not makes the lender look 68% bigger than it is
- **a third figure exists too**: summing a protocol's pools gives yet another number, because that query is scoped to one version on one chain; three figures, three scopes
- **what it costs to be right**: nothing. One free call returns the TVL and the per-chain breakdown for every protocol at once, which answers this whole sentence and removes the chance of mixing sources rather than merely warning against it

### 6. The empty page that bills

Ask your agent:

```text
if a pools query for <protocol> comes back empty, do NOT conclude the protocol has no pools, and do not try to settle it with the free TVL endpoint: the two do not share a slug namespace, so a slug the TVL endpoint likes can still be one the pools endpoint has nothing under. query a pool you know exists on that protocol, or try the family's other slugs, before you report an absence
```

Listed price: $0.0006 the cost of a typo.

Endpoints for this job:

- [`defillama /yields/v2/earn/query`](https://dev.monid.ai/tools/defillama.md), $0.0006 (the one this guide ran)
- [`defillama /api/tvl/{protocol}`](https://dev.monid.ai/tools/defillama.md), $0.00 (the one this guide ran)
- [`surf /search/token`](https://dev.monid.ai/tools/surf.md), $0.006 (the one this guide ran)

What a real run returned:

- **what it looks like**: an empty data array and a pagination block reporting a total of zero, HTTP 200, billed in full
- **what it is indistinguishable from**: a real protocol that genuinely has no pools on that chain; nothing in the response separates the two
- **the cheap check does not work, and this page used to recommend it**: the two endpoints do not share a slug namespace. On a second protocol family the parent slug returned $1.63bn of TVL from the free endpoint while the pools endpoint returned an empty page for it and billed, which is a false all-clear; and the bare family name was refused outright by the free endpoint while the pools endpoint accepted it and billed, which is the opposite error
- **so test a guard in both directions**: a check that can pass a wrong slug and fail a right one is worse than no check, because it converts a doubt into a wrong answer you now trust
- **what does work**: ask for a pool you know the protocol has. A positive result proves the slug; nothing else in this pair of endpoints does
- **why it matters here more**: in an aisle where most calls are free, the ones that bill are the ones worth getting right first time

## More

- [Every how-to guide](https://dev.monid.ai/tutorial.md)
- [Connect an agent to Monid](https://dev.monid.ai/index.md)
