Agent 指令

Agent 用來將一句話、一張圖片或一個模型檔案轉成 3D 素材,並進一步貼圖、綁定骨架、製作動畫、轉檔與減面的指令。

modelgen 用來製作 3D 模型。給它提示詞、一或多張圖片、模型檔案或先前的任務,它就會建立模型、執行你串接在後面的處理步驟(貼圖、綁定骨架、動畫、轉檔、減面…),等待完成並下載檔案。每次生成或步驟都是 3D 服務上的一個任務;modelgen 不保留本機狀態,先前的任務可透過 id、短 id 或名稱再次找到。

執行位置

雲端團隊與 Mac 團隊中的 Agent 都能使用同一個指令。登入與 Agent 歸屬資訊來自 Agent 的環境,因此無須任何設定。它需要 curl 與 jq。請參閱選擇 Agent 的執行位置。

語法

modelgen <command> [options]
modelgen --help | --version
指令 作用
make <input...> 將任何輸入轉成完成的 3D 檔案,可選用情境預設與處理鏈。
generate <endpoint> <input...> 完全依指定內容執行一次生成。
model <step> [input] refine、texture、stylize、convert、import。
anim <step> [input] check(能否綁定骨架?)、rig、retarget。
mesh <step> [input] segment、complete、decimate、smartsegment。
task get, task list, task watch 讀取、列出與等待任務。
files upload <path> 上傳圖片或模型,並印出其檔案權杖。
history 你最近的任務。
redo [target] 以新的種子重新執行先前的任務。
balance 本週期 AI 用量與方案 AI 額度的對照。
docs 印出內附的參考文件。
doctor 檢查環境、登入狀態與連線能力。

全域選項

選項 意義
--json 在 stdout 輸出一行 JSON。stdout 被導向管線時預設開啟。
--quiet 不在 stderr 輸出進度。
--yes, --no-open 接受但忽略;不會有任何提示或開啟動作。
-h, --help 指令說明,例如 modelgen make --help。

任務選項

make、generate、model、anim、mesh 與 redo 接受下列選項:

選項 值 預設 意義
-o, --out 資料夾 $TMPDIR/modelgen-out/<name>-<id8>/ 檔案存放位置。檔案會放在其中的 modelgen-out/<name>-<id8>/。
--no-wait — 關閉 送出後立即傳回任務 id 與 "status":"queued"。
--no-download — 關閉 會等待,但不下載。
--timeout 秒數 1800 等待時間。超過後任務仍會繼續執行。
--name 文字 取自提示詞或檔名 用來以 @name 再次找到任務的名稱。
-p, --param key=value — 傳給服務的任何額外欄位,可重複。true、false、數字與 JSON 會自動判斷型別。
--notify — — 接受但忽略。

輸入

凡是接受輸入的地方,都可以是:

輸入 範例 意義
文字 "a red fox, stylized" 提示詞(用於 make 與文字端點)。
圖片檔 fox.png .png、.jpg、.jpeg、.webp、.bmp、.tiff、.tif,最大 20 MB。會先上傳。
模型檔 chair.glb .glb、.fbx、.obj、.stl,最大 150 MB。會先上傳。.gltf 無法單獨上傳(它會參照其他檔案);請匯出 .glb 或傳入網址。
網址 https://…/fox.png 原樣傳給服務。
檔案權杖 file_… 取自 modelgen files upload。
任務 id task_… 或 UUID 先前的任務。
短 id 3f9a2c 你某個任務 id 的前 6–35 個十六進位字元;必須只符合一個任務。
@last 你最新的成功任務。
@last:any 你最新的任務,不論狀態。
@2, @3, … 你最近 50 個任務中,第 2、第 3…新的成功任務。
@name @fox 具有該名稱的任務。若有多個同名任務,會使用最新的成功任務(並顯示警告)。

model、anim 或 mesh 沒有收到輸入時,會從管線傳入的 modelgen 指令讀取任務,否則使用 @last。

make

modelgen make [options] <input...>
選項 值 預設 意義
--for 情境,見下方 無 預設模型、生成設定與處理鏈。
--then 處理鏈,例如 "texture,rig,convert:fbx" 情境的處理鏈,或無 依序對結果執行的步驟。會取代情境的處理鏈。
--model 生成模型 id(id 列於 modelgen make --help) 服務的高精度模型 原樣傳入。
-n, --candidates 1–4 1 平行生成指定數量的候選結果,各自使用不同種子。僅適用於文字或圖片輸入,且不能與 --then 併用。
--seed 數字 隨機 幾何種子(model_seed)。

