# videogen

> वह command जिससे एजेंट कोई hosted video model ढूँढते हैं, उसके inputs पढ़ते हैं, उसे चलाते हैं, run पर नज़र रखते हैं और नतीजा डाउनलोड करते हैं।

Source: https://air.build/hi/docs/cli/videogen/

`videogen` hosted generation models, ज़्यादातर video models, को उनके endpoint id से चलाता है। यह model catalogue में खोजता है, किसी model के inputs को flags के रूप में दिखाता है, model चलाकर इंतज़ार करता है (या तुरंत लौटकर आपको बाद में जाँचने देता है), input files अपलोड करता है, और नतीजे की हर media file सेव करता है।

## यह कहाँ चलता है

यही command cloud टीम और Mac टीम, दोनों के एजेंट्स के लिए उपलब्ध है। Sign-in और एजेंट attribution एजेंट के environment से आते हैं, इसलिए कुछ सेट नहीं करना पड़ता। इसके लिए `curl` और `jq` चाहिए। Downloads और uploads सीधे model host के file storage पर जाते हैं, इसलिए उस तक पहुँच होनी चाहिए; `videogen doctor` इसे जाँचता है। देखें [चुनें कि आपके एजेंट कहाँ चलें](https://air.build/hi/docs/get-started/where-agents-run/)।

## Synopsis

```text
videogen <command> [args] [--json] [--quiet]
videogen --help | --version
videogen run <endpoint_id> --help
```

| Command | यह क्या करती है |
| --- | --- |
| `models [query]` | Model catalogue में खोजती है। |
| `schema <endpoint_id>` | किसी model के inputs और outputs। |
| `run <endpoint_id> [--<param> <value> …]` | Model चलाती है। उसका इंतज़ार करती है, या `--async` के साथ तुरंत लौटती है। |
| `status <endpoint_id> <request_id>` | किसी run का status; नतीजे के लिए `--result`, cancel करने के लिए `--cancel`। |
| `upload <file or url>` | Input file को ऐसी जगह रखती है जहाँ models उसे पढ़ सकें, और उसका address दिखाती है। |
| `pricing <endpoint_id>` | Model की list price और billing unit। |
| `docs ["<query>"]` | Model documentation में खोजती है; query के बिना साथ आई guide दिखाती है। |
| `history [--limit n]` | आपके हाल के runs, सबसे नए पहले। |
| `balance` | इस period का AI usage, plan के AI allowance के मुकाबले। |
| `doctor` | Environment, sign-in और reachability जाँचती है। |

Models का नाम हमेशा उनके पूरे endpoint id, `owner/app/…`, से लिया जाता है: ऐसा id जो `videogen models` सूची में दिखाती है। कोई short names नहीं हैं।

### हर command पर options

| Option | मतलब |
| --- | --- |
| `--json` | stdout पर structured JSON। stdout pipe होने पर यह डिफ़ॉल्ट है। |
| `--quiet` | stderr पर कम output। |

## models

```text
videogen models [query] [--category c] [--status active|deprecated|all]
                [--limit n] [--cursor t] [--endpoint_id id[,id]] [--expand x] [--no-classify]
```

| Flag | Value | Default | मतलब |
| --- | --- | --- | --- |
| `query` | Free text, quotes में | None | जैसे `"text to video"`। सिर्फ़ एक query। |
| `--category` | `text-to-video`, `image-to-video`, `video-to-video`, `text-to-image`, `text-to-speech`, `text-to-audio`, `text-to-3d`, … | Query से अनुमान लगाया जाता है | खोज को एक category तक सीमित करता है। |
| `--no-classify` | — | अनुमान चालू | Query से category का अनुमान नहीं लगाता। |
| `--status` | `active`, `deprecated`, `all` | `active` | कौन-से models शामिल करने हैं। |
| `--limit` | एक positive number | `20` | कितने नतीजे। |
| `--cursor` | पिछले page का `next_cursor` | — | अगला page। |
| `--endpoint_id` (या `--endpoint-id`) | एक id, या comma से अलग कई; कई बार दे सकते हैं | — | उन models को लाता है। |
| `--expand` | `openapi-3.0`, `enterprise_status` | — | हर model में वह data जोड़ता है। |

Terminal में: `<n> model(s) · <category> · more: --cursor <t>`, फिर हर model का endpoint id, नाम और छोटा किया गया description। JSON के रूप में: `query`, `category`, `inferred_category`, `status`, `count`, `has_more`, `next_cursor` और `models` (हर एक में `endpoint_id`, `name`, `category`, `status`, `description`, और पता हो तो tags और links)।

## schema

```text
videogen schema <endpoint_id> [--format compact|openapi]
```

`compact` (default) model के inputs को उन flags के रूप में दिखाता है जो `run` लेती है, हर एक के type, `(required)`, अनुमत values और default के साथ, फिर outputs। JSON के रूप में: `endpoint_id`, `name`, `category`, `input` और `output`, हर एक `{name, type, required, description, default, enum}` की सूची। `--format openapi` model का पूरा OpenAPI document दिखाता है। `videogen run <endpoint_id> --help` वही दिखाता है जो `schema`।

## run

```text
videogen run <endpoint_id> [--<param> <value> …] [--async] [--logs] [--download [template]] [--max-wait <seconds>]
```

हर model input एक `--<param> <value>` जोड़ी है, जिसका नाम ठीक वैसा ही है जैसा schema में (snake_case), जैसे `--prompt "…" --duration 5`। `--param=value` भी काम करता है। बिना value वाला flag `true` होता है। Values typed होती हैं: `true`/`false`, numbers और JSON उन्हीं types में बदलते हैं, बाकी सब string। जब schema कहे कि कोई input string है, तो value वही string रहती है जो आपने type की (इसलिए `--duration 5` उस model को `"5"` भेजता है जिसे `"5"` चाहिए, और उसे `5` जिसे number चाहिए)।

| Flag | Default | मतलब |
| --- | --- | --- |
| `--async` | Off | Submit करके `request_id` के साथ तुरंत लौटता है। |
| `--logs` | Off | चलते समय model की log lines stderr पर दिखाता है। |
| `--download [template]` | Off | नतीजे की हर media file सेव करता है। नीचे देखें। |
| `--max-wait <seconds>` | `1800` | इतनी देर बाद इंतज़ार रोक देता है। Run जारी रहता है; उसे `videogen status` से फिर देखें। |

इंतज़ार के दौरान stderr पर `Submitting run`, `Queued request <id>`, फिर `Waiting in queue (position n)`, `Model is running`, `Completed` दिखते हैं।

Request body अधिकतम 40 MB हो सकती है। बड़ी files `videogen upload` से दें और model को address दें।

### Downloads

`--download` नतीजे के हर file address को क्रम से सेव करता है:

| Template | Files कहाँ जाती हैं |
| --- | --- |
| None | `$TMPDIR` (या `/tmp`), source file names के साथ |
| एक folder, या `/` पर खत्म होने वाला path | उस folder में, source file names के साथ |
| `{index}`, `{name}`, `{ext}` या `{request_id}` वाला path | उस path पर, placeholders भरकर, जैसे `out/hero-{index}.{ext}` |
| कोई और path | ठीक वही path |

न मौजूद folders बना दिए जाते हैं। जो नाम पहले से लिया हुआ है, उसमें extension से पहले `_1`, `_2`, … जोड़ा जाता है, ताकि कुछ overwrite न हो। कोई भी download fail होने पर command, जो सेव हुआ वह दिखाने के बाद, `6` के साथ exit करती है।

### run क्या दिखाता है

`--async` के साथ:

```text
submitted  <request_id>
Check status: videogen status <endpoint_id> <request_id>
```

JSON के रूप में: `{"status":"submitted","request_id":…,"endpoint_id":…,"hint":…}`।

Run पूरा होने पर:

```text
✓ completed  <endpoint_id>  <request_id>
cost: $<n>
  /abs/path/to/file.mp4  (<bytes> bytes)
```

`--download` के बिना, paths की जगह नतीजे के file addresses दिखते हैं। JSON के रूप में: `status` (`completed`), `endpoint_id`, `request_id`, `result` (model का अपना output), `downloaded_files` (हर एक `{url, path, size_bytes, json_path}`), `download_failures`, `logs` और पता हो तो `cost_usd`।

## status

```text
videogen status <endpoint_id> <request_id> [--result] [--logs] [--cancel] [--download [template]]
```

| Flag | मतलब |
| --- | --- |
| None | Status दिखाता है: `IN_QUEUE` (queue position के साथ), `IN_PROGRESS` या `COMPLETED`, और आख़िरी पाँच log lines। |
| `--logs` | आख़िरी पाँच की जगह सभी log lines। |
| `--result` | पूरा हुआ नतीजा लाता है, उसी तरह दिखाकर जैसे `run` दिखाता है। |
| `--download [template]` | `run` की तरह; `--result` भी शामिल है। |
| `--cancel` | Queue में पड़े run को cancel करके `cancelled  <request_id>` दिखाता है। `--download` के साथ नहीं दिया जा सकता। |

अगर `request_id` खो गया हो, तो `videogen history` आपके runs दिखाता है।

## upload

```text
videogen upload <file or url>
```

कोई local file, या किसी web address की कॉपी, अपलोड करता है और वह address लौटाता है जिसे model input के रूप में देना है (`image_url`, `start_image_url`, `video_url`, …)। Terminal में यह सिर्फ़ address दिखाता है; JSON के रूप में (pipe होने पर भी), `{"cdn_url":…,"hint":…}`। Content type file extension से तय होता है (images, video, audio, 3D files, JSON, text, PDF, ZIP)।

## pricing

```text
videogen pricing <endpoint_id>
```

Model की हर billing unit (seconds, videos, megapixels, …) की list price `<endpoint_id>: $<price> per <unit>` के रूप में दिखाता है। जिस model की कोई प्रकाशित price नहीं है, उसके लिए `no published price (the model cannot be run here)` दिखता है। Pipe होने पर यह `prices` सूची वाला service का JSON दिखाता है।

## history

```text
videogen history [--limit n]
```

आपके हाल के runs, सबसे नए पहले (default 20): तारीख, status, endpoint id, request id और, settle होने के बाद, cost। कोई run न हो तो `no runs yet`। JSON के रूप में: `{"runs":[{request_id, endpoint_id, status, created_at, cost_usd}]}`।

## balance

इस period का AI usage plan के AI allowance के मुकाबले दिखाता है, जो एजेंट chat के साथ साझा होता है। Terminal में:

```text
AI usage: <percent>% of this period's plan allowance (<n> credits beyond the plan)
credits left: <n> (<n> credits owed)
```

जब plan में कोई AI allowance नहीं होता, तो पहली line `AI usage: the plan includes no AI allowance, paid with credits` होती है। जब allowance और credits खत्म हो जाते हैं, तो यह `! AI allowance and credits exhausted — ask your user to add credits or upgrade the plan` जोड़ता है। Pipe होने पर यह `used_usd`, `included_usd`, `overage_usd`, `credit_balance_usd`, `used_percent`, `overage_credits`, `credits_left`, `credits_owed`, `has_capacity` और `period_end` वाला JSON दिखाता है। Plans [air.build/pricing](https://air.build/pricing/) पर हैं; टीम का usage Settings › [Plan & Usage](https://air.build/hi/docs/settings/plan-usage/) में है।

## docs और doctor

`videogen docs "<query>"` model documentation, guides और API references में online खोजता है और हर नतीजे का title, address और एक अंश दिखाता है। Query के बिना यह साथ आई guide दिखाता है; `--topic` एक bundled doc दिखाता है: `models`, `prompting`, `cinematography`, `storytelling`, `commands` या `common-errors`।

`videogen doctor` ये चीज़ें जाँचता है, हर एक की एक line `✓`, `✗` या `!` के साथ: `curl`, `jq`, backend address, टीम sign-in, एजेंट identity, video service, media file storage (पहुँच न होने पर `unreachable; --download and upload will fail`), bundled docs, और terminal interactive है या नहीं। Pipe होने पर यह `{"ok":…,"checks":[…]}` दिखाता है। कोई critical check fail होने पर यह `1` के साथ exit करता है।

## Errors और exit codes

stdout पर सिर्फ़ नतीजा आता है। Errors stderr पर जाते हैं: `Error: <message>`, और अगर हों तो उसके बाद details। JSON mode में error stderr पर `{"error":"…","details":{…}}` होता है, जहाँ `details` में `status`, `error_type` (`ValidationError` या `ApiError`), `validation_errors` (हर एक `{field, message}`), service की `body`, `endpoint_id`, `request_id`, `logs` और एक `hint` हो सकते हैं।

| Exit code | मतलब | क्या करें |
| --- | --- | --- |
| `0` | सफल। | — |
| `1` | अनपेक्षित error, या fail हुआ `doctor` check। | `videogen doctor` चलाएँ। |
| `2` | गलत usage या parameters, जिनमें वे inputs भी शामिल हैं जिन्हें model ठुकरा देता है। | `Validation error — <field>: <message>` पढ़ें और वह input ठीक करें; `videogen schema` उनकी सूची देता है। |
| `3` | Sign-in fail हुआ, या यह AirBuild एजेंट के environment में नहीं चल रहा। | इसे किसी एजेंट से चलाएँ। |
| `4` | AI allowance और credits खत्म हो गए। | टीम के owner से credits जोड़ने या plan बदलने को कहें। |
| `5` | Content policy ने ठुकरा दिया। | Prompt या input बदलें। |
| `6` | Run fail हुआ, या कोई download fail हुआ। | Message पढ़ें; फिर कोशिश करें या inputs बदलें। |
| `7` | Network या service error, या run खत्म होने से पहले इंतज़ार खत्म हो गया। | बाद में `videogen status` से जाँचें। |
| `8` | नहीं मिला: model, run, file या doc। | Id जाँचें। |
| `9` | Service व्यस्त है। | इंतज़ार करके फिर कोशिश करें। |

| 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 |

छोटी network failures और busy जवाबों पर `videogen` हार मानने से पहले अपने आप कुछ बार फिर कोशिश करता है।

## उदाहरण

```bash
# 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
```
