Agent skill

Defillama API

by agiprolabs in agiprolabs/claude-trading-skills

Free DeFi analytics across all chains — TVL, token prices, DEX volumes, fees/revenue, stablecoins, and bridges

MITAuto-check passedBusiness, Finance & HR

Install Defillama API

skills CLI
$ npx skills add agiprolabs/claude-trading-skills --skill defillama-api -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install agiprolabs/claude-trading-skills defillama-api --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/agiprolabs/claude-trading-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/defillama-api .claude/skills/defillama-api && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
defillama-api
GitHub stars
410
Token cost
~1.9k tokens
SKILL.md length
272 words
Files
6 (incl. scripts, references)
Skills in repo
68
Repo updated
First seen
Licence
MIT

At a glance

Free DeFi analytics across all chains — TVL, token prices, DEX volumes, fees/revenue, stablecoins, and bridges

  • Tasks that involve Crypto and DeFi analysis
  • SKILL.md covers Quick Start, Base URLs, TVL & Protocol Data and Token Prices, plus 8 more sections
  • Runs Python scripts from its folder; reaches api.llama.fi and stablecoins.llama.fi

What it does

Defillama API is an agent skill from agiprolabs/claude-trading-skills. Free DeFi analytics across all chains — TVL, token prices, DEX volumes, fees/revenue, stablecoins, and bridges

Its SKILL.md is about 1.9k tokens, which your agent loads only when the skill is triggered. The skill folder holds 7 other files, including scripts and reference files (for example `references/coin_identifiers.md`, `references/endpoints.md` and `references/error_handling.md`).

It sits in Business, Finance & HR, covering Crypto and DeFi analysis. It works with Solana. The repository describes itself as: 68 trading, DeFi, and quantitative finance Agent Skills. Works with Claude Code, Cursor, Codex, Gemini CLI, and 30+ other tools. The licence is MIT.

When your agent uses it

  • Tasks that involve Crypto and DeFi analysis

Example prompts

  • “/defillama-api”

Requirements

  • Python 3

What it can do on your machine

Read from SKILL.md and the folder at commit 981e1d7. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 2 files in scripts/ (Python), which the agent can run.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • api.llama.fi
    • stablecoins.llama.fi
    • coins.llama.fi
    • bridges.llama.fi
    • yields.llama.fi
    • pro-api.llama.fi

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Defillama API loads about 1.9k tokens when it runs, and up to ~4.8k if it reads all its reference files. Until then it costs about 31 tokens; SKILL.md has 272 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~31
When it runs · the whole SKILL.md, loaded when a task matches
~1.9k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~4.8k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from agiprolabs/claude-trading-skills at commit 981e1d7, republished under its MIT licence (© agiprolabs). 272 words, ~1,949 tokens.

