videogen
Agent 用來尋找託管影片模型、查看其輸入、執行模型、追蹤執行進度並下載結果的指令。
videogen 依端點 id 執行託管的生成模型,以影片模型為主。它可以搜尋模型目錄、將模型的輸入顯示為旗標、執行模型並等待(或立即傳回,讓你稍後再查看)、上傳輸入檔案,並儲存結果中的所有媒體檔。
執行位置
雲端團隊與 Mac 團隊中的 Agent 都能使用同一個指令。登入與 Agent 歸屬資訊來自 Agent 的環境,因此無須任何設定。它需要 curl 與 jq。下載與上傳會直接連到模型主機的檔案儲存空間,因此必須能連線到該處;videogen doctor 會檢查這一點。請參閱選擇 Agent 的執行位置。
語法
videogen <command> [args] [--json] [--quiet]
videogen --help | --version
videogen run <endpoint_id> --help| 指令 | 作用 |
|---|---|
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 |
檢查環境、登入狀態與連線能力。 |
模型一律以完整的端點 id(owner/app/…)指定,也就是 videogen models 列出的 id。沒有簡稱。
所有指令通用的選項
| 選項 | 意義 |
|---|---|
--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]| 旗標 | 值 | 預設 | 意義 |
|---|---|---|---|
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,或以逗號分隔的多個 id;可重複 | — | 取得這些模型。 |
--expand |
openapi-3.0, enterprise_status |
— | 為每個模型加上該項資料。 |
在終端機中:先顯示 <n> model(s) · <category> · more: --cursor <t>,再列出每個模型的端點 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)。
| 旗標 | 預設 | 意義 |
|---|---|---|
--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 會依序儲存結果中的每個檔案網址:
| 範本 | 檔案存放位置 |
|---|---|
| 無 | $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]]| 旗標 | 意義 |
|---|---|
| 無 | 印出狀態: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 筆):日期、狀態、端點 id、請求 id,以及結算後的費用。沒有任何執行時顯示 no runs yet。JSON 格式為:{"runs":[{request_id, endpoint_id, status, created_at, cost_usd}]}。
balance
顯示本週期 AI 用量與方案 AI 額度(與 Agent 聊天共用)的對照。在終端機中:
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。導向管線時會印出 JSON,包含 used_usd、included_usd、overage_usd、credit_balance_usd、used_percent、overage_credits、credits_left、credits_owed、has_capacity 與 period_end。方案說明請見 air.build/pricing;團隊的用量請見設定 › 方案與用量。
docs 與 doctor
videogen docs "<query>" 會在線上搜尋模型文件、指南與 API 參考資料,並印出每筆結果的標題、網址與摘錄。未指定查詢時會印出內附的指南;--topic 會印出一份內附文件:models、prompting、cinematography、storytelling、commands 或 common-errors。
videogen doctor 會逐行檢查並標示 ✓、✗ 或 !:curl、jq、後端位址、團隊登入、Agent 身分、影片服務、媒體檔案儲存空間(無法連線時顯示 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。
| 結束代碼 | 意義 | 處理方式 |
|---|---|---|
0 |
成功。 | — |
1 |
非預期錯誤,或 doctor 檢查失敗。 |
執行 videogen doctor。 |
2 |
用法或參數無效,包括模型拒絕的輸入。 | 閱讀 Validation error — <field>: <message> 並修正該輸入;videogen schema 會列出所有輸入。 |
3 |
登入失敗,或不是在 AirBuild Agent 的環境中執行。 | 從 Agent 執行。 |
4 |
AI 額度與積分已用完。 | 請團隊擁有者加購積分或變更方案。 |
5 |
遭內容政策拒絕。 | 修改提示詞或輸入。 |
6 |
執行失敗,或下載失敗。 | 閱讀訊息;再試一次或修改輸入。 |
7 |
網路或服務錯誤,或執行尚未結束就停止等待。 | 稍後以 videogen status 查看。 |
8 |
找不到:模型、執行、檔案或文件。 | 檢查 id。 |
9 |
服務忙碌中。 | 稍候再試。 |
| 訊息 | 結束代碼 |
|---|---|
"<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