vargai 0.4.0-alpha20 → 0.4.0-alpha23

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/package.json CHANGED
@@ -65,7 +65,7 @@
65
65
  "vargai": "^0.4.0-alpha11",
66
66
  "zod": "^4.2.1"
67
67
  },
68
- "version": "0.4.0-alpha20",
68
+ "version": "0.4.0-alpha23",
69
69
  "exports": {
70
70
  ".": "./src/index.ts",
71
71
  "./ai": "./src/ai-sdk/index.ts",
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  name: varg-video-generation
3
- description: Generate AI videos using varg SDK React engine. Use when creating videos, animations, talking characters, slideshows, or social media content. Always run onboarding first to check API keys.
3
+ description: Generate AI videos using varg SDK React engine. Use when creating videos, animations, talking characters, slideshows, or social media content.
4
4
  license: MIT
5
5
  metadata:
6
6
  author: vargHQ
7
7
  version: "1.0.0"
8
- compatibility: Requires bun runtime. FAL_API_KEY required. Optional ELEVENLABS_API_KEY, REPLICATE_API_TOKEN, GROQ_API_KEY
8
+ compatibility: Requires bun runtime. FAL_KEY required. Optional ELEVENLABS_API_KEY, REPLICATE_API_TOKEN, GROQ_API_KEY
9
9
  allowed-tools: Bash(bun:*) Bash(cat:*) Read Write Edit
10
10
  ---
11
11
 
@@ -15,21 +15,27 @@ Generate AI videos using declarative JSX syntax with automatic caching and paral
15
15
 
16
16
  ## Quick Setup
17
17
 
18
- Run the setup script to initialize a project:
18
+ Initialize a new project:
19
19
 
20
20
  ```bash
21
- bun scripts/setup.ts
21
+ bunx vargai init
22
22
  ```
23
23
 
24
- Or manually check API keys:
24
+ Or just create hello.tsx starter:
25
25
 
26
26
  ```bash
27
- cat .env 2>/dev/null | grep -E "^(FAL_API_KEY|ELEVENLABS_API_KEY)=" || echo "No API keys found"
27
+ bunx vargai hello
28
+ ```
29
+
30
+ Check existing API keys:
31
+
32
+ ```bash
33
+ cat .env 2>/dev/null | grep -E "^(FAL_KEY|ELEVENLABS_API_KEY)=" || echo "No API keys found"
28
34
  ```
29
35
 
30
36
  ## Required API Keys
31
37
 
32
- ### FAL_API_KEY (Required)
38
+ ### FAL_KEY (Required)
33
39
 
34
40
  | Detail | Value |
35
41
  |--------|-------|
@@ -38,10 +44,10 @@ cat .env 2>/dev/null | grep -E "^(FAL_API_KEY|ELEVENLABS_API_KEY)=" || echo "No
38
44
  | Free tier | Yes (limited credits) |
39
45
  | Used for | Image generation (Flux), Video generation (Wan 2.5, Kling) |
40
46
 
41
- If user doesn't have `FAL_API_KEY`:
47
+ If user doesn't have `FAL_KEY`:
42
48
  1. Direct them to https://fal.ai/dashboard/keys
43
49
  2. Create account and generate API key
44
- 3. Add to `.env` file: `FAL_API_KEY=fal_xxxxx`
50
+ 3. Add to `.env` file: `FAL_KEY=fal_xxxxx`
45
51
 
46
52
  ### Optional Keys
47
53
 
@@ -76,73 +82,78 @@ If user doesn't have `FAL_API_KEY`:
76
82
  ### Simple Slideshow (FAL only)
77
83
 
78
84
  ```tsx
79
- import { render, Render, Clip, Image } from "vargai/react";
85
+ /** @jsxImportSource vargai */
86
+ import { Render, Clip, Image } from "vargai/react";
80
87
 
81
88
  const SCENES = ["sunset over ocean", "mountain peaks", "city at night"];
82
89
 
83
- await render(
90
+ export default (
84
91
  <Render width={1080} height={1920}>
85
92
  {SCENES.map((prompt, i) => (
86
93
  <Clip key={i} duration={3} transition={{ name: "fade", duration: 0.5 }}>
87
94
  <Image prompt={prompt} zoom="in" />
88
95
  </Clip>
89
96
  ))}
90
- </Render>,
91
- { output: "output/slideshow.mp4" }
97
+ </Render>
92
98
  );
93
99
  ```
94
100
 
95
101
  ### Animated Video (FAL + ElevenLabs)
96
102
 
97
103
  ```tsx
98
- import { render, Render, Clip, Image, Animate, Music } from "vargai/react";
104
+ /** @jsxImportSource vargai */
105
+ import { Render, Clip, Image, Video, Music } from "vargai/react";
99
106
  import { fal, elevenlabs } from "vargai/ai";
100
107
 
101
- await render(
108
+ const cat = Image({ prompt: "cute cat on windowsill" });
109
+
110
+ export default (
102
111
  <Render width={1080} height={1920}>
103
- <Music prompt="upbeat electronic" model={elevenlabs.musicModel()} duration={10} />
112
+ <Music prompt="upbeat electronic" model={elevenlabs.musicModel()} />
104
113
  <Clip duration={5}>
105
- <Animate
106
- image={Image({ prompt: "cute cat on windowsill" })}
107
- motion="cat turns head, blinks slowly"
114
+ <Video
115
+ prompt={{ text: "cat turns head, blinks slowly", images: [cat] }}
108
116
  model={fal.videoModel("wan-2.5")}
109
- duration={5}
110
117
  />
111
118
  </Clip>
112
- </Render>,
113
- { output: "output/video.mp4" }
119
+ </Render>
114
120
  );
115
121
  ```
116
122
 
117
123
  ### Talking Character
118
124
 
119
125
  ```tsx
120
- import { render, Render, Clip, Image, Animate, Speech } from "vargai/react";
126
+ /** @jsxImportSource vargai */
127
+ import { Render, Clip, Image, Video, Speech, Captions } from "vargai/react";
121
128
  import { fal, elevenlabs } from "vargai/ai";
122
129
 
123
- await render(
130
+ const robot = Image({ prompt: "friendly robot, blue metallic", aspectRatio: "9:16" });
131
+
132
+ const voiceover = Speech({
133
+ model: elevenlabs.speechModel("eleven_multilingual_v2"),
134
+ voice: "adam",
135
+ children: "Hello! I'm your AI assistant. Let's create something amazing!",
136
+ });
137
+
138
+ export default (
124
139
  <Render width={1080} height={1920}>
125
- <Clip duration="auto">
126
- <Animate
127
- image={Image({ prompt: "friendly robot, blue metallic", aspectRatio: "9:16" })}
128
- motion="robot talking, subtle head movements"
140
+ <Clip duration={5}>
141
+ <Video
142
+ prompt={{ text: "robot talking, subtle head movements", images: [robot] }}
129
143
  model={fal.videoModel("wan-2.5")}
130
144
  />
131
- <Speech voice="adam" model={elevenlabs.speechModel("turbo")}>
132
- Hello! I'm your AI assistant. Let's create something amazing!
133
- </Speech>
134
145
  </Clip>
135
- </Render>,
136
- { output: "output/talking-robot.mp4" }
146
+ <Captions src={voiceover} style="tiktok" />
147
+ </Render>
137
148
  );
138
149
  ```
139
150
 
140
- See [references/templates.md](references/templates.md) for more templates.
151
+
141
152
 
142
153
  ## Running Videos
143
154
 
144
155
  ```bash
145
- bun run your-video.tsx
156
+ bunx vargai render your-video.tsx
146
157
  ```
147
158
 
148
159
  ## Key Components
@@ -190,7 +201,7 @@ const character = Image({ prompt: "blue robot" });
190
201
 
191
202
  ## Troubleshooting
192
203
 
193
- ### "FAL_API_KEY not found"
204
+ ### "FAL_KEY not found"
194
205
  - Check `.env` file exists in project root
195
206
  - Ensure no spaces around `=` sign
196
207
  - Restart terminal after adding keys
@@ -207,7 +218,7 @@ const character = Image({ prompt: "blue robot" });
207
218
 
208
219
  ## Next Steps
209
220
 
210
- 1. Run `bun scripts/setup.ts` to initialize project
211
- 2. Add your FAL_API_KEY to `.env`
212
- 3. Run `bun run examples/my-first-video.tsx`
221
+ 1. Run `bunx vargai init` to initialize project
222
+ 2. Add your FAL_KEY to `.env`
223
+ 3. Run `bunx vargai render hello.tsx`
213
224
  4. Or ask the agent: "create a 10 second tiktok video about cats"
@@ -2,7 +2,8 @@ import { existsSync, mkdirSync, writeFileSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
  import { defineCommand } from "citty";
4
4
 
5
- const HELLO_TEMPLATE = `import { Render, Clip, Image, Video, assets } from "vargai/react";
5
+ const HELLO_TEMPLATE = `/** @jsxImportSource vargai */
6
+ import { Render, Clip, Image, Video, assets } from "vargai/react";
6
7
  import { fal } from "vargai/ai";
7
8
 
8
9
  const girl = Image({
@@ -35,7 +35,8 @@ const log = {
35
35
  ),
36
36
  };
37
37
 
38
- const HELLO_TEMPLATE = `import { Render, Clip, Image, Video, assets } from "vargai/react";
38
+ const HELLO_TEMPLATE = `/** @jsxImportSource vargai */
39
+ import { Render, Clip, Image, Video, assets } from "vargai/react";
39
40
  import { fal } from "vargai/ai";
40
41
 
41
42
  const girl = Image({
@@ -78,7 +79,7 @@ license: MIT
78
79
  metadata:
79
80
  author: vargHQ
80
81
  version: "1.0.0"
81
- compatibility: Requires bun runtime. FAL_API_KEY required. Optional ELEVENLABS_API_KEY, REPLICATE_API_TOKEN, GROQ_API_KEY
82
+ compatibility: Requires bun runtime. FAL_KEY required. Optional ELEVENLABS_API_KEY, REPLICATE_API_TOKEN, GROQ_API_KEY
82
83
  allowed-tools: Bash(bun:*) Bash(cat:*) Read Write Edit
83
84
  ---
84
85
 
@@ -101,10 +102,10 @@ Before generating videos, ensure the user has the required API keys configured.
101
102
  Run this command to check existing configuration:
102
103
 
103
104
  \`\`\`bash
104
- cat .env 2>/dev/null | grep -E "^(FAL_API_KEY|ELEVENLABS_API_KEY|REPLICATE_API_TOKEN|GROQ_API_KEY)=" || echo "No API keys found in .env"
105
+ cat .env 2>/dev/null | grep -E "^(FAL_KEY|ELEVENLABS_API_KEY|REPLICATE_API_TOKEN|GROQ_API_KEY)=" || echo "No API keys found in .env"
105
106
  \`\`\`
106
107
 
107
- ### Required: FAL_API_KEY
108
+ ### Required: FAL_KEY
108
109
 
109
110
  **This is the minimum requirement for video generation.**
110
111
 
@@ -115,7 +116,7 @@ cat .env 2>/dev/null | grep -E "^(FAL_API_KEY|ELEVENLABS_API_KEY|REPLICATE_API_T
115
116
  | Free tier | Yes (limited credits) |
116
117
  | Used for | Image generation (Flux), Video generation (Wan 2.5, Kling) |
117
118
 
118
- If user doesn't have \`FAL_API_KEY\`:
119
+ If user doesn't have \`FAL_KEY\`:
119
120
  1. Direct them to https://fal.ai/dashboard/keys
120
121
  2. They need to create an account and generate an API key
121
122
  3. Add to \`.env\` file in project root
@@ -174,7 +175,7 @@ const ENV_TEMPLATE = `# Varg AI Video Generation - API Keys
174
175
 
175
176
  # REQUIRED - Fal.ai (image & video generation)
176
177
  # Get it: https://fal.ai/dashboard/keys
177
- FAL_API_KEY=
178
+ FAL_KEY=
178
179
 
179
180
  # OPTIONAL - ElevenLabs (music & voice)
180
181
  # Get it: https://elevenlabs.io/app/settings/api-keys
@@ -251,7 +252,7 @@ ${COLORS.bold}AI Video Generation Setup${COLORS.reset}
251
252
  }
252
253
  }
253
254
 
254
- // Step 2: Check/create .env and prompt for FAL_API_KEY
255
+ // Step 2: Check/create .env and prompt for FAL_KEY
255
256
  log.step("Checking API keys");
256
257
 
257
258
  const envPath = join(cwd, ".env");
@@ -260,12 +261,12 @@ ${COLORS.bold}AI Video Generation Setup${COLORS.reset}
260
261
 
261
262
  if (existsSync(envPath)) {
262
263
  envContent = readFileSync(envPath, "utf8");
263
- hasFalKey = /^FAL_API_KEY=.+/m.test(envContent);
264
+ hasFalKey = /^FAL_KEY=.+/m.test(envContent);
264
265
 
265
266
  if (hasFalKey) {
266
- log.success("FAL_API_KEY found in .env");
267
+ log.success("FAL_KEY found in .env");
267
268
  } else {
268
- log.warn("FAL_API_KEY not found in .env");
269
+ log.warn("FAL_KEY not found in .env");
269
270
  }
270
271
 
271
272
  const hasElevenLabs = /^ELEVENLABS_API_KEY=.+/m.test(envContent);
@@ -282,12 +283,12 @@ ${COLORS.bold}AI Video Generation Setup${COLORS.reset}
282
283
 
283
284
  if (!hasFalKey) {
284
285
  console.log(`
285
- ${COLORS.yellow}FAL_API_KEY is required for video generation.${COLORS.reset}
286
+ ${COLORS.yellow}FAL_KEY is required for video generation.${COLORS.reset}
286
287
 
287
288
  Get your free API key at: ${COLORS.cyan}https://fal.ai/dashboard/keys${COLORS.reset}
288
289
  `);
289
290
 
290
- process.stdout.write("Enter your FAL_API_KEY (or press Enter to skip): ");
291
+ process.stdout.write("Enter your FAL_KEY (or press Enter to skip): ");
291
292
 
292
293
  const falKey = await new Promise<string>((resolve) => {
293
294
  process.stdin.setEncoding("utf8");
@@ -298,17 +299,17 @@ Get your free API key at: ${COLORS.cyan}https://fal.ai/dashboard/keys${COLORS.re
298
299
 
299
300
  if (falKey) {
300
301
  if (existsSync(envPath)) {
301
- const newEnvContent = envContent.includes("FAL_API_KEY")
302
- ? envContent.replace(/^FAL_API_KEY=.*/m, `FAL_API_KEY=${falKey}`)
303
- : `${envContent}\nFAL_API_KEY=${falKey}`;
302
+ const newEnvContent = envContent.includes("FAL_KEY")
303
+ ? envContent.replace(/^FAL_KEY=.*/m, `FAL_KEY=${falKey}`)
304
+ : `${envContent}\nFAL_KEY=${falKey}`;
304
305
  writeFileSync(envPath, newEnvContent);
305
306
  } else {
306
307
  writeFileSync(
307
308
  envPath,
308
- ENV_TEMPLATE.replace("FAL_API_KEY=", `FAL_API_KEY=${falKey}`),
309
+ ENV_TEMPLATE.replace("FAL_KEY=", `FAL_KEY=${falKey}`),
309
310
  );
310
311
  }
311
- log.success("FAL_API_KEY saved to .env");
312
+ log.success("FAL_KEY saved to .env");
312
313
  hasFalKey = true;
313
314
  } else {
314
315
  if (!existsSync(envPath)) {
@@ -394,7 +395,7 @@ ${COLORS.bold}Next steps:${COLORS.reset}
394
395
  `);
395
396
 
396
397
  if (!hasFalKey) {
397
- console.log(` ${COLORS.yellow}1. Add FAL_API_KEY to .env${COLORS.reset}
398
+ console.log(` ${COLORS.yellow}1. Add FAL_KEY to .env${COLORS.reset}
398
399
  Get it at: https://fal.ai/dashboard/keys
399
400
  `);
400
401
  }