Download SKILL.mdSave it as .claude/skills/defillama-api/SKILL.md (or your agent's skills folder). This skill also uses 5 other files; get the full folder from GitHub.
name
defillama-api
description
Free DeFi analytics across all chains — TVL, token prices, DEX volumes, fees/revenue, stablecoins, and bridges

DeFiLlama API — DeFi Macro Analytics

DeFiLlama is the largest DeFi TVL aggregator. Its API is free with no authentication for most endpoints — covering TVL, token prices, DEX volumes, fees/revenue, stablecoins, and bridges across all chains.

Quick Start

python
import httpx

# No auth required for free endpoints
BASE = "https://api.llama.fi"
COINS = "https://coins.llama.fi"

# Current TVL for a protocol
tvl = httpx.get(f"{BASE}/tvl/raydium").json()
print(f"Raydium TVL: ${tvl:,.0f}")

# Token prices (multi-chain)
resp = httpx.get(f"{COINS}/prices/current/solana:So11111111111111111111111111111111111111112")
sol_price = resp.json()["coins"]["solana:So11111111111111111111111111111111111111112"]["price"]

Base URLs

ServiceBase URLAuth
TVL / Protocolshttps://api.llama.fiFree
Coin Priceshttps://coins.llama.fiFree
Stablecoinshttps://stablecoins.llama.fiFree
Yieldshttps://yields.llama.fiPro ($300/mo)
Bridgeshttps://bridges.llama.fiFree (list) / Pro (detail)
Pro APIhttps://pro-api.llama.fi/{KEY}/api/...Pro key in URL path

Rate limits: ~500 requests per 5 minutes (free). Pro: 1,000 req/min, 1M calls/mo.

TVL & Protocol Data

python
# List all protocols with TVL
GET /protocols
# Returns: [{name, slug, tvl, chainTvls, change_1h, change_1d, change_7d, category, chains, ...}]

# Detailed protocol data with historical TVL
GET /protocol/{slug}
# Returns: Full object with tvl[], tokensInUsd{}, currentChainTvls{}, ...

# Simple current TVL number
GET /tvl/{slug}
# Returns: plain number (e.g., 150977324562.40)

# TVL for all chains
GET /v2/chains
# Returns: [{name, tvl, tokenSymbol, chainId, gecko_id}]

# Historical chain TVL
GET /v2/historicalChainTvl/{chain}
# chain: "Ethereum", "Solana", "Arbitrum", etc.
# Returns: [{date, tvl}] — date is unix timestamp (seconds)

Token Prices

Coin identifiers use {chain}:{address} format:

  • solana:So11111111111111111111111111111111111111112 (SOL)
  • ethereum:0xdac17f958d2ee523a2206206994597c13d831ec7 (USDT)
  • coingecko:bitcoin (non-chain lookups)
python
# Current prices (batch)
GET /prices/current/{coins}
# coins: comma-separated identifiers
# Optional: searchWidth (default 4h)
# Returns: {coins: {id: {price, decimals, symbol, timestamp, confidence}}}

# Historical price at timestamp
GET /prices/historical/{timestamp}/{coins}
# timestamp: unix seconds

# Price chart
GET /chart/{coins}?period=1d&span=30
# period: 1d, 4h, 1h
# Returns: {coins: {id: {prices: [{timestamp, price}]}}}

# Price change percentage
GET /percentage/{coins}

# First recorded price
GET /prices/first/{coins}

# Block number at timestamp
GET /block/{chain}/{timestamp}
Batch Historical Prices
python
# POST for multiple timestamps per coin
POST /batchHistorical
Body: {"coins": {"solana:So11...": [1709251200, 1709337600]}}

DEX Volumes

python
# All DEXes aggregated
GET /overview/dexs
# Optional: excludeTotalDataChart=true, dataType=dailyVolume

# Chain-specific
GET /overview/dexs/{chain}
# chain: "Solana", "Ethereum", etc.

# Specific DEX
GET /summary/dexs/{protocol}
# Returns: {total24h, total7d, total30d, totalAllTime, totalDataChart, ...}

Fees & Revenue

python
# All protocols
GET /overview/fees
# Optional: dataType=dailyFees|dailyRevenue|dailyUserFees

# Chain-specific
GET /overview/fees/{chain}

# Specific protocol
GET /summary/fees/{protocol}
# Returns: {total24h, total7d, methodology{}, totalDataChart[], ...}

Stablecoins

python
# All stablecoins with supply data
GET https://stablecoins.llama.fi/stablecoins
# Returns: [{name, symbol, pegType, circulating, chainCirculating, price}]

# Historical market cap
GET https://stablecoins.llama.fi/stablecoincharts/all

# Chain-specific stablecoin data
GET https://stablecoins.llama.fi/stablecoincharts/{chain}

# Stablecoin prices (deviation tracking)
GET https://stablecoins.llama.fi/stablecoinprices

Bridges

python
# List all bridges
GET https://bridges.llama.fi/bridges
# Optional: includeChains=true
# Returns: {bridges: [{name, volume stats, chains, ...}]}

Common Patterns

Protocol TVL Comparison
python
def compare_protocol_tvl(slugs: list[str]) -> list[dict]:
    """Compare TVL across protocols."""
    results = []
    for slug in slugs:
        resp = httpx.get(f"https://api.llama.fi/tvl/{slug}", timeout=15.0)
        if resp.status_code == 200:
            results.append({"protocol": slug, "tvl": resp.json()})
    return sorted(results, key=lambda x: x["tvl"], reverse=True)
Multi-Token Price Lookup
python
def get_solana_prices(mints: list[str]) -> dict[str, float]:
    """Get USD prices for Solana tokens via DeFiLlama."""
    coins = ",".join(f"solana:{m}" for m in mints)
    resp = httpx.get(f"https://coins.llama.fi/prices/current/{coins}")
    data = resp.json().get("coins", {})
    return {
        mint: data[f"solana:{mint}"]["price"]
        for mint in mints
        if f"solana:{mint}" in data
    }
Solana DeFi Overview
python
def solana_defi_snapshot() -> dict:
    """Get a snapshot of Solana DeFi activity."""
    chain_tvl = httpx.get("https://api.llama.fi/v2/chains").json()
    sol_tvl = next((c["tvl"] for c in chain_tvl if c["name"] == "Solana"), 0)

    dex_vol = httpx.get("https://api.llama.fi/overview/dexs/Solana").json()
    fees = httpx.get("https://api.llama.fi/overview/fees/Solana").json()

    return {
        "tvl": sol_tvl,
        "dex_volume_24h": dex_vol.get("total24h", 0),
        "fees_24h": fees.get("total24h", 0),
    }
Historical Price Analysis
python
def price_at_date(coin: str, date_str: str) -> float:
    """Get token price at a specific date.

    Args:
        coin: DeFiLlama coin ID (e.g., 'solana:So11...')
        date_str: Date string 'YYYY-MM-DD'
    """
    from datetime import datetime, timezone
    dt = datetime.strptime(date_str, "%Y-%m-%d").replace(tzinfo=timezone.utc)
    ts = int(dt.timestamp())
    resp = httpx.get(f"https://coins.llama.fi/prices/historical/{ts}/{coin}")
    data = resp.json().get("coins", {})
    return data.get(coin, {}).get("price", 0)

Free vs Pro Endpoints

CategoryFreePro ($300/mo)
TVL / ProtocolsYesYes
Coin PricesYesYes
DEX Volumes (overview)YesYes
Fees/Revenue (overview)YesYes
StablecoinsYesYes
Bridges (list)YesYes
Yields / PoolsNoYes
Bridge detailNoYes
DerivativesNoYes
Emissions/UnlocksNoYes
TreasuriesNoYes
Hacks databaseNoYes

When to Use DeFiLlama vs Alternatives

NeedUse
Protocol TVL comparisonDeFiLlama
Multi-chain token pricesDeFiLlama (free batch)
Historical prices at specific timestampsDeFiLlama
DeFi macro analysisDeFiLlama
Solana token OHLCVBirdeye or SolanaTracker
Real-time token dataDexScreener or Birdeye
Wallet PnLSolanaTracker
On-chain transaction dataHelius

Files

References
  • references/endpoints.md — Complete endpoint listing with parameters and response schemas
  • references/coin_identifiers.md — Chain prefixes, address formats, and batch lookup patterns
  • references/error_handling.md — Rate limits, error codes, retry strategies, large response handling
Scripts
  • scripts/defi_snapshot.py — Solana DeFi overview: TVL, volumes, fees, top protocols
  • scripts/price_lookup.py — Multi-token price lookup with historical comparison

© agiprolabs, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 5 other files (scripts, references) in skills/defillama-api of agiprolabs/claude-trading-skills.

  • SKILL.md
  • references/coin_identifiers.md
  • references/endpoints.md
  • references/error_handling.md
  • scripts/defi_snapshot.py
  • scripts/price_lookup.py

Open the folder on GitHubat commit 981e1d7

Compare with similar skills

Defillama API next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Defillama API compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Defillama API this skillagiprolabs/claude-trading-skills410—~1.9kAutomated safety check: PassMIT
Swapper Depositswapperfinance/swapper-toolkit852—~1.8kAutomated safety check: PassMIT
Solana Skillnpc-live/clawfirm156—~1kAutomated safety check: PassNone
Bridge Stablecoincirclefin/skills155—~3.4kAutomated safety check: NotesApache-2.0
Metaplexelophanto/EloPhanto106—~1.6kAutomated safety check: PassApache-2.0
Trading Signalbinance/binance-skills-hub1.1k—~682Automated safety check: PassNone

Similar skills

  • Swapper Deposit

    swapperfinance/swapper-toolkit

    Deposit and bridge funds into a wallet or protocol using Swapper Finance.

    852 GitHub stars~1.8k tokensUpdated 6 mo ago
    Business, Finance & HRAuto-check passed
  • Solana Skill

    npc-live/clawfirm

    Interact with Solana blockchain via Helius APIs. An agent skill from npc-live/clawfirm.

    156 GitHub stars~1k tokensUpdated 3 mo ago
    Business, Finance & HRAuto-check passed
  • Bridge Stablecoin

    circlefin/skills

    Build browser or server USDC bridging with Circle App Kit or standalone Bridge Kit and CCTP.

    155 GitHub stars~3.4k tokensUpdated 22 days ago
    Business, Finance & HRAuto-check: notes
  • Metaplex

    elophanto/EloPhanto

    Metaplex development on Solana — NFTs, tokens, compressed NFTs, candy machines, token launches.

    106 GitHub stars~1.6k tokensUpdated 7 days ago
    Business, Finance & HRAuto-check passed
  • Trading Signal

    binance/binance-skills-hub

    Per-trade smart-money signals — each result is a discrete buy or sell event from a tracked smart-money wallet, with trigger price, current price, max gain since trigger, and exit rate.

    1.1k GitHub stars~682 tokensUpdated 27 days ago
    Business, Finance & HRAuto-check passed
  • Squads

    internet-court/internet-court-skill

    Complete guide for Squads Protocol - Solana's leading smart account and multisig infrastructure.

    6.4k GitHub starsUsed in 2 repos~5.9k tokens
    Business, Finance & HRAuto-check passed

More from agiprolabs/claude-trading-skills

All 68 skills in this repo
  • Backtrader

    agiprolabs/claude-trading-skills

    Event-driven backtesting with bar-by-bar execution, complex order types, multiple analyzers, and custom indicators

    410 GitHub stars~2.4k tokensUpdated 1 mo ago
    Auto-check passed
  • Birdeye API

    agiprolabs/claude-trading-skills

    Solana token market data via Birdeye — prices, OHLCV, trades, token metadata, security checks, and trader activity

    410 GitHub stars~1.8k tokensUpdated 1 mo ago
    Auto-check passed
  • Coingecko API

    agiprolabs/claude-trading-skills

    Broad crypto market data from CoinGecko covering 13,000+ tokens.

    410 GitHub stars~1.6k tokensUpdated 1 mo ago
    Auto-check passed
  • Cointegration Analysis

    agiprolabs/claude-trading-skills

    Cointegration testing for pairs trading using Engle-Granger, Johansen, and rolling stability analysis

    410 GitHub stars~2.1k tokensUpdated 1 mo ago
    Auto-check passed
  • Copy Trading

    agiprolabs/claude-trading-skills

    Wallet evaluation, monitoring, and copy-trade strategy design for Solana DEX trading

    410 GitHub stars~2.4k tokensUpdated 1 mo ago
    Auto-check passed
  • Correlation Analysis

    agiprolabs/claude-trading-skills

    Cross-asset correlation analysis including rolling correlation, hierarchical clustering, tail dependence, and regime-dependent correlation

    410 GitHub stars~2.4k tokensUpdated 1 mo ago
    Auto-check passed

Works with

Questions about Defillama API

What does Defillama API do?

Free DeFi analytics across all chains — TVL, token prices, DEX volumes, fees/revenue, stablecoins, and bridges. Defillama API is an agent skill from agiprolabs/claude-trading-skills.

When should I use Defillama API?

Defillama API fits situations like: tasks that involve Crypto and DeFi analysis.

How do I install Defillama API in Claude Code?

Run `npx skills add agiprolabs/claude-trading-skills --skill defillama-api -a claude-code`. Or copy the skill folder (skills/defillama-api in agiprolabs/claude-trading-skills) into .claude/skills/defillama-api in your project. Claude Code loads it when a task matches its description.

How do I install Defillama API in Codex?

Run `npx skills add agiprolabs/claude-trading-skills --skill defillama-api -a codex`. Or copy the skill folder (skills/defillama-api in agiprolabs/claude-trading-skills) into .agents/skills/defillama-api in your project. Codex loads it when a task matches its description.

Can I use Defillama API in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add agiprolabs/claude-trading-skills --skill defillama-api -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/defillama-api, .gemini/skills/defillama-api, .github/skills/defillama-api and .opencode/skills/defillama-api in your project.

What does Defillama API need to run?

Going by SKILL.md and its folder, Defillama API needs Python for the scripts in its folder. Our summary lists: Python 3.

Does Defillama API access the network?

SKILL.md names 6 domains. In commands or code: api.llama.fi, stablecoins.llama.fi, coins.llama.fi, bridges.llama.fi, yields.llama.fi and pro-api.llama.fi; the agent is likely to contact these when it follows the instructions. This is read from the text; nothing was executed.

Is Defillama API safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Defillama API use?

Defillama API is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Defillama API use?

About 1.9k tokens (SKILL.md is roughly 7.8k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 2.8k tokens, read only when the agent opens those files.

What are the alternatives to Defillama API?

Skills that share tags, products or a category with Defillama API: Swapper Deposit (swapperfinance/swapper-toolkit, 852 stars), Solana Skill (npc-live/clawfirm, 156 stars), Bridge Stablecoin (circlefin/skills, 155 stars) and Metaplex (elophanto/EloPhanto, 106 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Defillama API?

agiprolabs (a GitHub user) maintains it in agiprolabs/claude-trading-skills, which has 410 GitHub stars. The repository holds 68 skills in this directory. The repository was last updated on September 3, 2026.

Source: agiprolabs/claude-trading-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.