make 依輸入執行的動作:

你傳入 它會執行
文字 text-to-model
一張圖片或一個網址 image-to-model
2–4 張圖片或網址 multiview-to-model
一個模型檔 import
任務參照 只執行 --then 處理鏈(此時必須提供)

多視角時,檔名含 front、back、left 或 right 的檔案會用於該視角;其餘檔案依序填入剩下的位置,從正面開始。必須提供正面視角。

當提示詞提到低多邊形(例如 low-poly、lowpoly、low poly、voxel),或 -p face_limit= 為 20000 以下時,會自動選用服務的低多邊形模型。--model 永遠優先。

情境(--for)

情境 生成 後續處理鏈
game-mobile 低多邊形模型、PBR 貼圖(standard)、15000 面 convert:format=FBX;texture_size=2048
game-pc PBR 貼圖(detailed) convert:format=FBX
film PBR、四邊形網格、精細幾何與貼圖 無
print 無貼圖 convert:format=STL;flatten_bottom=true
ar-web PBR 貼圖 decimate:face_limit=20000,convert:format=USDZ
anim PBR 貼圖 rig-check、rig(GLB)、以 preset:idle 與 preset:walk 執行 retarget
toy 低多邊形模型、PBR 貼圖、20000 面 無

處理鏈(--then)

步驟以逗號分隔。步驟可接受單一值 step:value,或設定 step:key=value;key=value。[...] 或引號中的值會保持完整,因此 retarget:animations=["preset:idle","preset:walk"] 是一個步驟。

步驟 單一值設定的項目 接受
refine — 僅限成功的 text-to-model 任務
texture texture_quality 任何產生模型的任務
stylize style 任何模型
convert format 任何模型
rig-check(亦可用 check) — 任何模型;原樣傳遞下去
rig rig_type 任何模型
retarget(亦可用 animate) animation 僅限 rig 任務
segment model 任何模型
complete — 僅限 segment 任務
decimate(亦可用 lowpoly) face_limit 任何模型

import 與 smartsegment 只接受檔案或網址,不能放在處理鏈中。無效的處理鏈會在執行任何步驟前被拒絕。只會下載最後一個步驟的檔案。若 rig-check 判定模型無法綁定骨架,處理鏈會在此停止,結果中會包含 stopped_early(來源模型仍會下載);若它建議了某個 rig_type,下一個 rig 會採用它。

generate

modelgen generate <endpoint> [options] <input...>
端點 輸入 結果
text-to-model 提示詞 3D 模型
image-to-model 一張圖片 3D 模型
multiview-to-model 2–4 張視角圖片 3D 模型
text-to-image 提示詞 圖片
image-to-image 圖片,搭配 --prompt(或 -p template=…) 編輯後的圖片
image-to-multiview 一張圖片 四視角圖
edit-multiview 多視角任務 編輯後的視角
image-to-splat 一張圖片 Gaussian splat

--model <id> 用來選擇 3D 端點的模型(圖片端點也會原樣傳入);--prompt <text> 是 image-to-image 的提示詞。與 make 不同,generate 不會依提示詞的字眼選用低多邊形模型。

生成檢查

送出前,modelgen 會檢查並調整生成設定:

設定 規則
prompt 最多 1024 個字元。
negative_prompt 最多 255 個字元。
pbr=true 會開啟 texture(警告)。
generate_parts=true 會關閉 texture、pbr 與 quad(警告);之後可用 modelgen model texture 貼圖。
低多邊形模型 會移除 quad、smart_low_poly、generate_parts 與 geometry_quality(警告);face_limit 必須介於 50–20000。
smart_low_poly=true face_limit 必須介於 500–20000(搭配 quad 時為 500–10000)。
texture_quality standard、detailed 或 extreme。
quad=true 輸出為 FBX(警告)。

model, anim, mesh

