---
title: &quot;通过 RunAPI 在龙虾 (OpenClaw) 中使用 Kling — 视频 API 指南&quot;
url: &quot;https://runapi.ai/zh-CN/openclaw-kling.md&quot;
canonical: &quot;https://runapi.ai/zh-CN/openclaw-kling&quot;
locale: &quot;zh-CN&quot;
model: &quot;kling&quot;
---

# 在 OpenClaw 中使用 Kling。

Kuaishou 推出的 Kling 3.0 可从文本或图像生成最高 1080p 的视频，支持原生音频、多镜头场景以及 3–15 秒时长。OpenClaw agent 通过 RunAPI 调用它，使用与聊天相同的 API 密钥——发送提示词、轮询任务，即可获得视频 URL。

## API example

```bash
curl -X POST https://runapi.ai/api/v1/kling/text_to_video \
  -H &quot;Authorization: Bearer $RUNAPI_API_KEY&quot; \
  -H &quot;Content-Type: application/json&quot; \
  -d &#39;{
    &quot;model&quot;: &quot;kling-3.0&quot;,
    &quot;prompt&quot;: &quot;A drone shot pulling back from a mountain lake at sunrise, mist rising off the water, cinematic lighting&quot;,
    &quot;duration_seconds&quot;: 5,
    &quot;aspect_ratio&quot;: &quot;16:9&quot;,
    &quot;enable_sound&quot;: true,
    &quot;output_resolution&quot;: &quot;1080p&quot;
  }&#39;

```

### Response

```json
{
  &quot;task_id&quot;: &quot;tsk_abc123&quot;,
  &quot;status&quot;: &quot;pending&quot;,
  &quot;model&quot;: &quot;kling-3.0&quot;
}

```

## How it works

1. **Configure RunAPI** — Set the RUNAPI_API_KEY environment variable. If you already configured RunAPI as an OpenClaw provider for chat, the same key works for video generation — no extra setup needed.
2. **Call Kling text_to_video** — Send a POST to /api/v1/kling/text_to_video with model set to kling-3.0. Include a prompt, duration_seconds (3–15), aspect_ratio, and optionally enable_sound for native audio. For image-driven generation, use /api/v1/kling/image_to_video with a first_frame_image_url instead.
3. **Poll for the result** — The endpoint returns a task_id immediately. Poll the task status endpoint until the status changes to completed, then retrieve the video URL from the response. Generation typically takes 30–120 seconds depending on duration and resolution.

## Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `model` | `string` | Required. kling-3.0 for the latest version. |
| `prompt` | `string` | Video description. Required unless multi_shots is enabled. |
| `duration_seconds` | `integer` | Video length. Kling 3.0 supports 3–15 seconds. Older versions accept 5 or 10. |
| `aspect_ratio` | `string` | Output aspect ratio: 16:9, 9:16, or 1:1. |
| `output_resolution` | `string` | Resolution: 720p, 1080p, or 4k. Higher resolution costs more per second. |
| `enable_sound` | `boolean` | Generate native audio alongside video. Increases per-second cost. |
| `negative_prompt` | `string` | Elements to exclude from generation. |
| `first_frame_image_url` | `string` | Image URL to use as the opening frame (single-shot mode). |
| `cfg_scale` | `number` | Guidance scale (0–1). Higher values follow the prompt more closely. |
| `multi_shots` | `boolean` | Enable multi-shot scene generation with separate prompts per segment. |

## FAQ

### How does Kling per-second billing work on RunAPI?

Kling charges per second of generated video. The rate depends on output_resolution and whether enable_sound is on. A 5-second 720p clip without sound is the cheapest option; 1080p with sound costs roughly twice as much per second. Check the RunAPI pricing page for exact rates.

### What happens when a Kling generation fails -- do I lose credits?

No. RunAPI only bills for completed generations. If the task fails or times out, the reserved credits are rolled back to your account balance.

### Can Kling generate videos with sound?

Yes. Set enable_sound to true in the request body. Kling 3.0 generates synchronized audio matching the video content. Sound generation increases the per-second cost -- at 720p, sound adds about 3 cents per second.

### How long does Kling generation actually take?

Generation typically takes 30 to 120 seconds depending on duration and resolution. Longer clips at 1080p with sound take the most time. The API returns a task_id immediately so your agent can do other work while waiting.

### Can I control camera motion in Kling videos?

Kling 3.0 has a separate motion_control endpoint at /api/v1/kling/motion_control for applying motion presets to a source image with a reference video. The text_to_video endpoint relies on prompt descriptions for camera direction.


## Links

- [OpenClaw 配置指南 →](https://runapi.ai/zh-CN/openclaw)
- [Kling 模型 →](https://runapi.ai/zh-CN/models/kling)
- [Model catalog](https://runapi.ai/zh-CN/models)
- [API docs](https://runapi.ai/zh-CN/docs)
