sdk

vargHQApache-2.0活跃维护

用 JSX 声明式描述视频,统一调用 Kling、Flux、ElevenLabs、Veed 等模型生成视频、图像和配音,省去逐个对接各家 API 的麻烦。

AI video generation SDK — JSX for videos. One API for Kling, Flux, ElevenLabs, Veed. Built on Vercel AI SDK.

cli-v0.21.0发布于 2026-11-01 00:59 UTC343star +2 / 7 天24fork同步于 2026-11-10 18:02 UTC

怎么上手

由 README 提炼,执行前请确认
bun install vargai ai
bunx vargai init
export VARG_API_KEY=varg_live_xxx
硬件要求按 README 说明

README 未说明显存或 GPU 要求,渲染走本地或 varg 云端,模型推理由远端 API 完成

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

用 JSX 声明式组合 AI 视频的 TypeScript SDK,一个 API Key 打通 Kling、Flux、ElevenLabs 等模型

用 JSX 声明式描述视频,统一调用 Kling、Flux、ElevenLabs、Veed 等模型生成视频、图像和配音,省去逐个对接各家 API 的麻烦。

核心能力

  • 用 <Clip>/<Video>/<Music>/<Captions> 等 JSX 组件拼装视频
  • 单一 VARG_API_KEY 路由到 Kling、Flux、ElevenLabs、Wan 等多家模型
  • 相同 props 命中缓存,重渲染不再重复计费
  • 提供 67 种 GL 转场与 tiktok、karaoke 等字幕样式
  • 支持本地 render() 或云端 POST /v2/render 渲染

容易踩的坑