modelgen model|anim|mesh <step> [options] [input]
步驟 選項 備註
model refine — 精修 text-to-model 草稿任務。
model texture --texture-quality standard,detailed,extreme; --texture-alignment original_image,geometry 重新為模型貼圖。
model stylize --style lego,voxel,voronoi,minecraft(必填);--block-size 32–128(minecraft)
model convert --format GLTF,USDZ,FBX,OBJ,STL,3MF(預設 GLTF);--texture-size <px>;--texture-format BMP,DPX,HDR,JPEG,OPEN_EXR,PNG,TARGA,TIFF,WEBP;--face-limit <n>;--quad;--flatten-bottom;--fbx-preset <preset>(blender、3dsmax,或 modelgen model convert --help 列出的其他預設);--export-orientation +x,-x,+y,-y;--scale-factor <n>;--auto-size;--pivot-to-center-bottom;--export-vertex-colors --quad 無法匯出 GLTF。--fbx-preset 只適用於 FBX,--export-vertex-colors 只適用於 OBJ 與 GLTF;否則會被移除並顯示警告。
model import — 匯入 GLB、FBX、OBJ 或 STL 檔案或網址(最大 150 MB)。
anim check — 判斷模型能否綁定骨架(riggable),並建議 rig_type。
anim rig --rig-type biped,quadruped,hexapod,octopod,avian,serpentine,aquatic;--spec <convention>(慣例列於 modelgen anim --help);--out-format glb,fbx 綁定骨架。未指定 -p model= 時,會依體型選擇骨架模型。
anim retarget --animation preset:walk preset:run …(1–5 個);--out-format glb,fbx;--animate-in-place 僅適用於已綁定骨架的任務。
mesh segment --model <id> 將模型拆分成多個部件。
mesh complete --completion-mode ai_completion,quick_cap 僅適用於 segment 任務。
mesh decimate --face-limit <n>(500–20000,搭配 --quad 時為 500–10000);--quad;--no-bake;-p model=v2.0 或 v1.0 將高多邊形轉為低多邊形,除非加上 --no-bake,否則會烘焙貼圖。使用 v1.0 時必須指定 --face-limit(500–2000000,搭配 --quad 時為 500–150000)。
mesh smartsegment --seg-type image,model(預設 model);--granularity coarse,medium,fine;--hint <text> 只接受檔案或網址。

步驟會拒絕無法處理的任務,例如 retarget only accepts animate_rig tasks (input is a texture_model task)。來源任務必須已成功。

可以使用管線:在 JSON 模式下(導向管線時的預設),步驟會從前一個指令的輸出讀取任務 id,因此 modelgen anim check fox.glb | modelgen anim rig 會為剛檢查過的模型綁定骨架。若前一個指令失敗,其錯誤行會讓下一個指令停止:the previous command in the pipe failed (…); nothing was run.

檔案與輸出

任務成功後,其檔案會下載到 <out>/modelgen-out/<name>-<first 8 of the id>/(<out> 為 -o,否則為 $TMPDIR 或 /tmp)。除非 -o 指向專案資料夾,否則不會有任何檔案放進專案資料夾。資料夾中包含:

  • 任務的每項輸出各一個檔案,以輸出名稱命名,例如 pbr_model.glb、rendered_image.webp;
  • preview.<ext>:若有算繪圖,則為其副本;
  • task.json:包含任務 id、類型、狀態、輸入、輸出欄位、消耗的點數、建立時間與檔案清單。

在終端機中,結果如下:

task <task_id> success
vendor credits consumed: <n>
artifacts: /abs/path/modelgen-out/fox-1a2b3c4d
model file: /abs/path/modelgen-out/fox-1a2b3c4d/pbr_model.glb
preview: /abs/path/modelgen-out/fox-1a2b3c4d/preview.webp

JSON 格式包含:task_id、type、status、credits_consumed、output_dir、files、model_file、preview,處理鏈另有 chain(每個步驟的結果)、source_task_id 與 stopped_early。使用 -n 時為 {"candidates":[…],"chain":[]}。進度(<type> · <status> <n>% · <id8>)會輸出到 stderr。

下載網址會在幾分鐘內失效。若下載失敗,請執行 modelgen task get <id> --download 取得新網址。

task, files, history, redo

