---
title: &quot;透過 RunAPI 在 OpenClaw 中使用 Kling — 影片 API 指南&quot;
url: &quot;https://runapi.ai/zh-HK/openclaw-kling.md&quot;
canonical: &quot;https://runapi.ai/zh-HK/openclaw-kling&quot;
locale: &quot;zh-HK&quot;
model: &quot;kling&quot;
---

# 在 OpenClaw 中使用 Kling。

Kling 3.0 由 Kuaishou 開發，可從文字或圖片生成最高 1080p 的影片，支援原生音訊、多鏡頭場景及 3–15 秒時長。OpenClaw agent 透過 RunAPI 呼叫 Kling，使用與聊天相同的 API key — 發送 prompt、輪詢任務，即可取得影片 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. **設定 RunAPI** — 設定 RUNAPI_API_KEY 環境變數。如果你已將 RunAPI 設定為 OpenClaw 的聊天 provider，同一把 key 即可用於影片生成 — 無需額外設定。
2. **呼叫 Kling text_to_video** — 發送 POST 請求至 /api/v1/kling/text_to_video，將 model 設為 kling-3.0。加入 prompt、duration_seconds（3–15）、aspect_ratio，並可選擇啟用 enable_sound 取得原生音訊。若要以圖片驅動生成，改用 /api/v1/kling/image_to_video 並提供 first_frame_image_url。
3. **輪詢取得結果** — 端點會立即回傳 task_id。輪詢任務狀態端點，直到 status 變為 completed，然後從回應中取得影片 URL。生成時間通常為 30–120 秒，取決於時長和解析度。

## Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `model` | `string` | 必填。kling-3.0 為最新版本。 |
| `prompt` | `string` | 影片描述。除非啟用 multi_shots，否則為必填。 |
| `duration_seconds` | `integer` | 影片長度。Kling 3.0 支援 3–15 秒。舊版本僅接受 5 或 10 秒。 |
| `aspect_ratio` | `string` | 輸出長寬比：16:9、9:16 或 1:1。 |
| `output_resolution` | `string` | 解析度：720p、1080p 或 4k。解析度越高，每秒費用越高。 |
| `enable_sound` | `boolean` | 與影片同時生成原生音訊。會增加每秒費用。 |
| `negative_prompt` | `string` | 要從生成結果中排除的元素。 |
| `first_frame_image_url` | `string` | 用作開頭畫面的圖片 URL（單鏡頭模式）。 |
| `cfg_scale` | `number` | 引導係數（0–1）。數值越高，生成結果越貼近 prompt。 |
| `multi_shots` | `boolean` | 啟用多鏡頭場景生成，每個片段可使用不同 prompt。 |

## FAQ

### RunAPI 上的 Kling 按秒計費如何運作？

Kling 按生成影片的秒數收費。費率取決於 output_resolution 以及是否啟用 enable_sound。5 秒 720p 不含音訊的影片是最便宜的選項；1080p 加音訊的每秒費用大約是前者的兩倍。請查看 RunAPI 定價頁面了解確切費率。

### text_to_video 和 image_to_video 有什麼差別？

text_to_video 僅從文字 prompt 生成影片。image_to_video 需要提供 first_frame_image_url，並從該圖片向外延伸生成動態。兩個端點都回傳非同步 task_id，並支援相同的時長和解析度選項。

### Kling 能生成帶有音訊的影片嗎？

可以。在請求中將 enable_sound 設為 true。Kling 3.0 會生成與影片內容同步的音訊。啟用音訊會增加每秒費用 — 720p 下大約每秒多 3 美分。

### Kling 3.0 支援的最長影片時長是多少？

Kling 3.0 透過 duration_seconds 參數支援 3 到 15 秒。舊版本如 kling-v2.5-turbo-text-to-video-pro 僅接受 5 或 10 秒。

### 我可以在 Kling 影片中控制攝影機運動嗎？

Kling 3.0 有獨立的 motion_control 端點（/api/v1/kling/motion_control），可將動態預設套用到來源圖片搭配參考影片。text_to_video 端點則依靠 prompt 描述來控制攝影機方向。


## Links

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