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

# Build an AI Video Generation Pipeline

> Generate, manage, and download AI videos using Veo, Kling, and Seedance through the Runcrate API.

export const RuncrateStyles = () => {
  if (typeof document !== 'undefined' && !document.getElementById('runcrate-overrides')) {
    const s = document.createElement('style');
    s.id = 'runcrate-overrides';
    s.textContent = `
      /* Match Runcrate's rounding scale (--radius: 0.75rem) */
      .rounded-sm { border-radius: 0.5rem !important; }   /* 8px */
      .rounded-md { border-radius: 0.625rem !important; } /* 10px */
      .rounded-lg { border-radius: 0.75rem !important; }  /* 12px */
      .rounded-l-sm { border-top-left-radius: 0.5rem !important; border-bottom-left-radius: 0.5rem !important; }
      .rounded-r-sm { border-top-right-radius: 0.5rem !important; border-bottom-right-radius: 0.5rem !important; }
      .rounded-l-md { border-top-left-radius: 0.625rem !important; border-bottom-left-radius: 0.625rem !important; }
      .rounded-r-md { border-top-right-radius: 0.625rem !important; border-bottom-right-radius: 0.625rem !important; }
      .rounded-l-lg { border-top-left-radius: 0.75rem !important; border-bottom-left-radius: 0.75rem !important; }
      .rounded-r-lg { border-top-right-radius: 0.75rem !important; border-bottom-right-radius: 0.75rem !important; }

      /* Cards: never pure white in light mode */
      .card { background-color: #fcfcfc !important; border-radius: 0.75rem !important; }
      html.dark .card { background-color: #141414 !important; }

      /* Docs hero box */
      .rc-hero { background-color: #fcfcfc; border: 1px solid #e0e0e0; }
      html.dark .rc-hero { background-color: #141414; border-color: #242424; }
      html.dark .rc-hero h1 { color: #f5f5f5; }

      /* Runcrate scrollbar — thin, transparent track, hide-until-hover thumb */
      ::-webkit-scrollbar { width: 6px; height: 6px; background-color: transparent; }
      ::-webkit-scrollbar-track { background-color: transparent; }
      ::-webkit-scrollbar-thumb { background-color: rgba(155, 155, 155, 0.5); border-radius: 10px; transition: opacity 0.3s ease; opacity: 0; }
      ::-webkit-scrollbar-thumb:hover { background-color: rgba(155, 155, 155, 0.7); }
      *:hover::-webkit-scrollbar-thumb,
      *:focus::-webkit-scrollbar-thumb,
      *:active::-webkit-scrollbar-thumb { opacity: 1; }
      * { scrollbar-width: thin; scrollbar-color: rgba(155, 155, 155, 0.5) transparent; }
    `;
    document.head.appendChild(s);
  }
  return null;
};

<RuncrateStyles />

Generate production-quality AI videos using Veo 3, Kling v3, Seedance, and other models through a single API. This guide covers submitting jobs, polling for completion, downloading results, and building batch pipelines.

## What you'll build

A video generation pipeline that submits prompts to frontier video models, polls for completion, and downloads the MP4 results. Useful for marketing teams generating product videos, content creators building short-form video, or apps with AI video features.

## Available models

| Model             | Durations | Strengths                                               |
| ----------------- | --------- | ------------------------------------------------------- |
| **Veo 3.0**       | 4, 6, 8s  | Photorealistic 4K, native audio, broadcast-ready color  |
| **Veo 3.0 Audio** | 4, 6, 8s  | Video with generated synchronized audio                 |
| **Kling v3**      | 3–15s     | Best human motion, motion transfer from reference video |
| **Seedance**      | 2–12s     | Multi-input (up to 9 images + 3 videos + 3 audio files) |
| **Hailuo 02**     | 6, 10s    | Fast generation, good for prototyping                   |
| **Sora 2**        | 4, 8, 12s | Realistic physics simulation                            |

***

## Single video (Python SDK)

### The easy way: submit, poll, and save in one call

