> ## 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.

# Kling Video Generation API

> Generate AI videos with Kling v3 — text-to-video, motion control, avatar generation, and lip sync through a single 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 />

Kling covers the full video pipeline: text-to-video, motion control, avatar creation, and lip sync. All models accessible through the Runcrate video API.

## Available models

| Model                       | Type                | Strengths                           |
| --------------------------- | ------------------- | ----------------------------------- |
| **Kling v3**                | Text/Image-to-video | Best human motion, cinematic, 3-15s |
| **Kling v2.6**              | Text/Image-to-video | Fast, cost-effective, 3-10s         |
| **Kling v3 Motion Control** | Controlled video    | Camera path and subject motion      |
| **Kling Avatar v2**         | Avatar              | Talking head from a single photo    |
| **Kling Lip Sync**          | Audio-driven        | Sync lips to any audio track        |

***

## Text-to-video

<CodeGroup>
  ```python Python theme={"theme":"github-dark"}
  from runcrate import Runcrate

  client = Runcrate(api_key="rc_live_YOUR_API_KEY")
  job = client.models.generate_video_and_save(
      "street-scene.mp4",
      model="kuaishou/kling-v3-video",
      prompt="Person walking through rainy Tokyo at night, neon reflections on wet pavement",
      duration=8,
      on_status=lambda j: print(f"  {j.status}..."),
  )
  ```

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

  const rc = new Runcrate({ apiKey: 'rc_live_YOUR_API_KEY' });
  const job = await rc.models.generateVideo({
    model: 'kuaishou/kling-v3-video',
    prompt: 'Person walking through rainy Tokyo at night, neon reflections',
    duration: 8,
  });
  let status = job;
  while (status.status !== 'completed' && status.status !== 'failed') {
    await new Promise(r => setTimeout(r, 5000));
    status = await rc.models.getVideoStatus(job.id);
  }
  await Bun.write('street-scene.mp4', await rc.models.downloadVideo(job.id));
  ```
</CodeGroup>

***

All examples below reuse the same `client`.

## Image-to-video

```python theme={"theme":"github-dark"}
client.models.generate_video_and_save(
    "product-spin.mp4", model="kuaishou/kling-v3-video",
    prompt="Slowly rotate the product 360 degrees on a turntable",
    image="./product-photo.png", duration=6,
    on_status=lambda j: print(f"  {j.status}..."),
)
```

***

## Motion control

```python theme={"theme":"github-dark"}
client.models.generate_video_and_save(
    "dolly-zoom.mp4", model="kuaishou/kling-v3-motion-control",
    prompt="A castle on a hilltop at sunset, dramatic clouds",
    camera_motion="dolly_zoom_in", duration=6,
    on_status=lambda j: print(f"  {j.status}..."),
)
```

***

## Avatar generation

Create a talking-head video from a single reference photo:

```python theme={"theme":"github-dark"}
client.models.generate_video_and_save(
    "avatar-intro.mp4", model="kuaishou/kling-avatar-v2",
    prompt="Person introduces themselves and waves, friendly, office background",
    image="./headshot.jpg", duration=8,
    on_status=lambda j: print(f"  {j.status}..."),
)
```

***

## Lip sync

```python theme={"theme":"github-dark"}
client.models.generate_video_and_save(
    "synced-speaker.mp4", model="kuaishou/kling-lip-sync",
    prompt="Natural lip sync with subtle head movements",
    image="./speaker.jpg", audio="./narration.mp3",
    on_status=lambda j: print(f"  {j.status}..."),
)
```

***

## Tips

* **v3 vs v2.6.** v3 has better quality and human motion. v2.6 is faster and cheaper.
* **Duration affects cost.** Start with 3-4s clips to test prompts.
* **Motion control.** `dolly_zoom_in`, `dolly_zoom_out`, `pan_left`, `pan_right`, `tilt_up`, `tilt_down`, `orbit`.
