vargai 0.4.0-alpha21 → 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
|
@@ -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.
|
|
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.
|
|
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
|
-
|
|
18
|
+
Initialize a new project:
|
|
19
19
|
|
|
20
20
|
```bash
|
|
21
|
-
|
|
21
|
+
bunx vargai init
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
Or
|
|
24
|
+
Or just create hello.tsx starter:
|
|
25
25
|
|
|
26
26
|
```bash
|
|
27
|
-
|
|
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
|
-
###
|
|
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 `
|
|
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: `
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
104
|
+
/** @jsxImportSource vargai */
|
|
105
|
+
import { Render, Clip, Image, Video, Music } from "vargai/react";
|
|
99
106
|
import { fal, elevenlabs } from "vargai/ai";
|
|
100
107
|
|
|
101
|
-
|
|
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()}
|
|
112
|
+
<Music prompt="upbeat electronic" model={elevenlabs.musicModel()} />
|
|
104
113
|
<Clip duration={5}>
|
|
105
|
-
<
|
|
106
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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=
|
|
126
|
-
<
|
|
127
|
-
|
|
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
|
-
|
|
136
|
-
|
|
146
|
+
<Captions src={voiceover} style="tiktok" />
|
|
147
|
+
</Render>
|
|
137
148
|
);
|
|
138
149
|
```
|
|
139
150
|
|
|
140
|
-
|
|
151
|
+
|
|
141
152
|
|
|
142
153
|
## Running Videos
|
|
143
154
|
|
|
144
155
|
```bash
|
|
145
|
-
|
|
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
|
-
### "
|
|
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 `
|
|
211
|
-
2. Add your
|
|
212
|
-
3. Run `
|
|
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"
|
|
@@ -79,7 +79,7 @@ license: MIT
|
|
|
79
79
|
metadata:
|
|
80
80
|
author: vargHQ
|
|
81
81
|
version: "1.0.0"
|
|
82
|
-
compatibility: Requires bun runtime.
|
|
82
|
+
compatibility: Requires bun runtime. FAL_KEY required. Optional ELEVENLABS_API_KEY, REPLICATE_API_TOKEN, GROQ_API_KEY
|
|
83
83
|
allowed-tools: Bash(bun:*) Bash(cat:*) Read Write Edit
|
|
84
84
|
---
|
|
85
85
|
|
|
@@ -102,10 +102,10 @@ Before generating videos, ensure the user has the required API keys configured.
|
|
|
102
102
|
Run this command to check existing configuration:
|
|
103
103
|
|
|
104
104
|
\`\`\`bash
|
|
105
|
-
cat .env 2>/dev/null | grep -E "^(
|
|
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"
|
|
106
106
|
\`\`\`
|
|
107
107
|
|
|
108
|
-
### Required:
|
|
108
|
+
### Required: FAL_KEY
|
|
109
109
|
|
|
110
110
|
**This is the minimum requirement for video generation.**
|
|
111
111
|
|
|
@@ -116,7 +116,7 @@ cat .env 2>/dev/null | grep -E "^(FAL_API_KEY|ELEVENLABS_API_KEY|REPLICATE_API_T
|
|
|
116
116
|
| Free tier | Yes (limited credits) |
|
|
117
117
|
| Used for | Image generation (Flux), Video generation (Wan 2.5, Kling) |
|
|
118
118
|
|
|
119
|
-
If user doesn't have \`
|
|
119
|
+
If user doesn't have \`FAL_KEY\`:
|
|
120
120
|
1. Direct them to https://fal.ai/dashboard/keys
|
|
121
121
|
2. They need to create an account and generate an API key
|
|
122
122
|
3. Add to \`.env\` file in project root
|
|
@@ -175,7 +175,7 @@ const ENV_TEMPLATE = `# Varg AI Video Generation - API Keys
|
|
|
175
175
|
|
|
176
176
|
# REQUIRED - Fal.ai (image & video generation)
|
|
177
177
|
# Get it: https://fal.ai/dashboard/keys
|
|
178
|
-
|
|
178
|
+
FAL_KEY=
|
|
179
179
|
|
|
180
180
|
# OPTIONAL - ElevenLabs (music & voice)
|
|
181
181
|
# Get it: https://elevenlabs.io/app/settings/api-keys
|
|
@@ -252,7 +252,7 @@ ${COLORS.bold}AI Video Generation Setup${COLORS.reset}
|
|
|
252
252
|
}
|
|
253
253
|
}
|
|
254
254
|
|
|
255
|
-
// Step 2: Check/create .env and prompt for
|
|
255
|
+
// Step 2: Check/create .env and prompt for FAL_KEY
|
|
256
256
|
log.step("Checking API keys");
|
|
257
257
|
|
|
258
258
|
const envPath = join(cwd, ".env");
|
|
@@ -261,12 +261,12 @@ ${COLORS.bold}AI Video Generation Setup${COLORS.reset}
|
|
|
261
261
|
|
|
262
262
|
if (existsSync(envPath)) {
|
|
263
263
|
envContent = readFileSync(envPath, "utf8");
|
|
264
|
-
hasFalKey = /^
|
|
264
|
+
hasFalKey = /^FAL_KEY=.+/m.test(envContent);
|
|
265
265
|
|
|
266
266
|
if (hasFalKey) {
|
|
267
|
-
log.success("
|
|
267
|
+
log.success("FAL_KEY found in .env");
|
|
268
268
|
} else {
|
|
269
|
-
log.warn("
|
|
269
|
+
log.warn("FAL_KEY not found in .env");
|
|
270
270
|
}
|
|
271
271
|
|
|
272
272
|
const hasElevenLabs = /^ELEVENLABS_API_KEY=.+/m.test(envContent);
|
|
@@ -283,12 +283,12 @@ ${COLORS.bold}AI Video Generation Setup${COLORS.reset}
|
|
|
283
283
|
|
|
284
284
|
if (!hasFalKey) {
|
|
285
285
|
console.log(`
|
|
286
|
-
${COLORS.yellow}
|
|
286
|
+
${COLORS.yellow}FAL_KEY is required for video generation.${COLORS.reset}
|
|
287
287
|
|
|
288
288
|
Get your free API key at: ${COLORS.cyan}https://fal.ai/dashboard/keys${COLORS.reset}
|
|
289
289
|
`);
|
|
290
290
|
|
|
291
|
-
process.stdout.write("Enter your
|
|
291
|
+
process.stdout.write("Enter your FAL_KEY (or press Enter to skip): ");
|
|
292
292
|
|
|
293
293
|
const falKey = await new Promise<string>((resolve) => {
|
|
294
294
|
process.stdin.setEncoding("utf8");
|
|
@@ -299,17 +299,17 @@ Get your free API key at: ${COLORS.cyan}https://fal.ai/dashboard/keys${COLORS.re
|
|
|
299
299
|
|
|
300
300
|
if (falKey) {
|
|
301
301
|
if (existsSync(envPath)) {
|
|
302
|
-
const newEnvContent = envContent.includes("
|
|
303
|
-
? envContent.replace(/^
|
|
304
|
-
: `${envContent}\
|
|
302
|
+
const newEnvContent = envContent.includes("FAL_KEY")
|
|
303
|
+
? envContent.replace(/^FAL_KEY=.*/m, `FAL_KEY=${falKey}`)
|
|
304
|
+
: `${envContent}\nFAL_KEY=${falKey}`;
|
|
305
305
|
writeFileSync(envPath, newEnvContent);
|
|
306
306
|
} else {
|
|
307
307
|
writeFileSync(
|
|
308
308
|
envPath,
|
|
309
|
-
ENV_TEMPLATE.replace("
|
|
309
|
+
ENV_TEMPLATE.replace("FAL_KEY=", `FAL_KEY=${falKey}`),
|
|
310
310
|
);
|
|
311
311
|
}
|
|
312
|
-
log.success("
|
|
312
|
+
log.success("FAL_KEY saved to .env");
|
|
313
313
|
hasFalKey = true;
|
|
314
314
|
} else {
|
|
315
315
|
if (!existsSync(envPath)) {
|
|
@@ -395,7 +395,7 @@ ${COLORS.bold}Next steps:${COLORS.reset}
|
|
|
395
395
|
`);
|
|
396
396
|
|
|
397
397
|
if (!hasFalKey) {
|
|
398
|
-
console.log(` ${COLORS.yellow}1. Add
|
|
398
|
+
console.log(` ${COLORS.yellow}1. Add FAL_KEY to .env${COLORS.reset}
|
|
399
399
|
Get it at: https://fal.ai/dashboard/keys
|
|
400
400
|
`);
|
|
401
401
|
}
|