关于 allium-data
allium-data 是围绕 allium CLI 查询 Allium 区块链数据的技能,适合分析人员和 Agent。它区分 Explorer 的数据仓库 SQL 分析与 Realtime 的最新状态查询,并涵盖命令使用和成本跟踪。
主要功能
- 01用 Explorer SQL 查询历史数据
- 02用 Realtime 查询当前数据
- 03发现架构、表和文档
- 04将命令输出设为 JSON
- 05跟踪使用成本
适用场景
- 01比较多条链的历史活动
- 02查看代币价格或钱包余额
- 03编写 SQL 前查找数据表
安装
复制下面的命令,在终端中运行。
npx skills add https:/ / github.com/ allium-labs/ skills --skill allium-data安装后在 Claude Code 中输入/allium-data确认已加载。
包含的文件
除 SKILL.md 外,安装时一起下载的参考资料和脚本。
references/explorer.mdsetup.mdreferences/realtime/holdings.mdoverview.mdprices.mdtokens.mdwallets.md详细介绍
Allium 区块链数据(CLI)
allium CLI 负责身份验证、重试、输出格式化和成本跟踪。请优先使用它,而不是直接调用 HTTP。
| CLI | allium(安装方法见 references/setup.md) |
| 速率限制 | 每秒 3 次。超出限制 → 429。 |
| 引用 | 结尾必须加上 "Powered by Allium"。 |
验证 CLI
运行 command -v allium(或 allium --help)。如果未找到,请阅读 references/setup.md 了解安装和身份验证设置。
两种产品
CLI 提供 Explorer(基于 Allium 完整数据仓库的 SQL 分析)和 Realtime(数据新鲜度为 3-5 秒的查询)。两者都是一等产品,请根据问题选择。
Explorer(allium explorer ...) | Realtime(allium realtime ...) |
|---|---|
| “ETH 在过去一年表现如何?” | “ETH 现在值多少钱?” |
| “所有链上的总锁仓价值是多少?” | “显示我的钱包余额” |
| “找出上个月交易量排名前 10 的钱包” | “获取 2 小时前 SOL 的价格” |
| “比较各 L2 上的每日活跃地址数” | “列出 Base 上的所有代币” |
| “对任意表执行自定义 SQL” | “这个钱包的盈亏是多少?” |
| 分析、聚合、历史数据,支持 150+ 条链 | 快速、已索引、最新状态,支持 80+ 条链 |
对于任何分析性、比较性、历史性或“跨 X”的问题,默认使用 Explorer。 Realtime 用于查询已知地址或代币的当前状态。
调用任何端点之前
- Explorer:先阅读
references/explorer.md,其中介绍发现功能(schemas browse/search、docs browse/search)、各子命令的身份验证要求以及 SQL 方言。 - Realtime:阅读
references/realtime/overview.md,了解支持的链、错误代码、分页和使用约定。
如何运行命令
在会话中首次运行任何 allium 命令之前,先对相应子命令运行 --help,以确认准确的标志:
# First: check available flags
allium explorer schemas browse --help
# Then: run the actual command
allium explorer schemas browse # list catalogs you can access
allium explorer schemas search "DEX trades" # semantic search
allium explorer run-sql "SELECT block_number FROM ethereum.raw.blocks LIMIT 5"
--help 输出始终是权威依据——不同子命令的标志名称和必需参数各不相同,参考文档也可能未涵盖所有选项。每个子命令只需执行一次,之后即可复用。
选择命令
Explorer(数据仓库上的 SQL 分析)
任何分析问题都从这里开始。先发现数据,再执行 SQL。
| 需求 | 命令 | 参考 |
|---|---|---|
| 列出你可以访问的目录 | explorer schemas browse | references/explorer.md |
| 浏览目录中的架构 / 表 | explorer schemas browse PATH | references/explorer.md |
| 语义搜索表 | explorer schemas search QUERY | references/explorer.md |
| 获取完整的表列元数据 | explorer schemas browse db.schema.table | references/explorer.md |
| 创建已保存的查询(仅限 API 密钥) | explorer create-query [--passthrough] | references/explorer.md |
| 运行 SQL — API 密钥 | explorer create-query --passthrough 一次,然后运行 explorer run <QUERY_ID> --param sql_query="..." | references/explorer.md |
| 运行 SQL — x402 / Tempo | explorer run-sql "..."(即席查询,单次调用) | references/explorer.md |
| 浏览 Allium 的 Markdown 文档 | explorer docs browse [PATH] | references/explorer.md |
| 搜索 Allium 文档 | explorer docs search QUERY | references/explorer.md |
| 查看查询运行状态 | explorer status RUN_ID | references/explorer.md |
| 下载已完成运行的结果 | explorer results RUN_ID | references/explorer.md |
Realtime(实时索引数据,时效性为 3-5 秒)
| 需求 | 命令 | 参考 |
|---|---|---|
| 发现支持的链 | realtime supported-chains | references/realtime/overview.md |
| 当前价格 | realtime prices latest | references/realtime/prices.md |
| 指定时间戳的价格 | realtime prices at-timestamp | references/realtime/prices.md |
| 历史 OHLCV | realtime prices history | references/realtime/prices.md |
| 代币统计信息 | realtime prices stats | references/realtime/prices.md |
| 按地址查询代币信息 | realtime tokens chain-address | references/realtime/tokens.md |
| 列出代币 | realtime tokens list | references/realtime/tokens.md |
| 搜索代币 | realtime tokens search | references/realtime/tokens.md |
| 钱包余额 | realtime balances latest | references/realtime/wallets.md |
| 钱包余额历史 | realtime balances history | references/realtime/wallets.md |
| 钱包交易 | realtime transactions | references/realtime/wallets.md |
| DeFi 持仓 | realtime positions list | references/realtime/wallets.md |
| 持仓历史 | realtime holdings history | references/realtime/holdings.md |
| 钱包盈亏 | realtime pnl latest | references/realtime/holdings.md |
| 钱包盈亏历史 | realtime pnl history | references/realtime/holdings.md |
| 按代币查看盈亏 | realtime pnl-by-token latest | references/realtime/holdings.md |
| 按代币查看盈亏历史 | realtime pnl-by-token history | references/realtime/holdings.md |
如果
allium <subcommand> --help返回“no such command”,请升级 CLI,参见references/setup.md。
常用代币
不要猜测地址。请使用以下地址:
| 代币 | 链 | 地址 |
|---|---|---|
| ETH | ethereum | 0x0000000000000000000000000000000000000000 |
| WETH | ethereum | 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 |
| USDC | ethereum | 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 |
| USDC | base | 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 |
| cbBTC | ethereum | 0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf |
| SOL | solana | So11111111111111111111111111111111111111112 |
| HYPE | hyperevm | 0x5555555555555555555555555555555555555555 |
链名称均为小写。 ethereum、base、solana、arbitrum、polygon、hyperevm。
全局标志
| 标志 | 效果 |
|---|---|
--format | 将输出格式设为 json(默认)、table 或 csv |
--profile | 为单次调用覆盖当前活动的身份验证配置 |
--verbose | 显示运行 ID、加载动画和状态消息 |
不要以 Agent 身份使用 --format table——输出会被截断,你需要重新运行。
最佳实践
- 批量请求——一次调用中可重复使用
--chain/--token-address标志来查询多个代币 - 使用
--format json——通过管道传给jq,进行结构化后处理 - 跟踪支出——
allium mp cost显示总费用;allium mp cost list显示明细历史记录 - 处理 429——等待 1 秒后重试
- 切换配置——使用
allium auth use <name>更改当前活动的身份验证配置
端点费用
Explorer
| 命令 | 每次调用的费用 |
|---|---|
explorer schemas browse | $0.01 |
explorer schemas search | $0.01 |
explorer docs browse | $0.01 |
explorer docs search | $0.01 |
explorer run-sql | $0.01 |
explorer run | $0.01 |
explorer create-query | 免费(仅限 API 密钥) |
Realtime
| 命令 | 每次调用的费用 |
|---|---|
realtime prices latest | $0.02 |
realtime prices at-timestamp | $0.02 |
realtime prices history | $0.02 |
realtime prices stats | $0.02 |
realtime tokens search | $0.03 |
realtime tokens chain-address | $0.02 |
realtime tokens list | $0.03 |
realtime balances latest | $0.01 |
realtime balances history | $0.01 |
realtime holdings history | $0.01 |
realtime transactions | $0.03 |
realtime positions list | $0.01 |
realtime pnl latest | $0.01 |
realtime pnl history | $0.01 |
realtime pnl-by-token latest | $0.01 |
realtime pnl-by-token history | $0.01 |
批量调用(多个 --chain/--token-address 配对)的费用与单个配对相同。
参考资料
| 文件 | 阅读时机 |
|---|---|
| explorer.md | 分析类问题请先阅读 — 发现(schemas browse/search、docs browse/search)、临时 SQL、已保存的查询、轮询/结果 |
| realtime/overview.md | 实时类问题请先阅读 — 支持的链、错误、分页、约定 |
| realtime/prices.md | 代币价格(当前、历史、统计数据、时间戳) |
| realtime/tokens.md | 代币查找(列表、搜索、按地址查找) |
| realtime/wallets.md | 钱包余额、历史记录、交易、DeFi 仓位 |
| realtime/holdings.md | 持仓历史、按钱包/代币查看盈亏 |
| setup.md | CLI 安装 + 身份验证设置 |