> ## Documentation Index
> Fetch the complete documentation index at: https://docs.varg.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Cursor Setup

> Configure Cursor for video generation with varg

Set up Cursor to create AI videos with varg.

## Prerequisites

* [Cursor](https://cursor.sh) installed
* A `VARG_API_KEY` — get one at [app.varg.ai](https://app.varg.ai)

## Setup

<Steps>
  <Step title="Install the varg skill">
    In your project directory:

    ```bash theme={null}
    npx -y skills add vargHQ/skills --all --copy -y
    ```

    This installs the varg skill with full context into Cursor's skills directory.
  </Step>

  <Step title="Set your API key">
    Create a `.env` file:

    ```bash theme={null}
    VARG_API_KEY=varg_xxx
    ```
  </Step>

  <Step title="Add docs reference (optional)">
    In Cursor settings, add the varg docs as a reference:

    ```
    https://docs.varg.ai
    ```

    This gives Cursor access to the full documentation when generating code.
  </Step>

  <Step title="Create a .cursorrules file">
    Add a `.cursorrules` file to your project root with the following content:

    ```text theme={null}
    # varg Video Generation Project

    ## About
    This project uses varg SDK for AI video generation.
    Videos are composed using JSX syntax.

    ## Setup
    - API key: VARG_API_KEY in .env
    - Render: bunx vargai render file.tsx --verbose
    - Preview: bunx vargai render file.tsx --preview (free)

    ## Key Concepts
    - Render - Root container (width, height, fps)
    - Clip - Time segment (duration, transitions)
    - Image() - Generate AI image (function call, not JSX)
    - Video() - Generate AI video (function call, not JSX)
    - Speech() - Text-to-speech (function call, not JSX)
    - Music - Background music (JSX component)
    - Captions - Subtitles synced to speech

    ## Import Pattern
    import { Render, Clip, Image, Video, Speech, Music, Captions } from "vargai/react"
    import { createVarg } from "vargai/ai"
    const varg = createVarg({ apiKey: process.env.VARG_API_KEY! })

    ## Common Models (via gateway)
    - Images: varg.imageModel("nano-banana-pro") or varg.imageModel("flux-pro")
    - Video: varg.videoModel("kling-v3") or varg.videoModel("wan-2.5")
    - Video (premium): varg.videoModel("seedance-2-preview") — ByteDance, 250cr, duration 5 or 10 only
    - Video (fast): varg.videoModel("seedance-2-fast-preview") — ByteDance, 150cr, duration 5 or 10 only
    - Speech: varg.speechModel("eleven_v3")
    - Music: varg.musicModel()
    - Lipsync: varg.videoModel("sync-v2-pro")
    - Characters: varg.imageModel("soul")

    ## Critical Rules
    1. Use function calls for media: Image(), Video(), Speech()
    2. Use JSX for composition: Clip, Render, Music
    3. Never write Image as JSX -- use Image({ prompt: "..." })
    4. One image per Video prompt
    5. kling-v3 duration: integer 3-15 seconds only
    6. Always set Music duration explicitly
    ```
  </Step>

  <Step title="Start creating">
    Open Cursor and try:

    * *"Create a 10-second vertical video of a cat dancing"*
    * *"Make a product showcase video for sneakers"*
    * *"Generate a talking head video with TikTok captions"*
  </Step>
</Steps>

## Example prompts for Cursor

### Quick video

```
Create a 5-second video of waves crashing on a beach.
Use 16:9 landscape format with cinematic lighting.
```

### Multi-scene

```
Create a 3-scene product video:
1. Product reveal with dramatic lighting
2. Close-up of product features
3. Packshot with "Shop Now" CTA

Add upbeat background music. Vertical 9:16 format.
```

### With voiceover

```
Create a talking character video. The character should be a friendly
young woman in casual clothes. She says:

"Hey guys! Today I'm reviewing the best coffee makers under $100.
Let me show you my top 3 picks."

Add TikTok-style captions and background music.
```

## Troubleshooting

### Type errors in TSX files

Make sure you have the vargai package installed:

```bash theme={null}
bun install vargai ai
```

### Cursor suggests wrong imports

The `.cursorrules` file should fix this. Make sure it specifies the gateway pattern:

```tsx theme={null}
import { createVarg } from "vargai/ai"
const varg = createVarg({ apiKey: process.env.VARG_API_KEY! })
```

### Slow completions

Cursor may take longer on first use while indexing the project. Subsequent suggestions are faster.

## Next steps

* Browse [Templates](/templates) for copy-paste examples
* Check [Components](/sdk/components) for all JSX components
* See [AI Models](/sdk/models) for the full model catalog