JSX/TSX 视频 API 已废弃,CLI 不再渲染,需自行调用 render() 或改用 varg API/MCP 工具;必须设置 VARG_API_KEY,否则无法调用任何模型;SDK 命令(init、run、list)需在 Bun 下运行

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本cli-v0.21.0
  1. cli-v0.21.0vargai CLI 0.21.0最新正式版2026-11-01 · 2026-11-01 00:59 UTC

    The standalone vargai CLI 0.21.0: skills search and install without a key, and every varg MCP tool with one. One file, no Node or Bun needed.

    curl -fsSL https://varg.ai/install | sh      # macOS, Linux
    irm https://varg.ai/install.ps1 | iex        # Windows
    vargai search "captions for reels"
    

    Update: vargai update. Every file is in SHA256SUMS, signed in SHA256SUMS.sig (ECDSA P-256); the installers and vargai update check both. SDK commands (vargai init, run…) run the vargai package with Bun.

  2. cli-v0.20.0vargai CLI 0.20.02026-10-31 · 2026-10-31 06:57 UTC
    查看更新说明

    The standalone vargai CLI 0.20.0: skills search and install without a key, and every varg MCP tool with one. One file, no Node or Bun needed.

    curl -fsSL https://varg.ai/install | sh      # macOS, Linux
    irm https://varg.ai/install.ps1 | iex        # Windows
    vargai search "captions for reels"
    

    Update: vargai update. SDK commands (vargai render, init, studio…) run the vargai package with Bun.

  3. cli-v0.18.1vargai CLI 0.18.12026-10-31 · 2026-10-31 00:55 UTC
    查看更新说明

    The standalone vargai CLI 0.18.1: skills search and install without a key, and every varg MCP tool with one. One file, no Node or Bun needed.

    curl -fsSL https://varg.ai/install | sh      # macOS, Linux
    irm https://varg.ai/install.ps1 | iex        # Windows
    vargai search "captions for reels"
    

    Update: vargai update. SDK commands (vargai render, init, studio…) run the vargai package with Bun.

  4. cli-v0.17.1vargai CLI 0.17.12026-10-30 · 2026-10-30 06:37 UTC
    查看更新说明

    The standalone vargai CLI 0.17.1: skills search and install without a key, and every varg MCP tool with one. One file, no Node or Bun needed.

    curl -fsSL https://varg.ai/install | sh      # macOS, Linux
    irm https://varg.ai/install.ps1 | iex        # Windows
    vargai search "captions for reels"
    

    Update: vargai update. SDK commands (vargai render, init, studio…) run the vargai package with Bun.

  5. cli-v0.18.0vargai CLI 0.18.02026-10-30 · 2026-10-30 06:37 UTC
    查看更新说明

    The standalone vargai CLI 0.18.0: skills search and install without a key, and every varg MCP tool with one. One file, no Node or Bun needed.

    curl -fsSL https://varg.ai/install | sh      # macOS, Linux
    irm https://varg.ai/install.ps1 | iex        # Windows
    vargai search "captions for reels"
    

    Update: vargai update. SDK commands (vargai render, init, studio…) run the vargai package with Bun.

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    [!WARNING] JSX/TSX videos are deprecated. vargai/react (<Render>, <Clip>, <Video>…), vargai/studio and the JSX runtime still work but get no new features, and render() prints a DeprecationWarning (code VARGAI_JSX). The CLI no longer renders: vargai render, preview, frame, storyboard, studio and hello were removed.

    Generate with the varg API or the varg MCP tools and edit with the ffmpeg tool, from the terminal:

    curl -fsSL https://varg.ai/install | sh
    vargai login
    vargai generate_video --prompt "waves at dusk" --duration 5
    vargai get_tool ffmpeg          # the ffmpeg tool's input, for call_tool
    

    The rest of this README describes the deprecated JSX API.

    varg is an open-source TypeScript SDK for AI video generation. One API key, one API — generate images, video, speech, music, lipsync, and captions through varg.* providers. Write videos as JSX components (like React), render locally or in the cloud.

    Get started

    For AI agents (recommended)

    Install the varg skill into Claude Code, Cursor, Windsurf, or any agent that supports skills. Zero code — just prompt.

    # 1. Install the varg skill
    npx -y skills add vargHQ/skills --all --copy -y
    
    # 2. Set your API key (get one at app.varg.ai)
    export VARG_API_KEY=varg_live_xxx
    
    # 3. Create your first video
    claude "create a 10-second product video for white sneakers, 9:16, UGC style, with captions and background music"
    

    The agent writes declarative JSX, varg handles AI generation + caching + rendering.

    For developers

    # Install with bun (recommended)
    bun install vargai ai
    
    # Or with npm
    npm install vargai ai
    
    # Set up project (auth, skills, cache dirs)
    bunx vargai init
    

    vargai init signs you in, installs the agent skill and sets up your project structure.

    Or ask your AI agent to create something from scratch.

    How it works

    Your prompt / JSX code
            |
       varg API (api.varg.ai/v2)
       /     |      \        \
     Kling  Flux  ElevenLabs  Wan ...   (AI providers)
       \     |      /        /
        varg render engine
            |
       output.mp4
    
    • One API key (VARG_API_KEY) routes to all providers through the varg API
    • Declarative JSX — compose videos like React components with <Clip>, <Video>, <Music>, <Captions>
    • Automatic caching — same props = instant cache hit at $0. Re-render without re-generating
    • Local or cloud — render with render() from vargai/react locally, or submit via the cloud render endpoint (POST https://api.varg.ai/v2/render)

    Quick examples

    Image to video

    /** @jsxImportSource vargai */
    import { Render, Clip, Image, Video } from "vargai/react";
    import { varg } from "vargai/ai";
    
    const character = Image({
      prompt: "cute kawaii orange cat, round body, big eyes, Pixar style",
      model: varg.imageModel("nano-banana-pro"),
      aspectRatio: "9:16",
    });
    
    export default (
      <Render width={1080} height={1920}>
        <Clip duration={5}>
          <Video
            prompt={{ text: "cat waves hello, bounces happily", images: [character] }}
            model={varg.videoModel("kling-v3")}
          />
        </Clip>
      </Render>
    );
    
    // render.ts — the CLI no longer renders, so call render() yourself.
    // hello.tsx needs the JSX pragma on its first line (see above).
    import { render } from "vargai/react";
    import video from "./hello.tsx";
    await render(video, { output: "output/hello.mp4" });
    

    With music and captions

    import { Render, Clip, Image, Video, Speech, Captions, Music } from "vargai/react";
    import { varg } from "vargai/ai";
    
    const character = Image({
      model: varg.imageModel("nano-banana-pro"),
      prompt: "friendly robot, blue metallic, expressive eyes",
      aspectRatio: "9:16",
    });
    
    const voiceover = Speech({
      model: varg.speechModel("eleven_v3"),
      voice: "adam",
      children: "Hello! I'm your AI assistant. Let me show you something cool!",
    });
    
    export default (
      <Render width={1080} height={1920}>
        <Music prompt="upbeat electronic, cheerful" model={varg.musicModel()} volume={0.15} />
        <Clip duration={5}>
          <Video
            prompt={{ text: "robot talking, subtle head movements", images: [character] }}
            model={varg.videoModel("kling-v3")}
          />
        </Clip>
        <Captions src={voiceover} style="tiktok" color="#ffffff" withAudio />
      </Render>
    );
    

    Talking head with lipsync

    import { Render, Clip, Image, Video, Speech, Captions, Music } from "vargai/react";
    import { varg } from "vargai/ai";
    
    const voiceover = Speech({
      model: varg.speechModel("eleven_v3"),
      voice: "josh",
      children: "With varg, you can create any videos at scale!",
    });
    
    const baseCharacter = Image({
      prompt: "woman, sleek black bob hair, fitted black t-shirt, natural look",
      model: varg.imageModel("nano-banana-pro"),
      aspectRatio: "9:16",
    });
    
    const animatedCharacter = Video({
      prompt: {
        text: "woman speaking naturally, subtle head movements, friendly expression",
        images: [baseCharacter],
      },
      model: varg.videoModel("kling-v3"),
    });
    
    export default (
      <Render width={1080} height={1920}>
        <Music prompt="modern tech ambient, subtle electronic" model={varg.musicModel()} volume={0.1} />
        <Clip duration={5}>
          <Video
            prompt={{ video: animatedCharacter, audio: voiceover }}
            model={varg.videoModel("sync-v2-pro")}
          />
        </Clip>
        <Captions src={voiceover} style="tiktok" color="#ffffff" withAudio />
      </Render>
    );
    

    Components

    ComponentPurposeKey props
    <Render>Root containerwidth, height, fps
    <Clip>Time segmentduration, transition, cutFrom, cutTo
    <Image>AI or static imageprompt, src, model, zoom, aspectRatio, resize
    <Video>AI or source videoprompt, src, model, volume, cutFrom, cutTo
    <Speech>Text-to-speechvoice, model, volume, children
    <Music>Background musicprompt, src, model, volume, loop, ducking
    <Title>Text overlayposition, color, start, end
    <Subtitle>Subtitle textbackgroundColor
    <Captions>Auto-generated subssrc, srt, style, color, activeColor, withAudio
    <Overlay>Positioned layerleft, top, width, height, keepAudio
    <Split>Side-by-sidedirection
    <Slider>Before/after revealdirection
    <Swipe>Tinder-style cardsdirection, interval
    <TalkingHead>Animated charactercharacter, src, voice, model, lipsyncModel
    <Packshot>End card with CTAbackground, logo, cta, blinkCta

    Caption styles

    <Captions src={voiceover} style="tiktok" />     // word-by-word highlight
    <Captions src={voiceover} style="karaoke" />    // fill left-to-right
    <Captions src={voiceover} style="bounce" />     // words bounce in
    <Captions src={voiceover} style="typewriter" /> // typing effect
    

    Transitions

    67 GL transitions available:

    <Clip transition={{ name: "fade", duration: 0.5 }}>
    <Clip transition={{ name: "crossfade", duration: 0.5 }}>
    <Clip transition={{ name: "wipeleft", duration: 0.5 }}>
    <Clip transition={{ name: "cube", duration: 0.8 }}>
    

    Models

    All models are accessed through varg.* — one API key, one provider.

    import { varg } from "vargai/ai";
    

    Video

    ModelUse caseCredits (5s)
    varg.videoModel("kling-v3")Best quality, latest150
    varg.videoModel("kling-v3-standard")Good quality, cheaper50
    varg.videoModel("kling-v2.5")Previous gen, reliable50
    varg.videoModel("wan-2.5")Good for characters50
    varg.videoModel("minimax")Alternative50
    varg.videoModel("sync-v2-pro")Lipsync (video + audio)50

    Image

    ModelUse caseCredits
    varg.imageModel("nano-banana-pro")Versatile, fast5
    varg.imageModel("nano-banana-pro/edit")Image-to-image editing5
    varg.imageModel("flux-schnell")Fast generation5
    varg.imageModel("flux-pro")High quality25
    varg.imageModel("recraft-v3")Alternative10

    Audio

    ModelUse caseCredits
    varg.speechModel("eleven_v3")Text-to-speech25
    varg.speechModel("eleven_multilingual_v2")Multilingual TTS25
    varg.musicModel()Music generation25
    varg.transcriptionModel("whisper")Speech-to-text5

    1 credit = $0.01. Cache hits are always free.

    CLI

    bunx vargai login                              # sign in (email OTP or API key)
    bunx vargai init                               # set up project (auth + skills)
    bunx vargai balance                            # check credit balance
    bunx vargai topup                              # add credits
    bunx vargai run image --prompt "sunset"        # generate a single image
    bunx vargai run video --prompt "ocean waves"   # generate a single video
    bunx vargai list                               # list available models and actions
    

    Everything the varg MCP server does is a command too, tool for tool. The standalone vargai (one file, no Node or Bun) installs with:

    curl -fsSL https://varg.ai/install | sh        # macOS, Linux
    irm https://varg.ai/install.ps1 | iex          # Windows
    vargai update                                  # later: the latest release
    
    vargai search "captions for reels"             # varg how to: skills, guides, presets (no key)
    vargai install remotion-captions               # install a skill into your agent (no key)
    vargai version                                 # this version and the latest (no key)
    vargai tools                                   # every MCP tool; ○ = no key needed
    vargai login                                   # then: account, balance, every model
    vargai generate_image "a red fox"              # any MCP tool, options from its schema
    vargai help generate_video                     # a tool's options
    

    From the npm package (bunx vargai …) the same commands work as vargai mcp <tool>, and they use the installed binary when there is one. The SDK commands (init, run, list…) run on Bun either way. The CLI does not render JSX/TSX any more. Releases: cli-v*.

    Environment

    # Required — one key for everything
    VARG_API_KEY=varg_live_xxx
    

    Get your API key at app.varg.ai. Bun auto-loads .env files.

    You can use provider keys directly if you prefer:

    FAL_API_KEY=fal_xxx                # fal.ai direct
    ELEVENLABS_API_KEY=xxx             # ElevenLabs direct
    OPENAI_API_KEY=sk_xxx              # OpenAI / Sora
    REPLICATE_API_TOKEN=r8_xxx         # Replicate
    KREA_API_KEY=xxx                   # Krea direct (krea.imageModel("krea"))
    

    See the BYOK docs for details.

    Pricing

    ActionModelCreditsCost
    Imagenano-banana-pro5$0.05
    Imageflux-pro25$0.25
    Video (5s)kling-v3150$1.50
    Speecheleven_v325$0.25
    Musicmusic_v125$0.25
    Cache hitany0$0.00

    A typical 3-clip video costs $2-5. Cache hits are always free.

    Star History

    Discord

    https://discord.com/channels/1463766525117861922/1463766526250188824

    Contributing

    See CONTRIBUTING.md for development setup.

    License

    Apache-2.0 — see LICENSE.md