modelgen task get <task> [--step] [--download] [-o <dir>]
modelgen task list [tasks...] [--limit <n>]
modelgen task watch <task> [--download] [-o <dir>] [--timeout <seconds>]
modelgen files upload <path>
modelgen history [--limit <n>]
modelgen redo [target] [--seed <n>] [task options]
指令 備註
task get 單一任務的詳細資料:id、類型、狀態、進度、點數與輸出網址。--step 會加上管線步驟的詳細資料;--download 會在任務成功時儲存檔案。
task list 一次查看多個任務;未指定 id 時,列出你最新的任務(--limit,預設 10)。不屬於你的 id 會列在 missed 下。
task watch 等待任務完成(預設 1800 秒)。在 JSON 模式下,每次變化都會串流輸出一行 {"event":"progress","task_id":…,"status":…,"progress":…}。
files upload 印出可作為輸入的 file_token。
history 你最近的任務(--limit 1–50,預設 20):日期、名稱、類型、狀態與 id。
redo 以新種子(或 --seed)重新送出先前任務的請求。預設為 @last。

balance, docs, doctor

modelgen 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。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;用量也可在設定 › 方案與用量中查看。

modelgen docs 會印出內附的指南;--topic 會印出一份內附文件:commands/<cmd>、examples/<scenario>、models 或 common-errors。

modelgen doctor 會檢查 curl、jq、後端位址、團隊登入、Agent 身分、服務是否回應、內附文件與終端機,每項一行,標示 ✓、✗ 或 !。若有關鍵檢查失敗,結束代碼為 1。

結束代碼與錯誤

錯誤會以 Error: <message> 輸出到 stderr。在 JSON 模式下,或 stdout 導向管線時,錯誤也會以 {"error":true,"exit_code":<n>,"reason":"…"} 輸出到 stdout。

結束代碼 意義 處理方式
0 成功。 —
1 非預期錯誤,或 doctor 檢查失敗。 執行 modelgen doctor。
2 用法或參數無效;未送出任何內容。 閱讀訊息並修正指令。
3 登入失敗,或不是在 AirBuild Agent 的環境中執行。 從 Agent 執行。
4 AI 額度與積分已用完。 請團隊擁有者加購積分或變更方案。
5 遭內容政策拒絕。 修改提示詞或圖片。
6 任務失敗、已取消或已過期,或等待逾時。 閱讀訊息。逾時後任務仍會繼續執行:modelgen task get <id>。
7 網路或服務錯誤,或下載失敗。 再試一次;下載問題請使用 modelgen task get <id> --download。
8 找不到。 檢查 id 或名稱。
9 服務忙碌中。 稍候再試。
訊息 結束代碼
no input given. 2
file not found: "PATH" (if you meant a text prompt, quote a sentence instead). 2
"PATH" exists but has an unsupported extension ".EXT" (…). 2
NAME is N MB, over the 20 MB image limit. / … over the 150 MB model limit. 2
a task reference needs processing steps: add --then (e.g. modelgen make @last --then texture,convert:fbx). 2
unknown step "X" (valid: …). / unknown scenario "X" (valid: …). 2
step "X" only accepts … tasks, but the previous step produces "…". 2
at most 4 candidates per run (-n 4). 2
multiview needs 2–4 images (got N). / multiview requires a front view — name one file with "front" or pass it first. 2
no successful task yet. / no task named "@X"; "modelgen history" lists your tasks. 2
"X" matches N of your tasks; give more characters or the full id. 2
task ID is running; processing steps need a successful upstream task (wait with "modelgen task watch ID"). 2
task ID failed: <reason>(也可能是 cancelled、banned、expired) 6
task ID is still running after Ns (it keeps running server-side; check later with "modelgen task get ID") 6
artifact download failed (…) 7
could not reach the Airbuild creative service: … 7

短暫的網路失敗與忙碌回應會先自動重試幾次,modelgen 才會放棄。

範例

終端機視窗
# A prompt to a textured model, downloaded under $TMPDIR
modelgen make "a stylized red fox, game asset" --name fox

# A mobile game asset from a concept image, in the project folder
modelgen make concept.png --for game-mobile -o Assets/Models

# Rig and animate an earlier task, then export FBX
modelgen make @fox --then "rig-check,rig,retarget:animations=[\"preset:idle\",\"preset:walk\"],convert:fbx"

# Simplify an earlier task and convert the result for AR
modelgen mesh decimate @fox --face-limit 8000 --no-download --json | modelgen model convert --format USDZ