[Integrations](https://spiral.ai/integrations) › [opencode](https://spiral.ai/integrations/opencode) › [DeFiLlama chain TVL history](https://spiral.ai/integrations/opencode/defillama-chain-tvl-history)

# How to Use DeFiLlama chain TVL history in opencode

Returns historical total value locked for a chain or DeFi overall. Use it to measure changes over time; chain totals exclude liquid staking and double-counted TVL.

|  |  |
| --- | --- |
| Model | DeFiLlama chain TVL history |
| Available through | Alexandria |
| Category | Finance |
| Price | $0.00873 per call. |
| Returns | json |
| Runs | In the background |
| Setup | About 2 minutes, no API key |

## Prompts to try with DeFiLlama chain TVL history in opencode

- Use DeFiLlama chain TVL history to fetch Ethereum's available observations for the past 90 days and add a dated TVL chart to my research notebook.
- Use DeFiLlama chain TVL history to look this up and give me the result as a table. Save the result in ./assets.
- Pull the latest numbers from DeFiLlama chain TVL history and tell me what changed since last week.
- Check DeFiLlama chain TVL history and summarize what you find in three bullet points.
- Pull the newest data from DeFiLlama chain TVL history and give me the result as a table.

## How to set up DeFiLlama chain TVL history in opencode

Pick the way that suits you. Each takes about two minutes.

### Use Spiral's MCP server

1. **Add the server**: Leave out `--global` to add Spiral to the current project only. No header and no client ID or secret: opencode registers itself with Spiral.

```bash
opencode mcp add spiral --global --url https://api.spiral.ai/mcp
```

2. **Sign in**: Your browser opens. Sign in to Spiral, pick the organization and click Authorize, then return to the terminal. No API key. Inside opencode, `/mcps` starts the same sign-in.

```bash
opencode mcp auth spiral
```

3. **Check it**: Spiral shows as connected.

```bash
opencode mcp list
```

### Use the Spiral skill

1. **Send opencode this message**: Your agent reads Spiral's skill and sets itself up.

```
set up https://spiral.ai/SKILL.md
```

2. **Sign in or paste a key**: Approve Spiral in the browser, or give the agent a key from the console.

### Use the Spiral CLI

1. **Install and sign in**: Installs the Spiral CLI, signs you in and adds its skill to your coding agents.

```bash
npx -y spiral-cli@latest init
```

### Call the Spiral API

1. **Create an API key**: In the console, under API keys.

2. **Run DeFiLlama chain TVL history**: One request; the result comes back by polling or a webhook.

```bash
curl https://api.spiral.ai/v1/runs \
  -H "Authorization: Bearer $SPIRAL_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "provider": "alexandria",
    "model": "defillama-com/crypto/chain_tvl_history",
    "input": {
      "to": 0
    }
  }'
```

Then paste one of the prompts above: opencode finds DeFiLlama chain TVL history on Spiral, shows the price and runs it.

Setup guide in the docs: https://spiral.ai/docs/quickstarts/opencode

## DeFiLlama chain TVL history tools and prices

- [DeFiLlama · Chain tvl history](https://spiral.ai/tools/alexandria/defillama-com/crypto/chain_tvl_history) (Alexandria): $0.00873 per call.

## Settings you can ask for

| Setting | Allowed values | Default | Description |
| --- | --- | --- | --- |
| to | 0 to … | — | Latest point, unix seconds. |
| from | 0 to … | — | Earliest point, unix seconds. |
| chain |  | all | Chain name as DeFiLlama writes it (e.g. `Ethereum`, `Solana`), or `all` (default). |
| limit | 1 to 4000 | 90 | Maximum points, newest first (1..4000, default 90). |

## What can you do with DeFiLlama chain TVL history in opencode?

Build a personal DeFi research notebook that compares chain activity, protocol economics, token markets, and recorded exploits. A coding agent can turn DeFiLlama responses into tables and charts in your project.

### Weekly DeFi research brief

Prepare a personal research brief covering chain and protocol TVL rankings, historical changes, fees, volume, stablecoin distribution, token market moves, and recorded hacks.

### Compare chain ecosystems

Compare Ethereum, Solana, and Base using chain TVL trends, protocol rankings, fees or volume, and stablecoin market cap. Examine leading protocols to see what contributes to each chain's totals.

### Protocol due diligence

Build a research dossier on Aave or Uniswap with TVL composition, economic activity, comparable protocols, token price context, and recorded incidents. Add chain TVL and stablecoin distribution to describe the surrounding ecosystem.

### Review an incident's aftermath

Place a recorded hack beside the affected protocol's TVL, fee or volume history, and token price observations. Compare the surrounding chain's TVL trend and current stablecoin market cap without assuming the incident caused every change.

### Benchmark chain liquidity and activity

Compare current chain TVL with stablecoin market cap, then inspect TVL history, protocol composition, and fee or volume rankings. Use separate columns for each measure so their different meanings remain clear.

### Study historical security events

Compare recorded incidents by loss and attack classification. For affected public protocols with available data, examine TVL, economic activity, chain trends, and token prices around the incident dates.

## Overview

- [Alexandria](https://spiral.ai/providers/alexandria)
- [All opencode guides](https://spiral.ai/integrations/opencode)

## DeFiLlama chain TVL history in other agents

- [Amp](https://spiral.ai/integrations/amp/defillama-chain-tvl-history)
- [ChatGPT](https://spiral.ai/integrations/chatgpt/defillama-chain-tvl-history)
- [Claude](https://spiral.ai/integrations/claude-desktop/defillama-chain-tvl-history)
- [Claude Code](https://spiral.ai/integrations/claude-code/defillama-chain-tvl-history)
- [Cline](https://spiral.ai/integrations/cline/defillama-chain-tvl-history)
- [Codex](https://spiral.ai/integrations/codex/defillama-chain-tvl-history)
- [Cursor](https://spiral.ai/integrations/cursor/defillama-chain-tvl-history)
- [Devin](https://spiral.ai/integrations/devin/defillama-chain-tvl-history)
- [dots](https://spiral.ai/integrations/dots/defillama-chain-tvl-history)
- [Factory Droid](https://spiral.ai/integrations/factory-droid/defillama-chain-tvl-history)
- [Gemini](https://spiral.ai/integrations/gemini/defillama-chain-tvl-history)
- [Gemini CLI](https://spiral.ai/integrations/gemini-cli/defillama-chain-tvl-history)
- [Google Antigravity](https://spiral.ai/integrations/antigravity/defillama-chain-tvl-history)
- [goose](https://spiral.ai/integrations/goose/defillama-chain-tvl-history)
- [Grok](https://spiral.ai/integrations/grok/defillama-chain-tvl-history)
- [Grok Build](https://spiral.ai/integrations/grok-build/defillama-chain-tvl-history)
- [Hermes](https://spiral.ai/integrations/hermes/defillama-chain-tvl-history)
- [Instinct](https://spiral.ai/integrations/instinct/defillama-chain-tvl-history)
- [Manus](https://spiral.ai/integrations/manus/defillama-chain-tvl-history)
- [Muse](https://spiral.ai/integrations/muse/defillama-chain-tvl-history)
- [Muse Code](https://spiral.ai/integrations/muse-code/defillama-chain-tvl-history)
- [n8n](https://spiral.ai/integrations/n8n/defillama-chain-tvl-history)
- [Notion](https://spiral.ai/integrations/notion/defillama-chain-tvl-history)
- [OpenClaw](https://spiral.ai/integrations/openclaw/defillama-chain-tvl-history)
- [Perplexity](https://spiral.ai/integrations/perplexity/defillama-chain-tvl-history)
- [Raycast](https://spiral.ai/integrations/raycast/defillama-chain-tvl-history)
- [VS Code](https://spiral.ai/integrations/vscode/defillama-chain-tvl-history)
- [Windsurf](https://spiral.ai/integrations/windsurf/defillama-chain-tvl-history)
- [Zapier](https://spiral.ai/integrations/zapier/defillama-chain-tvl-history)

## More opencode guides

- [Coinbase cbETH conversion and supply](https://spiral.ai/integrations/opencode/coinbase-cbeth-conversion-and-supply)
- [DeFiLlama chain TVL rankings](https://spiral.ai/integrations/opencode/defillama-chain-tvl-rankings)
- [Coinbase Exchange volume summary](https://spiral.ai/integrations/opencode/coinbase-exchange-volume-summary)
- [DeFiLlama crypto hacks](https://spiral.ai/integrations/opencode/defillama-crypto-hacks)
- [Coinbase Exchange trading pair list](https://spiral.ai/integrations/opencode/coinbase-exchange-trading-pair-list)
- [DeFiLlama protocol TVL details](https://spiral.ai/integrations/opencode/defillama-protocol-tvl-details)

## Questions about DeFiLlama chain TVL history in opencode

**Can opencode use DeFiLlama chain TVL history?**

Yes. Add Spiral to opencode as an MCP server, and opencode can find and run DeFiLlama chain TVL history like any built-in tool.

**How much does DeFiLlama chain TVL history cost in opencode?**

$0.00873 per call. You pay from your Spiral balance as you go, with no subscription, and a failed run is not charged. Your opencode plan is separate.

**Do I need an Alexandria account to use DeFiLlama chain TVL history in opencode?**

No. Spiral runs DeFiLlama chain TVL history on its own Alexandria account. You sign in to Spiral once and never paste a key.

**How long does it take to set up DeFiLlama chain TVL history in opencode?**

About two minutes: add the server, then sign in, then check it.

**Does opencode wait while DeFiLlama chain TVL history runs?**

DeFiLlama chain TVL history runs in the background. opencode starts the run, checks on it and gives you the json when it's ready.

**How often does DeFiLlama update its data?**

TVL and stablecoin supply update hourly. Most fee, revenue, and DEX volume data updates hourly, but some protocols update only daily at midnight UTC.

**Where does DeFiLlama get its data?**

DeFiLlama maintains separate open-source adapter repositories for its metrics. Its TVL methodology says almost all tokens are valued using CoinGecko, with on-chain methods used when needed.

**Does every protocol have the same historical coverage?**

No. An adapter can define its earliest supported timestamp, and some adapters cannot backfill historical data. History therefore depends on the protocol's adapter.

**Does DeFiLlama's TVL include native token staking?**

Native token staking is excluded. DeFiLlama also excludes off-chain assets such as fiat held in a stablecoin issuer's bank account from TVL.

**Are protocol fees and revenue the same measure?**

No. Revenue excludes fees distributed to liquidity providers and other suppliers of capital. A protocol's fee total can therefore exceed what the protocol retains.

