> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fastino.ai/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Use https://docs.fastino.ai/llms.txt to discover and navigate pages. Use https://docs.fastino.ai/llms-full.txt when you need the complete documentation corpus. Use https://docs.fastino.ai/openapi.json as the source of truth for customer-facing routes. For GLiDE decision inference, call POST https://api.fastino.ai/v1/systemone with model fastino/GLiDE. Start managed training (config job) with POST /v1/training/jobs using base_model. For interactive training, native JSON clients use the public operations under /v1/training/jobs and /v1/training/usage. Existing Tinker clients use tinker==0.32.0 with TINKER_BASE_URL=https://api.fastino.ai/v1/training/compat/tinker and TINKER_CREDENTIAL_CMD. Compatibility child routes are private and absent from OpenAPI. Auto Train is private access and has no public route; direct interested users to sales@fastino.ai. Do not infer undocumented routes. Read API keys from FASTINO_API_KEY and never embed credentials in code, logs, or reports.

# 在 CI 中使用

> 在 CI 中使用 API 密钥、JSON 输出和退出码，用脚本执行运行。

在 CI 中、没有终端时或在编程智能体中运行时，CLI 从不提示输入。`--non-interactive` 可以在任何地方关闭提示。

请从 CI 的密钥存储中设置 `FASTINO_API_KEY`。没有已保存的登录时，CLI 会使用它。不要在命令行中传入密钥，因为 shell 历史记录和其他进程可以看到它。

下面的脚本会开始一次运行，批准它的计划，并等待结果。`PROJECT_ID` 保存一个来自 `fastino project list` 的项目 ID。`BUILD_ID` 保存 CI 的构建 ID，它在重试某个步骤时保持不变，例如 GitHub Actions 中的 `GITHUB_RUN_ID`。

```bash theme={null}
run=$(fastino run start --project "$PROJECT_ID" \
  --goal "Classify support tickets as billing, technical or account" \
  --dataset "support-tickets" \
  --benchmark "Macro F1 of 0.85 on held-out tickets" \
  --budget 25 \
  --idempotency-key "tickets-$BUILD_ID" \
  --json | jq -r '.run_id')

# Exits 3 when the run waits on you
fastino run wait "$run" || [ $? -eq 3 ]

# Approve only a plan that is waiting, so a retried step skips this
revision=$(fastino run status "$run" --json | jq -r '.plan.revision_hash // empty')
if [ -n "$revision" ]; then
  fastino run status "$run" --plan
  fastino run approve "$run" --revision "$revision" --ceiling 25
fi

# Exits 0 when the run meets its bar, 4 when it does not
fastino run wait "$run"
```

`--dataset`、`--benchmark` 和 `--budget` 会提前回答智能体的三个问题，因此运行首先等待的通常就是计划。有了 `--idempotency-key`，重试的步骤会拿回同一次运行，而不会开始第二次运行。脚本只在有计划等待时才批准，所以批准之后的重试会直接进入最后的 `run wait`。把同一个键用于另一次不同的启动会被拒绝。

`--revision` 只批准你读过的那个计划。低于计划估算的上限会被拒绝，除非你加上 `--acknowledge-underfunded`。需要支出上限的计划在没有 `--ceiling` 时会拒绝批准。运行因达到上限而暂停后，用 `fastino run raise-cap <run> <usd>` 提高上限即可继续。

如果你省略了 `--dataset`、`--benchmark` 或 `--budget`，智能体可能会先提出相应的问题。这时 `run wait` 同样会以 3 退出，`fastino run status <run>` 会显示这个问题。用 `fastino run answer <run> "<choice>"` 回答它，预算问题还要加上 `--amount <usd>`，然后再次等待。

## `--json` 输出什么

* stdout 只输出 JSON。加载动画、进度和提示信息都输出到 stderr，因此你可以把 stdout 通过管道传给 `jq`，或保存到文件中。
* 大多数命令只输出一个 JSON 文档。持续跟踪某个对象的命令，例如 `job watch` 和 `job logs --follow`，会随着进展每行输出一个 JSON 对象。
* 命令失败时，stdout 的最后是一个 `error` 对象。它包含 `code`、`message`、`retryable`、`userActionRequired`，以及可以尝试的 `next` 步骤。

## 退出码

| 代码 | 含义 |
| - | - |
| `0` | 完成 |
| `1` | 出错，或请求被拒绝 |
| `2` | 用法错误，例如缺少参数 |
| `3` | 等待人工处理，例如运行需要你回答问题或批准它的计划 |
| `4` | 运行已结束，但未达到成功标准 |

## 分页浏览训练任务

`fastino job list` 每页最多返回 200 个任务，最新的在前。`--limit` 设置每页数量（1 到 200），`--offset` 跳过任务。每页都包含 `count`、`total` 和 `has_more`，因此只要 `has_more` 为 `true`，就按每页数量增加 `--offset`：

```bash theme={null}
fastino job list --limit 50 --offset 50 --json | jq '{count, total, has_more}'
```

## 用 `--yes` 确认

`run cancel`、`team role`、`billing limit` 和 `buy credits` 会请你确认。在 CLI 无法提示的地方，例如 CI 中，除非你加上 `--yes`，否则它们会以退出码 `2` 停止。

## 购买额度

```bash theme={null}
fastino buy credits 50 --yes --attempt-id "credits-$BUILD_ID"
```

`--attempt-id` 让重试的步骤沿用同一次购买，因此银行卡绝不会被重复扣款。它最多包含 64 个字母、数字、`-` 或 `_`。`fastino buy credits <usd> --dry-run` 会显示扣款金额和银行卡，但不会购买。`--clear-pending` 会忘掉一次未确认的购买，让下一次购买重新开始。

如果团队没有保存的银行卡，或者银行要求确认付款，该命令会输出一个 Stripe Checkout 链接并以 3 退出。购买额度需要 `owner`、`admin` 或 `billing` 角色。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.