Loading...
Loading...
Compare original and translation side by side
bash scripts/setup.sh| bun | ffmpeg | Mode |
|---|---|---|
| No | No | Cloud Render -- read cloud-render.md |
| Yes | No | Cloud Render -- read cloud-render.md |
| Yes | Yes | Local Render (recommended) -- read local-render.md |
VARG_API_KEYbash scripts/setup.sh| bun | ffmpeg | 渲染模式 |
|---|---|---|
| 否 | 否 | 云端渲染 -- 查看cloud-render.md |
| 是 | 否 | 云端渲染 -- 查看cloud-render.md |
| 是 | 是 | 本地渲染(推荐)-- 查看local-render.md |
VARG_API_KEYImage({...})<Clip><Image prompt="..." />Video({ prompt: { images: [img] } })providerOptions: { varg: {...} }falImage({...})<Clip><Image prompt="..." />Video({ prompt: { images: [img] } })providerOptions: { varg: {...} }falundefinedundefined
Full details: [cloud-render.md](references/cloud-render.md)
详细说明:[cloud-render.md](references/cloud-render.md)/** @jsxImportSource vargai */
import { Render, Clip, Image } from "vargai/react"
import { createVarg } from "@vargai/gateway"
const varg = createVarg({ apiKey: process.env.VARG_API_KEY! })
const img = Image({
model: varg.imageModel("nano-banana-pro"),
prompt: "a cabin in mountains at sunset",
aspectRatio: "16:9"
})
export default (
<Render width={1920} height={1080}>
<Clip duration={3}>{img}</Clip>
</Render>
)bunx vargai render video.tsx --preview # free preview
bunx vargai render video.tsx --verbose # full render (costs credits)/** @jsxImportSource vargai */
import { Render, Clip, Image } from "vargai/react"
import { createVarg } from "@vargai/gateway"
const varg = createVarg({ apiKey: process.env.VARG_API_KEY! })
const img = Image({
model: varg.imageModel("nano-banana-pro"),
prompt: "a cabin in mountains at sunset",
aspectRatio: "16:9"
})
export default (
<Render width={1920} height={1080}>
<Clip duration={3}>{img}</Clip>
</Render>
)bunx vargai render video.tsx --preview # 免费预览
bunx vargai render video.tsx --verbose # 完整渲染(消耗积分)curl -X POST https://api.varg.ai/v1/image \
-H "Authorization: Bearer $VARG_API_KEY" \
-d '{"model": "nano-banana-pro", "prompt": "a sunset over mountains"}'curl -X POST https://api.varg.ai/v1/image \
-H "Authorization: Bearer $VARG_API_KEY" \
-d '{"model": "nano-banana-pro", "prompt": "a sunset over mountains"}'// 1. GENERATE media via function calls
const img = Image({ model: ..., prompt: "..." })
const vid = Video({ model: ..., prompt: { text: "...", images: [img] }, duration: 5 })
const voice = Speech({ model: ..., voice: "rachel", children: "Hello!" })
// 2. COMPOSE via JSX tree
export default (
<Render width={1080} height={1920}>
<Music model={...} prompt="upbeat electronic" duration={10} volume={0.3} />
<Clip duration={5}>
{vid}
<Title position="bottom">Welcome</Title>
</Clip>
<Captions src={voice} style="tiktok" />
</Render>
)// 1. 通过函数调用生成媒体
const img = Image({ model: ..., prompt: "..." })
const vid = Video({ model: ..., prompt: { text: "...", images: [img] }, duration: 5 })
const voice = Speech({ model: ..., voice: "rachel", children: "Hello!" })
// 2. 通过JSX树进行合成
export default (
<Render width={1080} height={1920}>
<Music model={...} prompt="upbeat electronic" duration={10} volume={0.3} />
<Clip duration={5}>
{vid}
<Title position="bottom">Welcome</Title>
</Clip>
<Captions src={voice} style="tiktok" />
</Render>
)| Component | Type | Purpose |
|---|---|---|
| Function call | Generate still image |
| Function call | Generate video (text-to-video or image-to-video) |
| Function call | Text-to-speech audio |
| JSX | Root container -- sets width, height, fps |
| JSX | Timeline segment -- duration, transitions |
| JSX | Background audio (always set |
| JSX | Subtitle track from Speech |
| JSX | Text overlay |
| JSX | Positioned layer |
| JSX | Layout helpers |
| 组件 | 类型 | 用途 |
|---|---|---|
| 函数调用 | 生成静态图像 |
| 函数调用 | 生成视频(文本转视频或图像转视频) |
| 函数调用 | 文本转语音音频 |
| JSX | 根容器 -- 设置宽度、高度、帧率 |
| JSX | 时间轴片段 -- 时长、转场效果 |
| JSX | 背景音频(务必设置 |
| JSX | 基于Speech生成的字幕轨道 |
| JSX | 文本叠加层 |
| JSX | 定位图层 |
| JSX | 布局辅助组件 |
| Cloud Render | Local Render |
|---|---|
| No imports needed | |
| |
| |
| |
| Globals are auto-injected | Must call |
| 云端渲染 | 本地渲染 |
|---|---|
| 无需导入 | |
| |
| |
| |
| 全局变量自动注入 | 必须调用 |
--preview--preview| Need | Reference | When to load |
|---|---|---|
| Render via API | cloud-render.md | No bun/ffmpeg, or user wants cloud rendering |
| Render locally | local-render.md | bun + ffmpeg available |
| Patterns & workflows | recipes.md | Talking head, character consistency, slideshow, lipsync |
| Model selection | models.md | Choosing models, checking prices, duration constraints |
| Component props | components.md | Need detailed props for any component |
| Better prompts | prompting.md | User wants cinematic / high-quality results |
| REST API | gateway-api.md | Single-asset generation or Render API details |
| Debugging | common-errors.md | Something failed or produced unexpected results |
| Full examples | templates.md | Need complete copy-paste-ready templates |
| 需求 | 参考文档 | 加载时机 |
|---|---|---|
| 通过API渲染 | cloud-render.md | 无bun/ffmpeg,或用户需要云端渲染 |
| 本地渲染 | local-render.md | 已安装bun + ffmpeg |
| 模式与工作流 | recipes.md | 制作虚拟主播、角色一致性、幻灯片、唇形同步 |
| 模型选择 | models.md | 选择模型、查看定价、时长限制 |
| 组件属性 | components.md | 需要任何组件的详细属性说明 |
| 提示词优化 | prompting.md | 用户需要电影级/高质量结果 |
| REST API | gateway-api.md | 单一资产生成或渲染API细节 |
| 调试 | common-errors.md | 出现失败或意外结果 |
| 完整示例 | templates.md | 需要可直接复制使用的完整模板 |