This page provides complete context for AI agents (Claude, GPT, Cursor, etc.) to help users create videos with varg. If you’re a human, you might prefer the Quickstart guide.
What is varg?
varg is a JSX-based AI video generation platform. Users write React-like code to describe video compositions, and varg handles AI generation (images, video, voice, music) and final video rendering. Everything goes through one API (api.varg.ai), one API key. For the best agent experience, install the varg skill which includes 10 reference docs, setup scripts, and auto-update:Required Environment
Two Rendering Modes
Minimal Working Example (Local Render)
bunx vargai render video.tsx --verbose
Minimal Working Example (Cloud Render)
Cloud render uses
fal.*Model() syntax — globals are auto-injected. Local render uses varg.*Model() via createVarg().All Components
Critical:
Image(), Video(), Speech() are function calls that return references. <Music>, <Captions>, <Title> are JSX components. Never write <Image prompt="..." />.
All AI Models
Image Models
Video Models
Lipsync Models
Audio Models
Voices
Import Statement (Local Render)
Common Patterns
Character Consistency
Transitions Between Clips
Caption Styles
Zoom Effects
Aspect Ratios
Template: Simple Slideshow
Template: Talking Character
Template: Before/After Transformation
Media Processing (FFmpeg)
Cloud-hosted FFmpeg for video manipulation — no local install needed. One endpoint (POST /v2/ffmpeg), the operation is selected by the model field. All operations return a job — poll GET /v2/jobs/{id} until completed.
Probe
Inspect a video or audio file — returns metadata synchronously (not a job).{ url, media_type, width, height, duration_ms, duration, metadata }
Trim
Cut a segment. Providestart + either end or duration. Set precise: true for frame-accurate cuts.
Resize
Scale to new dimensions. At least one ofwidth/height required. Fit modes: cover (default, crop overflow), contain (letterbox), stretch.
Slice
Split a video into segments. Modes:every (interval), at (timestamps), count (equal parts), ranges (explicit ranges).
Custom FFmpeg Command
Run any FFmpeg command. Use{{in_N}}/{{out_N}} placeholders mapped through input_files/output_files.
output.outputs[] on the completed job.
Common Errors and Solutions
CLI Commands
Cost Reference
1 credit = 1 cent. Cache hits are always free.
Typical 3-clip video: $2-5. Discover models and routes (no auth):
GET https://api.varg.ai/v2/models (filter with ?tool=video). Live price catalog (no auth): GET https://api.varg.ai/v2/pricing. Price any request without running it: POST https://api.varg.ai/v2/estimate — the response includes resolved_model_key, the exact route the request would run on.
File Structure
Tips for Best Results
- One API key: Use
VARG_API_KEYwithcreateVarg()— no need for individual provider keys - Character consistency: Use
soulfor characters, or generate once withnano-banana-proand reference in all scenes - Video quality:
kling-v3for best quality,wan-2.5for characters - Lipsync: Works best with frontal face, clear audio, 5-10 second clips
- Caching: Same props = instant $0. Even slightly different prompt = full regeneration
- Music volume: Keep at 0.1-0.3 for background, voices at 1.0
- Duration: kling-v3 needs integer 3-15s. kling-v2.5 needs exactly 5 or 10. seedance_2 accepts integer 4-15 (fal routes also accept “auto”).