videogen
智能体用来查找托管视频模型、查看其输入参数、运行模型、跟进运行状态并下载结果的命令。
videogen 按 endpoint id 运行托管的生成模型,大多是视频模型。它可以搜索模型目录、把模型的输入显示为参数、运行模型并等待(或立即返回,稍后再查看)、上传输入文件,并保存结果中的每个媒体文件。
在哪里运行
云端团队和 Mac 团队的智能体都能使用同一个命令。登录凭据和智能体归属信息都来自智能体的运行环境,无需任何设置。它依赖 curl 和 jq。下载和上传直接连接模型托管方的文件存储,所以必须能访问到它;videogen doctor 会检查这一点。参见选择智能体的运行位置。
用法概要
videogen <command> [args] [--json] [--quiet]
videogen --help | --version
videogen run <endpoint_id> --help| Command | 作用 |
|---|---|
models [query] |
搜索模型目录。 |
schema <endpoint_id> |
模型的输入和输出。 |
run <endpoint_id> [--<param> <value> …] |
运行模型。等待完成,或用 --async 立即返回。 |
status <endpoint_id> <request_id> |
运行状态;--result 获取结果,--cancel 取消运行。 |
upload <file or url> |
把输入文件放到模型能读取的位置,并输出其地址。 |
pricing <endpoint_id> |
模型的标价和计费单位。 |
docs ["<query>"] |
搜索模型文档;不带查询时输出内置指南。 |
history [--limit n] |
你最近的运行,最新的在前。 |
balance |
本周期的 AI 用量与方案 AI 额度的对比。 |
doctor |
检查运行环境、登录状态和连通性。 |
模型始终用完整的 endpoint id 指定,即 owner/app/…:videogen models 列出的 id。没有简称。
所有命令通用的选项
| Option | 含义 |
|---|---|
--json |
在 stdout 上输出结构化 JSON。stdout 是管道时默认如此。 |
--quiet |
减少 stderr 上的输出。 |
models
videogen models [query] [--category c] [--status active|deprecated|all]
[--limit n] [--cursor t] [--endpoint_id id[,id]] [--expand x] [--no-classify]| Flag | 取值 | 默认值 | 含义 |
|---|---|---|---|
query |
自由文本,加引号 | 无 | 例如 "text to video"。只能有一个查询。 |
--category |
text-to-video、image-to-video、video-to-video、text-to-image、text-to-speech、text-to-audio、text-to-3d…… |
根据查询推测 | 把搜索限定在一个类别。 |
--no-classify |
— | 默认推测 | 不根据查询推测类别。 |
--status |
active、deprecated、all |
active |
包含哪些模型。 |
--limit |
正数 | 20 |
结果数量。 |
--cursor |
上一页的 next_cursor |
— | 下一页。 |
--endpoint_id(也可写 --endpoint-id) |
一个 id,或多个用逗号分隔;可重复 | — | 获取这些模型。 |
--expand |
openapi-3.0、enterprise_status |
— | 为每个模型附加这些数据。 |
在终端中:先输出 <n> model(s) · <category> · more: --cursor <t>,然后是每个模型的 endpoint id、名称和缩短的描述。JSON 格式:query、category、inferred_category、status、count、has_more、next_cursor 和 models(每项包含 endpoint_id、name、category、status、description,已知时还有标签和链接)。
schema
videogen schema <endpoint_id> [--format compact|openapi]compact(默认)把模型的输入显示为 run 接受的参数,每个都带类型、(required)、允许的取值和默认值,然后是输出。JSON 格式:endpoint_id、name、category、input 和 output,后两者都是 {name, type, required, description, default, enum} 的列表。--format openapi 输出模型完整的 OpenAPI 文档。videogen run <endpoint_id> --help 的输出与 schema 相同。
run
videogen run <endpoint_id> [--<param> <value> …] [--async] [--logs] [--download [template]] [--max-wait <seconds>]每个模型输入都是一对 --<param> <value>,名称与 schema 中完全一致(snake_case),例如 --prompt "…" --duration 5。也可以写 --param=value。不带值的参数为 true。取值有类型:true/false、数字和 JSON 会转成相应类型,其他都是字符串。如果 schema 规定某个输入是字符串,取值就保留你输入的字符串(所以 --duration 5 对需要 "5" 的模型发送 "5",对需要数字的模型发送 5)。
| Flag | 默认值 | 含义 |
|---|---|---|
--async |
关闭 | 提交后立即返回 request_id。 |
--logs |
关闭 | 运行期间把模型的日志行输出到 stderr。 |
--download [template] |
关闭 | 保存结果中的每个媒体文件。见下文。 |
--max-wait <seconds> |
1800 |
等待这么久后停止等待。运行会继续;之后用 videogen status 接着查看。 |
等待期间,stderr 依次显示 Submitting run、Queued request <id>,然后是 Waiting in queue (position n)、Model is running、Completed。
请求体最大 40 MB。大文件请用 videogen upload 上传,再把地址传给模型。
下载
--download 按顺序保存结果中的每个文件地址:
| Template | 文件保存到 |
|---|---|
| 无 | $TMPDIR(或 /tmp),使用源文件名 |
文件夹,或以 / 结尾的路径 |
该文件夹,使用源文件名 |
包含 {index}、{name}、{ext} 或 {request_id} 的路径 |
填入占位符后的路径,例如 out/hero-{index}.{ext} |
| 其他路径 | 就是这个路径 |
缺少的文件夹会自动创建。名称已被占用时,会在扩展名前加上 _1、_2……,所以不会覆盖任何文件。只要有一个下载失败,命令会在输出已保存的内容后以 6 退出。
run 的输出
使用 --async 时:
submitted <request_id>
Check status: videogen status <endpoint_id> <request_id>JSON 格式:{"status":"submitted","request_id":…,"endpoint_id":…,"hint":…}。
运行完成时:
✓ completed <endpoint_id> <request_id>
cost: $<n>
/abs/path/to/file.mp4 (<bytes> bytes)不使用 --download 时,列出的是结果中的文件地址而不是路径。JSON 格式:status(completed)、endpoint_id、request_id、result(模型自身的输出)、downloaded_files(每项为 {url, path, size_bytes, json_path})、download_failures、logs,已知时还有 cost_usd。
status
videogen status <endpoint_id> <request_id> [--result] [--logs] [--cancel] [--download [template]]| Flag | 含义 |
|---|---|
| 无 | 输出状态:IN_QUEUE(附排队位置)、IN_PROGRESS 或 COMPLETED,以及最后五行日志。 |
--logs |
输出全部日志行,而不只是最后五行。 |
--result |
获取已完成的结果,输出格式与 run 相同。 |
--download [template] |
与 run 相同;隐含 --result。 |
--cancel |
取消排队中的运行,并输出 cancelled <request_id>。不能与 --download 同时使用。 |
如果弄丢了 request_id,可以用 videogen history 列出你的运行。
upload
videogen upload <file or url>上传本地文件或网址内容的副本,返回可作为模型输入传入的地址(image_url、start_image_url、video_url……)。在终端中只输出地址;JSON 格式(管道输出时也是)为 {"cdn_url":…,"hint":…}。内容类型由文件扩展名决定(图片、视频、音频、3D 文件、JSON、文本、PDF、ZIP)。
pricing
videogen pricing <endpoint_id>以 <endpoint_id>: $<price> per <unit> 的形式输出模型每个计费单位(秒、视频、百万像素……)的标价。没有公布价格的模型输出 no published price (the model cannot be run here)。管道输出时,输出服务返回的 JSON,其中有 prices 列表。
history
videogen history [--limit n]你最近的运行,最新的在前(默认 20 条):日期、状态、endpoint id、request id,以及结算后的费用。没有运行时输出 no runs yet。JSON 格式:{"runs":[{request_id, endpoint_id, status, created_at, cost_usd}]}。
balance
显示本周期的 AI 用量与方案 AI 额度的对比,该额度与智能体聊天共用。在终端中:
AI usage: <percent>% of this period's plan allowance (<n> credits beyond the plan)
credits left: <n> (<n> credits owed)方案不含 AI 额度时,第一行为 AI usage: the plan includes no AI allowance, paid with credits。额度和积分都用完时,会追加 ! AI allowance and credits exhausted — ask your user to add credits or upgrade the plan。管道输出时,输出包含 used_usd、included_usd、overage_usd、credit_balance_usd、used_percent、overage_credits、credits_left、credits_owed、has_capacity 和 period_end 的 JSON。方案详见 air.build/pricing;团队的用量在设置 › 方案与用量中。
docs 和 doctor
videogen docs "<query>" 在线搜索模型文档、指南和 API 参考,输出每条结果的标题、地址和摘录。不带查询时输出内置指南;--topic 输出某一篇内置文档:models、prompting、cinematography、storytelling、commands 或 common-errors。
videogen doctor 逐项检查,每项一行,标记为 ✓、✗ 或 !:curl、jq、后端地址、团队登录、智能体身份、视频服务、媒体文件存储(无法访问时显示 unreachable; --download and upload will fail)、内置文档,以及终端是否为交互式。管道输出时输出 {"ok":…,"checks":[…]}。关键检查失败时以 1 退出。
错误和退出码
stdout 只承载结果。错误输出到 stderr:Error: <message>,有详情时会跟在后面。JSON 模式下,错误以 {"error":"…","details":{…}} 输出到 stderr,其中 details 可能包含 status、error_type(ValidationError 或 ApiError)、validation_errors(每项为 {field, message})、服务返回的 body、endpoint_id、request_id、logs 和 hint。
| Exit code | 含义 | 处理方法 |
|---|---|---|
0 |
成功。 | — |
1 |
意外错误,或 doctor 检查未通过。 |
运行 videogen doctor。 |
2 |
用法或参数无效,包括模型拒绝的输入。 | 阅读 Validation error — <field>: <message> 并修正该输入;videogen schema 会列出所有输入。 |
3 |
登录失败,或不在 AirBuild 智能体的运行环境中。 | 由智能体来运行。 |
4 |
AI 额度和积分已用完。 | 请团队拥有者充值积分或更换方案。 |
5 |
被内容政策拒绝。 | 修改提示词或输入。 |
6 |
运行失败,或下载失败。 | 阅读消息;重试或修改输入。 |
7 |
网络或服务错误,或运行结束前等待已到时。 | 稍后用 videogen status 查看。 |
8 |
找不到:模型、运行、文件或文档。 | 检查 id。 |
9 |
服务繁忙。 | 稍等后重试。 |
| Message | Exit |
|---|---|
"<id>" is not an endpoint id (owner/app/…, e.g. …); find one with videogen models. |
2 |
Run requires an endpoint ID |
2 |
run takes one endpoint id; model inputs are --<param> <value> pairs. |
2 |
status takes <endpoint_id> <request_id> (videogen history lists your runs). |
2 |
the request body is larger than 40 MB; upload files with videogen upload and pass the URL. |
2 |
--download cannot be combined with --cancel |
2 |
Model not found: <endpoint_id> |
8 |
the run <request_id> is no longer known to the model host. |
8 |
File not found: <path> / Failed to fetch <url>: … |
8 |
the run is still going after <n>s; it continues on the host. |
7 |
the run is still going; there is no result yet. |
7 |
could not reach the Airbuild creative service: … |
7 |
短暂的网络故障和繁忙应答会自动重试几次,之后 videogen 才会放弃。
示例
# Find an image-to-video model and read its inputs
videogen models "image to video"
videogen schema IMAGE_TO_VIDEO_ID # an id that videogen models lists
# Upload a still, animate it and save the video
# (piped output is JSON, so take cdn_url from it)
url=$(videogen upload ./App/Resources/hero.png | jq -r .cdn_url)
videogen run IMAGE_TO_VIDEO_ID \
--prompt "slow push-in, steam rising" --start_image_url "$url" --duration 5 \
--download "$TMPDIR/hero.{ext}"
# Submit without waiting, then collect the result later
videogen run TEXT_TO_VIDEO_ID --prompt "a paper boat on a pond" --async
videogen status TEXT_TO_VIDEO_ID <request_id> --download ./out/
# Check the list price before a run
videogen pricing TEXT_TO_VIDEO_ID