CLI 参考

pikeway discover

用自然语言搜索市场上的所有端点,返回带价格的排序结果。免费,无需 key。

用法

bash
pikeway discover -q "<what you need>" [--limit 5] [--category <name>] [--max-price <usd>] [--json]
pikeway discover <words...>

说明

把查询发送到 POST /v1/discover,每个匹配项输出一条:相关度分数、API slug、方法、端点路径和价格,下一行是端点说明。最后一行给出排名第一的结果对应的 pikeway inspect 命令。

中英文查询都可以。省略 -q 时,discover 后面的词会拼接为查询。始终不需要 key;如果已配置 key,会一并发送。

参数

--query, -qstring必填
你的需求,1–1000 个字符。省略 -q 时使用位置参数。
--limit, -linteger
最多返回条数。默认 5,网关上限为 40。
--categorystring
只返回该分类下 API 的端点,如 Crypto。
--max-pricenumber
只返回单次价格不超过该值(美元)的端点。

示例

bash
# basic search
pikeway discover -q "token price on solana"

# no -q: the remaining words become the query
pikeway discover holders of a token

# narrow it down
pikeway discover -q "token price on solana" --limit 10 --category Crypto --max-price 0.01

# Chinese works too
pikeway discover -q "股票实时行情"

# take the top hit's endpoint in a script
pikeway discover -q "weather forecast" -l 1 --json | jq -r '.results[0] | "\(.provider) \(.endpoint)"'

输出

text
0.87  birdeye GET /defi/price  $0.001/call
      Current price of a token by mint address
0.71  birdeye GET /defi/history_price  $0.002/call
      Historical price series of a token
0.58  coingecko GET /simple/price  $0.0005/call
      Price of one or more coins in any currency

next: pikeway inspect -p birdeye -e '/defi/price'
  • 分数(0–1)综合了相关度、可靠性、价格和热度,结果按分数排序。
  • 价格显示为 $X/call、free,按 token 计费的 AI 端点显示为 per token。
  • 没有匹配时输出 No endpoints matched "…". Try other words.(退出码 0)。

--json

完整的 /v1/discover 响应,每个结果都包含 scoreBreakdown、stats 和 hints:

json
{
  "results": [
    {
      "provider": "birdeye",
      "providerName": "Birdeye",
      "endpoint": "/defi/price",
      "method": "GET",
      "name": "Token price",
      "description": "Current price of a token by mint address",
      "category": "Crypto",
      "score": 0.874,
      "price": { "type": "PER_CALL", "amount": { "value": 0.001, "currency": "USD" } },
      "stats": { "successRate30d": 0.991, "p50Ms": 182 },
      "hints": { "inspect": "…", "run": "…", "docs": "…" }
    }
  ],
  "query": "token price on solana",
  "count": 1
}

错误与退出码

退出码错误信息触发条件
2usage: pikeway discover -q "what you need"既没有 -q,也没有位置参数。
1query is required (1-1000 characters)网关拒绝了查询,例如超过 1000 个字符。
1cannot reach <gateway>: ECONNREFUSED无法连接网关(DNS、网络,或 PIKEWAY_API_BASE_URL 写错)。冒号后的错误码来自 Node。
同样支持全局参数 -j, --json 和 -k, --key。见 全局参数 与 退出码。