[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-183":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":9,"totalLinesOfCode":9,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":9,"subscribersCount":15,"size":15,"stars1d":15,"stars7d":16,"stars30d":17,"stars90d":15,"forks30d":15,"starsTrendScore":15,"compositeScore":18,"rankGlobal":9,"rankLanguage":9,"license":9,"archived":19,"fork":19,"defaultBranch":20,"hasWiki":19,"hasPages":19,"topics":9,"createdAt":9,"pushedAt":9,"updatedAt":21,"readmeContent":22,"aiSummary":23,"trendingCount":15,"starSnapshotCount":15,"syncStatus":24,"lastSyncTime":25,"discoverSource":26},183,"ai-cli","vercel-labs\u002Fai-cli","vercel-labs","Generate anything from your terminal",null,"https:\u002F\u002Fgithub.com\u002Fvercel-labs\u002Fai-cli","TypeScript",537,48,3,0,18,162,65.07,false,"main","2026-06-11 04:00:17","# ai\n\nA tiny, agent-native CLI for generating images, video and text with dead-simple commands, stdin support and predictable artifact outputs. Uses [Vercel AI SDK](https:\u002F\u002Fsdk.vercel.ai) and [AI Gateway](https:\u002F\u002Fvercel.com\u002Fdocs\u002Fai-gateway) for unified access to hundreds of models.\n\n## Install\n\n```bash\nnpm install -g ai-cli\n```\n\nRequires an [AI Gateway](https:\u002F\u002Fvercel.com\u002Fdocs\u002Fai-gateway) API key or a provider-specific key (e.g. `OPENAI_API_KEY`).\n\n## Usage\n\n```bash\nai image \"a cute dog\"\nai video \"a spinning triangle\"\nai text \"explain quantum computing\"\nai models                          # list available models\n```\n\n### Piping\n\n```bash\nai image \"a dragon\" | ai video \"animate this\"\ncat notes.txt | ai text \"summarize this\"\ngit diff | ai text \"explain these changes\"\n```\n\n### Common Options\n\nAll commands support:\n\n```\n-m, --model \u003Cid>         Model ID (creator\u002Fmodel-name), comma-separated for multi-model\n-o, --output \u003Cpath>      Output file path or directory\n-n, --count \u003Cn>          Number of generations per model (default: 1)\n-p, --concurrency \u003Cn>    Max parallel generations (default: 4, video: 2)\n-q, --quiet              Suppress progress output\n--json                   Output metadata as JSON\n```\n\nModel IDs can be specified as `creator\u002Fmodel-name` or just `model-name` (resolved against models fetched from the gateway):\n\n```bash\nai text -m gpt-5.5 \"hello\"          # resolves to openai\u002Fgpt-5.5\nai image -m flux-2-pro \"a sunset\"   # resolves to bfl\u002Fflux-2-pro\n```\n\n### image\n\n```\n--size \u003CWxH>             Image size (e.g. 1024x1024)\n--aspect-ratio \u003CW:H>     Aspect ratio (e.g. 16:9)\n--quality \u003Clevel>        Quality (standard, hd)\n--style \u003Cstyle>          Style (vivid, natural)\n--no-preview             Disable inline image preview\n```\n\n### video\n\n```\n--aspect-ratio \u003CW:H>     Aspect ratio (e.g. 16:9)\n--duration \u003Cseconds>     Duration in seconds\n--no-preview             Disable inline video frame preview\n```\n\n### text\n\n```\n-f, --format \u003Cfmt>       Output format: md, txt (default: md)\n-s, --system \u003Cprompt>    System prompt\n--max-tokens \u003Cn>         Maximum tokens to generate\n-t, --temperature \u003Cn>    Temperature (0-2)\n```\n\n### models\n\n```\n--type \u003Ctype>            Filter by type: text, image, video\n--creator \u003Cname>         Filter by creator (e.g. openai, google)\n--json                   Output as JSON (includes descriptions)\n```\n\nAll model types (text, image, video) are fetched live from the AI Gateway.\n\n### Multi-Model Comparison\n\nGenerate with multiple models by comma-separating `-m`:\n\n```bash\nai image \"a sunset\" -m \"openai\u002Fgpt-image-1,xai\u002Fgrok-imagine-image,bfl\u002Fflux-2-pro\"\n```\n\nCombine with `-n` to generate multiple per model:\n\n```bash\nai image \"a sunset\" -n 2 -m \"openai\u002Fgpt-image-1,bfl\u002Fflux-2-pro\"   # 4 images total\n```\n\n### Inline Preview\n\nWhen running in a terminal that supports the [Kitty graphics protocol](https:\u002F\u002Fsw.kovidgoyal.net\u002Fkitty\u002Fgraphics-protocol\u002F) (Kitty, Ghostty, WezTerm, Warp, iTerm2), generated images and videos are displayed inline automatically. Video previews decode an H.264 keyframe from the midpoint of the video using [openh264](https:\u002F\u002Fgithub.com\u002Fcisco\u002Fopenh264) compiled to WebAssembly — no native dependencies required. Use `--no-preview` to disable this, or set `AI_CLI_PREVIEW=1` to force it on in undetected terminals.\n\n### Output Behavior\n\n- **text**: saves to `output.md` (interactive), stdout when piped\n- **image\u002Fvideo**: saves to file (interactive), raw binary stdout when piped\n- **`-o \u003Cdir>`**: saves inside the directory with auto-generated names\n\n### Environment Variables\n\n| Variable | Description |\n|---|---|\n| `AI_GATEWAY_API_KEY` | AI Gateway authentication key |\n| `OPENAI_API_KEY` | Provider-specific key (or other provider keys) |\n| `AI_CLI_TEXT_MODEL` | Default text model (overrides `openai\u002Fgpt-5.5`) |\n| `AI_CLI_IMAGE_MODEL` | Default image model (overrides `openai\u002Fgpt-image-2`) |\n| `AI_CLI_VIDEO_MODEL` | Default video model (overrides `bytedance\u002Fseedance-2.0`) |\n| `AI_CLI_OUTPUT_DIR` | Default output directory for generated files |\n| `AI_CLI_PREVIEW` | Set to `1` to force inline image preview, `0` to disable |\n| `NO_COLOR` | Disable ANSI color output |\n| `FORCE_COLOR` | Force color output even when not a TTY |\n\nThe `-m` flag always takes priority over `AI_CLI_*_MODEL` env vars. The `-o` flag always takes priority over `AI_CLI_OUTPUT_DIR`.\n\n### Timeouts\n\nRequests that exceed the timeout are aborted automatically:\n\n| Command | Timeout |\n|---|---|\n| `text` | 120 seconds |\n| `image` | 120 seconds |\n| `video` | 300 seconds |\n\n### Exit Codes\n\n| Code | Meaning |\n|---|---|\n| `0` | Success |\n| `1` | All generations failed |\n| `2` | Partial failure (some succeeded, some failed) |\n\n## License\n\n[Apache-2.0](LICENSE)\n","ai-cli 是一个基于终端的生成工具，能够通过简单的命令生成图像、视频和文本。它利用 Vercel AI SDK 和 AI Gateway 技术，提供对数百种模型的统一访问。用户可以通过安装 npm 包并在配置相应的 API 密钥后开始使用。支持从标准输入读取数据，并且可以轻松地将输出重定向或管道传输到其他命令中处理。此外，该工具还提供了丰富的选项来定制生成内容的质量、样式和其他参数。适用于需要快速原型设计、自动化内容生成或者希望在开发流程中集成 AI 功能的场景。",2,"2026-06-11 02:31:24","trending"]