tufty.aitufty.ai CLI
CLI

异步与状态查询

提交后立即返回,稍后用 tufty status 取结果。

默认:等到完成

工具命令提交任务后默认一直等待:每 3 秒查询一次,直到任务完成或失败,最长 --timeout 秒(默认 900)。

  • 提交后,runId 会立即打印在标准错误里。
  • 等待期间可以随时中断(Ctrl+C)。任务仍在服务端继续运行,之后用 tufty status <runId> --wait 接着等。
  • 轮询时偶尔连不上服务端(连续不超过 3 次)会自动重试,不会让整次等待作废。

--no-wait

tufty product-promo --still ./sweater.jpg --resolution 1080P --duration 10 --no-wait

提交后立即返回:

{
  "ok": true,
  "result": {
    "tool": "product-promo",
    "runId": "9b1d4c7e-2f3a-4d8b-a6e5-7c0f1e2d3b4a",
    "status": "running",
    "outputs": []
  }
}

tufty status

tufty status 9b1d4c7e-2f3a-4d8b-a6e5-7c0f1e2d3b4a
tufty status 9b1d4c7e-2f3a-4d8b-a6e5-7c0f1e2d3b4a --wait
tufty status 9b1d4c7e-2f3a-4d8b-a6e5-7c0f1e2d3b4a --wait --timeout 1800 --format url
参数说明
<runId>提交任务时返回的 id
--wait任务仍在运行时,轮询直到完成或失败
--timeout <seconds>最长等待秒数,默认 900
--format <mode>json(默认)或 url

不带 --wait 时只查询一次:进行中返回 status: "running" 和空的 outputs,已完成返回全部成品地址。

tufty status 不支持 --save。需要下载时,用 --format url 拿到地址自行下载,或者直接在工具命令上使用 --save 等待结果。

超时与失败

情况输出
--timeout 内没有完成code: "timeout"details.runId。任务不会被取消,稍后再运行 tufty status <runId> --wait
服务端生成失败code: "task_failed"details 中有 runIdtool 和服务端错误码 serverCode

--timeout 必须是正数,否则返回 usage_error(退出码 2)。

在脚本中组合

RUN_ID=$(tufty image-to-video --still ./corgi.png --no-wait | jq -r '.result.runId')
tufty status "$RUN_ID" --wait --format url

On this page