CLI 参考
pikeway runs get
获取单个运行:状态、上游 HTTP 码、费用、耗时,后台运行还包括结果。
用法
bash
pikeway runs get -r <run-id> [-o <file>] [--json] pikeway runs get <run-id>
说明
读取 GET /v1/runs/<id>。两种 run id 都支持:后台运行(run_…,来自 pikeway run --async)和同步调用(pikeway run 打印的 UUID)。
后台运行会保留结果,--async 运行的结果就是这样取回的。同步调用只在 pikeway run 的响应里返回一次结果;这里只能看到状态和费用,并提示结果未保留。
与 pikeway run 不同,只要找到了该运行,无论其状态如何,本命令都以 0 退出。需要据此判断时,请检查 JSON 中的 status。需要 key。
参数
--run, -rstring必填Run id。也可以直接写在 get 后面。
--output, -opath把运行结果写入该文件,而不是打印出来。只有运行有结果时才会写入。
示例
bash
# check on a background run pikeway runs get -r run_5f0c2b7e9a4d4e1b8c3a6f2d1e0b9a87 # positional id pikeway runs get run_5f0c2b7e9a4d4e1b8c3a6f2d1e0b9a87 # save the finished output pikeway runs get -r run_5f0c2b7e9a4d4e1b8c3a6f2d1e0b9a87 -o report.json # poll from a script until it's done while [ "$(pikeway runs get -r "$RUN" --json | jq -r .status)" = RUNNING ]; do sleep 5; done
输出
后台运行
COMPLETED birdeye GET /defi/price
HTTP 200 · cost $0.001 · 640ms · 2026-10-24T09:20:00Z
{
"success": true,
"data": { "value": 172.41 }
}同步调用
COMPLETED birdeye GET /defi/price HTTP 200 · cost $0.001 · 214ms · 2026-10-24T09:12:03Z (output not retained — runs return their output synchronously; use -o with `pikeway run` to save it)
仍在进行的运行显示 RUNNING 以及 HTTP — / —ms。失败或被停止的运行会在第二行末尾附上错误,如 · stopped by user。使用 -o 时结果写入文件,不再打印。
--json
json
{
"runId": "run_5f0c2b7e9a4d4e1b8c3a6f2d1e0b9a87",
"async": true,
"provider": "birdeye",
"method": "GET",
"endpoint": "/defi/price",
"status": "COMPLETED",
"input": { "address": "So11111111111111111111111111111111111111112" },
"providerResponse": { "httpStatus": 200 },
"output": { "success": true, "data": { "value": 172.41 } },
"cost": { "value": 0.001, "currency": "USD" },
"timeoutSeconds": 120,
"createdAt": "2026-10-24T09:20:00Z",
"startedAt": "2026-10-24T09:20:00Z",
"finishedAt": "2026-10-24T09:20:01Z",
"durationMs": 640,
"pollUrl": "https://gw.pikeway.ai/v1/runs/run_5f0c2b7e9a4d4e1b8c3a6f2d1e0b9a87"
}同步调用没有 output,取而代之的是 outputRetained: false,路径在 path 字段中。
错误与退出码
| 退出码 | 错误信息 | 触发条件 |
|---|---|---|
| 2 | usage: pikeway runs get -r <run-id> | 既没有 -r,也没有位置参数形式的 id。 |
| 1 | run not found | 你的账户下没有该 id 的运行。 |
| 3 | no API key: run `pikeway keys add --label main --key pk-...`, set PIKEWAY_API_KEY, or pass --key | 没有 --key、没有 PIKEWAY_API_KEY,也没有已保存的当前 key。在发出请求之前就会检查。 |
| 3 | invalid or revoked API key — add a key with `pikeway keys add --label main --key pk-...` (or use --x402) | 网关返回 401(key 不存在、已吊销或已过期)。403 同样以 3 退出。 |
| 1 | cannot reach <gateway>: ECONNREFUSED | 无法连接网关(DNS、网络,或 PIKEWAY_API_BASE_URL 写错)。冒号后的错误码来自 Node。 |
不想自己写轮询循环的话,启动时用 pikeway run --wait 代替
--async。