DefiLlama Public API Skill
Use this skill to run DefiLlama public API operations through uxc + OpenAPI.
Reuse the uxc skill for shared execution, auth, and error-handling guidance.
Prerequisites
- -
uxc is installed and available in PATH. - Network access to
https://api.llama.fi. - Access to the curated OpenAPI schema URL:
- INLINECODE5
Scope
This skill covers a public read-only analytics surface on api.llama.fi:
- - protocol TVL list
- per-protocol detail
- chain overview reads
This skill does not cover:
- - write operations or account management
- DefiLlama Pro key-in-path auth
- split-host public services such as
coins.llama.fi and INLINECODE8 - the full DefiLlama public API surface
Authentication
This public skill does not require authentication.
Core Workflow
- 1. Use the fixed link command by default:
-
command -v defillama-openapi-cli
- If missing, create it:
uxc link defillama-openapi-cli https://api.llama.fi --schema-url https://raw.githubusercontent.com/holon-run/uxc/main/skills/defillama-openapi-skill/references/defillama-public.openapi.json
- INLINECODE11
- 2. Inspect operation schema first:
-
defillama-openapi-cli get:/protocols -h
-
defillama-openapi-cli get:/protocol/{protocol} -h
- INLINECODE14
- 3. Prefer narrow read validation before broader reads:
-
defillama-openapi-cli get:/v2/chains
-
defillama-openapi-cli get:/protocols
- INLINECODE17
- 4. Execute with key/value parameters:
-
defillama-openapi-cli get:/protocol/{protocol} protocol=aave
- INLINECODE19
Operations
- - INLINECODE20
- INLINECODE21
- INLINECODE22
Guardrails
- - Keep automation on the JSON output envelope; do not use
--text. - Parse stable fields first:
ok, kind, protocol, data, error. - Treat this v1 skill as read-only. Do not imply wallet, trading, or admin support.
- Public DefiLlama data is split across multiple hosts. This skill intentionally stays on
api.llama.fi; use the separate Pro skill when you need the unified Pro host. - INLINECODE30 is equivalent to
uxc https://api.llama.fi --schema-url <defillama_openapi_schema> <operation> ....
References
- - Usage patterns: INLINECODE32
- Curated OpenAPI schema: INLINECODE33
- DefiLlama API docs: https://defillama.com/docs/api
技能名称: defillama-openapi-skill
详细描述:
DefiLlama 公共 API 技能
使用此技能通过 uxc + OpenAPI 运行 DefiLlama 公共 API 操作。
复用 uxc 技能以获取共享的执行、认证和错误处理指导。
前提条件
- - uxc 已安装并可在 PATH 中使用。
- 可访问 https://api.llama.fi 的网络。
- 可访问精选的 OpenAPI 模式 URL:
- https://raw.githubusercontent.com/holon-run/uxc/main/skills/defillama-openapi-skill/references/defillama-public.openapi.json
范围
此技能涵盖 api.llama.fi 上的公共只读分析功能:
- - 协议 TVL 列表
- 每个协议的详细信息
- 链概览读取
此技能不涵盖:
- - 写入操作或账户管理
- DefiLlama Pro 密钥路径认证
- 分离主机的公共服务,如 coins.llama.fi 和 yields.llama.fi
- 完整的 DefiLlama 公共 API 功能
认证
此公共技能不需要认证。
核心工作流程
- 1. 默认使用固定链接命令:
- command -v defillama-openapi-cli
- 如果缺失,则创建它:
uxc link defillama-openapi-cli https://api.llama.fi --schema-url https://raw.githubusercontent.com/holon-run/uxc/main/skills/defillama-openapi-skill/references/defillama-public.openapi.json
- defillama-openapi-cli -h
- 2. 首先检查操作模式:
- defillama-openapi-cli get:/protocols -h
- defillama-openapi-cli get:/protocol/{protocol} -h
- defillama-openapi-cli get:/v2/chains -h
- 3. 在更广泛的读取之前,优先进行窄范围读取验证:
- defillama-openapi-cli get:/v2/chains
- defillama-openapi-cli get:/protocols
- defillama-openapi-cli get:/protocol/{protocol} protocol=aave
- 4. 使用键/值参数执行:
- defillama-openapi-cli get:/protocol/{protocol} protocol=aave
- defillama-openapi-cli get:/v2/chains
操作
- - get:/protocols
- get:/protocol/{protocol}
- get:/v2/chains
防护措施
- - 保持自动化在 JSON 输出信封上;不要使用 --text。
- 首先解析稳定字段:ok、kind、protocol、data、error。
- 将此 v1 技能视为只读。不要暗示支持钱包、交易或管理员功能。
- 公共 DefiLlama 数据分布在多个主机上。此技能有意停留在 api.llama.fi 上;当需要统一的 Pro 主机时,请使用单独的 Pro 技能。
- defillama-openapi-cli <操作> ... 等同于 uxc https://api.llama.fi --schema-url openapischema> <操作> ...。
参考
- - 使用模式:references/usage-patterns.md
- 精选的 OpenAPI 模式:references/defillama-public.openapi.json
- DefiLlama API 文档:https://defillama.com/docs/api