ai-cli 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +120 -0
- package/package.json +1 -1
- package/src/commands/image.ts +4 -0
- package/src/commands/text.ts +4 -0
- package/src/commands/video.ts +4 -0
package/README.md
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# ai
|
|
2
|
+
|
|
3
|
+
A 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://sdk.vercel.ai) and [AI Gateway](https://vercel.com/docs/ai-gateway) for unified access to hundreds of models.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g ai-cli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Requires an [AI Gateway](https://vercel.com/docs/ai-gateway) API key or a provider-specific key (e.g. `OPENAI_API_KEY`).
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
ai image "a cute dog"
|
|
17
|
+
ai video "a spinning triangle"
|
|
18
|
+
ai text "explain quantum computing"
|
|
19
|
+
ai models # list available models
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Piping
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
ai image "a dragon" | ai video "animate this"
|
|
26
|
+
cat notes.txt | ai text "summarize this"
|
|
27
|
+
git diff | ai text "explain these changes"
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Common Options
|
|
31
|
+
|
|
32
|
+
All commands support:
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
-m, --model <id> Model ID (creator/model-name), comma-separated for multi-model
|
|
36
|
+
-o, --output <path> Output file path or directory
|
|
37
|
+
-n, --count <n> Number of generations per model (default: 1)
|
|
38
|
+
-p, --concurrency <n> Max parallel generations (default: 4, video: 2)
|
|
39
|
+
-q, --quiet Suppress progress output
|
|
40
|
+
--json Output metadata as JSON
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### image
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
--size <WxH> Image size (e.g. 1024x1024)
|
|
47
|
+
--aspect-ratio <W:H> Aspect ratio (e.g. 16:9)
|
|
48
|
+
--quality <level> Quality (standard, hd)
|
|
49
|
+
--style <style> Style (vivid, natural)
|
|
50
|
+
--no-preview Disable inline image preview
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### video
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
--aspect-ratio <W:H> Aspect ratio (e.g. 16:9)
|
|
57
|
+
--duration <seconds> Duration in seconds
|
|
58
|
+
--no-preview Disable inline video frame preview
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### text
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
-f, --format <fmt> Output format: md, txt (default: md)
|
|
65
|
+
-s, --system <prompt> System prompt
|
|
66
|
+
--max-tokens <n> Maximum tokens to generate
|
|
67
|
+
-t, --temperature <n> Temperature (0-2)
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### models
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
--type <type> Filter by type: text, image, video
|
|
74
|
+
--provider <name> Filter by provider (e.g. openai, google)
|
|
75
|
+
--json Output as JSON (includes descriptions)
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
All model types (text, image, video) are fetched live from the AI Gateway. If the gateway is unreachable, all model types fall back to a built-in list.
|
|
79
|
+
|
|
80
|
+
### Multi-Model Comparison
|
|
81
|
+
|
|
82
|
+
Generate with multiple models by comma-separating `-m`:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
ai image "a sunset" -m "openai/gpt-image-1,xai/grok-imagine-image,bfl/flux-2-pro"
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Combine with `-n` to generate multiple per model:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
ai image "a sunset" -n 2 -m "openai/gpt-image-1,bfl/flux-2-pro" # 4 images total
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Inline Preview
|
|
95
|
+
|
|
96
|
+
When running in a terminal that supports the [Kitty graphics protocol](https://sw.kovidgoyal.net/kitty/graphics-protocol/) (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://github.com/cisco/openh264) 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.
|
|
97
|
+
|
|
98
|
+
### Output Behavior
|
|
99
|
+
|
|
100
|
+
- **text**: saves to `output.md` (interactive), stdout when piped
|
|
101
|
+
- **image/video**: saves to file (interactive), raw binary stdout when piped
|
|
102
|
+
- **`-o <dir>`**: saves inside the directory with auto-generated names
|
|
103
|
+
|
|
104
|
+
### Environment Variables
|
|
105
|
+
|
|
106
|
+
| Variable | Description |
|
|
107
|
+
|---|---|
|
|
108
|
+
| `AI_GATEWAY_API_KEY` | AI Gateway authentication key |
|
|
109
|
+
| `OPENAI_API_KEY` | Provider-specific key (or other provider keys) |
|
|
110
|
+
| `AI_CLI_TEXT_MODEL` | Default text model (overrides `openai/gpt-5.5`) |
|
|
111
|
+
| `AI_CLI_IMAGE_MODEL` | Default image model (overrides `openai/gpt-image-2`) |
|
|
112
|
+
| `AI_CLI_VIDEO_MODEL` | Default video model (overrides `bytedance/seedance-2.0`) |
|
|
113
|
+
| `AI_CLI_OUTPUT_DIR` | Default output directory for generated files |
|
|
114
|
+
| `AI_CLI_PREVIEW` | Set to `1` to force inline image preview, `0` to disable |
|
|
115
|
+
|
|
116
|
+
The `-m` flag always takes priority over `AI_CLI_*_MODEL` env vars. The `-o` flag always takes priority over `AI_CLI_OUTPUT_DIR`.
|
|
117
|
+
|
|
118
|
+
## License
|
|
119
|
+
|
|
120
|
+
[Apache-2.0](LICENSE)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ai-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "A tiny, agent-native CLI for generating images, video and text with dead-simple commands, stdin support and predictable artifact outputs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
package/src/commands/image.ts
CHANGED
|
@@ -91,6 +91,10 @@ export function registerImageCommand(program: Command) {
|
|
|
91
91
|
async (modelId) => {
|
|
92
92
|
const abort = AbortSignal.timeout(DEFAULT_TIMEOUT_MS);
|
|
93
93
|
const result = await generateImage({
|
|
94
|
+
headers: {
|
|
95
|
+
"http-referer": "https://github.com/vercel-labs/ai-cli",
|
|
96
|
+
"x-title": "ai-cli",
|
|
97
|
+
},
|
|
94
98
|
model: gateway.image(modelId),
|
|
95
99
|
prompt: imagePrompt,
|
|
96
100
|
abortSignal: abort,
|
package/src/commands/text.ts
CHANGED
|
@@ -87,6 +87,10 @@ export function registerTextCommand(program: Command) {
|
|
|
87
87
|
async (modelId) => {
|
|
88
88
|
const abort = AbortSignal.timeout(DEFAULT_TIMEOUT_MS);
|
|
89
89
|
const result = await generateText({
|
|
90
|
+
headers: {
|
|
91
|
+
"http-referer": "https://github.com/vercel-labs/ai-cli",
|
|
92
|
+
"x-title": "ai-cli",
|
|
93
|
+
},
|
|
90
94
|
model: gateway(modelId),
|
|
91
95
|
prompt: fullPrompt,
|
|
92
96
|
system: opts.system,
|
package/src/commands/video.ts
CHANGED
|
@@ -83,6 +83,10 @@ export function registerVideoCommand(program: Command) {
|
|
|
83
83
|
async (modelId) => {
|
|
84
84
|
const abort = AbortSignal.timeout(DEFAULT_TIMEOUT_MS);
|
|
85
85
|
const result = await generateVideo({
|
|
86
|
+
headers: {
|
|
87
|
+
"http-referer": "https://github.com/vercel-labs/ai-cli",
|
|
88
|
+
"x-title": "ai-cli",
|
|
89
|
+
},
|
|
86
90
|
model: gateway.video(modelId),
|
|
87
91
|
prompt: videoPrompt,
|
|
88
92
|
abortSignal: abort,
|