```python theme={"theme":"github-dark"}
from runcrate import Runcrate

client = Runcrate(api_key="rc_live_...")

job = client.models.generate_video_and_save(
    "product-hero.mp4",
    model="google/veo-3.0",
    prompt="Cinematic slow-motion shot of a premium headphone rotating on a matte black surface, "
           "studio lighting with soft reflections, shallow depth of field, 4K",
    duration=6,
    on_status=lambda j: print(f"  {j.status}..."),
)

print(f"Saved product-hero.mp4")
```

### The manual way: full lifecycle control

```python theme={"theme":"github-dark"}
from runcrate import Runcrate
import time

client = Runcrate(api_key="rc_live_...")

# Submit
job = client.models.generate_video(
    model="google/veo-3.0",
    prompt="Aerial drone shot tracking a car driving through autumn mountains at golden hour",
    duration=8,
)
print(f"Job {job.id} submitted")

# Poll
while job.status not in ("completed", "failed"):
    time.sleep(5)
    job = client.models.get_video_status(job.id)
    print(f"  Status: {job.status}")

if job.status == "failed":
    print(f"Failed: {job.error}")
else:
    # Download
    video_bytes = client.models.download_video(job.id)
    with open("drone-shot.mp4", "wb") as f:
        f.write(video_bytes)
    print("Saved drone-shot.mp4")
```

***

## Batch video generation (Python SDK)

Generate multiple videos in parallel for a product catalog or social media campaign:

```python theme={"theme":"github-dark"}
from runcrate import Runcrate
import time
from concurrent.futures import ThreadPoolExecutor

client = Runcrate(api_key="rc_live_...")

scenes = [
    {"file": "scene-1.mp4", "prompt": "Close-up of coffee being poured into a ceramic mug, steam rising, warm morning light", "duration": 4},
    {"file": "scene-2.mp4", "prompt": "Hands typing on a mechanical keyboard, shallow depth of field, office ambiance", "duration": 6},
    {"file": "scene-3.mp4", "prompt": "A person putting on wireless earbuds and walking through a city, cinematic tracking shot", "duration": 8},
]

def generate_scene(scene):
    print(f"Submitting: {scene['file']}")
    client.models.generate_video_and_save(
        scene["file"],
        model="google/veo-3.0",
        prompt=scene["prompt"],
        duration=scene["duration"],
        on_status=lambda j: print(f"  {scene['file']}: {j.status}"),
    )
    print(f"Done: {scene['file']}")

with ThreadPoolExecutor(max_workers=3) as pool:
    pool.map(generate_scene, scenes)

print("All scenes generated.")
```

***

## TypeScript SDK

```typescript theme={"theme":"github-dark"}
import Runcrate from '@runcrate/sdk';

const rc = new Runcrate({ apiKey: 'rc_live_...' });

// Submit a video job
const job = await rc.models.generateVideo({
  model: 'google/veo-3.0',
  prompt: 'A timelapse of a flower blooming in a garden, macro lens',
  duration: 6,
});

// Poll until done
let status = job;
while (status.status !== 'completed' && status.status !== 'failed') {
  await new Promise(r => setTimeout(r, 5000));
  status = await rc.models.getVideoStatus(job.id);
  console.log(`Status: ${status.status}`);
}

// Download
const videoBuffer = await rc.models.downloadVideo(job.id);
await Bun.write('flower-timelapse.mp4', videoBuffer);
```

***

## curl

```bash theme={"theme":"github-dark"}
# Submit
curl https://api.runcrate.ai/v1/videos \
  -H "Authorization: Bearer rc_live_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "google/veo-3.0",
    "prompt": "A cinematic sunrise over misty mountains",
    "duration": 6
  }'

# Poll (replace VIDEO_ID)
curl https://api.runcrate.ai/v1/videos/VIDEO_ID \
  -H "Authorization: Bearer rc_live_YOUR_API_KEY"

# Download when completed
curl https://api.runcrate.ai/v1/videos/VIDEO_ID/download \
  -H "Authorization: Bearer rc_live_YOUR_API_KEY" \
  --output sunrise.mp4
```

***

## Using MCP

> "Generate a 6-second Veo 3 video of an aerial shot over a tropical island at sunset. Save it to my desktop."

The agent calls the video generation API, polls until complete, and downloads the result.
