让 agent 学会用这个 CLI
把下面这段粘贴到 agent 的指令里,比如 AGENTS.md 或 CLAUDE.md。agent 读英文更稳定,所以这段保持英文:
## Generating media with vibetoken
Use the `vibetoken` CLI to generate images, video, 3D models, and speech.
- Always pass `--json -q`. Results are JSON on stdout; errors are JSON on stderr.
- Find a model with `vibetoken models list --modality <image|video|audio|3d> --json`,
then read its options with `vibetoken models schema <model> --json`.
- Pass model options as `-P field=value`. Preview a paid request with `--dry-run`.
- Generate a UUID and pass it as `--client-request-id` on every `create`. If the command
fails with exit code 9 (network) or 5 (rate limited), rerun it with the same id; it is
never charged twice.
- For video and 3D, use `--no-wait`, then `vibetoken <kind> wait <id> --json -q`.
Exit code 8 means the task is still running: run `wait` again.
- Add `--dir <path>` to download results; the JSON then lists local paths in `downloaded`.
- Run `vibetoken commands --json` for every command and flag.
完整的英文文档也合并成了一个文件:https://vt-cli.lutaonan.com/llms.txt。
输出
| 输出流 | 不加 --json |
加 --json |
|---|---|---|
| stdout | 文本结果 | 一个 JSON 值 |
| stderr | 进度和错误 | 进度和 {"error": {...}} |
加 -q 隐藏进度。设置 VIBETOKEN_OUTPUT=json 可以默认输出 JSON。
一个已完成的生成(加了 --dir):
{
"id": "88f86396-34fa-4641-9b25-3905f452ec1a",
"object": "image.generation",
"status": "success",
"model": "bytedance/seedream-5.0-flash",
"data": [{ "url": "https://…/0.jpg", "output_format": "jpeg", "size": "1024x1024" }],
"usage": { "cost": 0.084 },
"downloaded": ["out/88f86396-34fa-4641-9b25-3905f452ec1a-0.jpg"]
}
status 是 pending、success 或 failed。只有保存了文件时才有 downloaded。
一个错误:
{"error": {"exit_code": 4, "status": 404, "message": "HTTP 404: Generation not found (request_id …)", "request_id": "…"}}
错误来自 API 时才有 status 和 request_id。
退出码
| 退出码 | 含义 | 怎么处理 |
|---|---|---|
| 0 | 成功 | |
| 1 | 其他错误 | 看错误信息 |
| 2 | 参数错误 | 修正命令;用 models schema 核对 |
| 3 | 缺少 API key 或 key 无效 | 见认证 |
| 4 | 未找到 | 检查 id 或模型 |
| 5 | 请求过于频繁 | 稍等,用同一个 --client-request-id 重试 |
| 6 | 余额或额度不足 | 充值,重试没用 |
| 7 | 生成失败 | 不扣费;修改提示词或参数 |
| 8 | 等待超时 | 任务仍在运行,执行 wait <id> |
| 9 | 网络错误 | 用同一个 --client-request-id 重试 |
| 130 | 被中断 | 任务仍在运行,执行 wait <id> |
重试不会重复扣费
每次 create 和 audio speech 都会带一个幂等 key。用同一个 key 重试会返回原来的任务,而不是新建一个,所以不会重复扣费。
自己生成这个 key,这样即使拿到任务 id 之前连接就断了,key 也还在你手里:
key=$(uuidgen)
vibetoken video create -m bytedance/seedance-2-t2v "a cat" --client-request-id "$key" --no-wait --json -q
之后找回任务:
vibetoken video find "$key" --json
如果 find 以退出码 4 结束,说明请求根本没到达,用同一个 key 重新 create 即可。
发现命令
vibetoken commands --json # 所有命令、选项和示例
vibetoken models schema <model> --json # 模型支持的参数
vibetoken <command> --help # 单个命令的文本帮助
没有专门命令的接口,可以用 vibetoken api <path> 发送带认证的请求并输出响应。