---
title: &quot;透過 RunAPI 在 OpenClaw 中使用 DeepSeek — LLM API 指南&quot;
url: &quot;https://runapi.ai/zh-TW/openclaw-deepseek.md&quot;
canonical: &quot;https://runapi.ai/zh-TW/openclaw-deepseek&quot;
locale: &quot;zh-TW&quot;
model: &quot;deepseek&quot;
---

# 在 OpenClaw 中使用 DeepSeek。

DeepSeek V4 透過 RunAPI 同時支援相容 OpenAI 與相容 Anthropic 的協定。Flash 追求速度，Pro 追求品質。內建推理模式透過請求參數啟動——無需獨立的模型 slug。RunAPI 的 DeepSeek token 定價為 DeepSeek 官方費率的 50%。

## API example

```bash
curl -X POST https://runapi.ai/v1/chat/completions \
  -H &quot;Authorization: Bearer $RUNAPI_API_KEY&quot; \
  -H &quot;Content-Type: application/json&quot; \
  -d &#39;{
    &quot;model&quot;: &quot;deepseek-v4-pro&quot;,
    &quot;messages&quot;: [
      {&quot;role&quot;: &quot;system&quot;, &quot;content&quot;: &quot;You are a helpful coding assistant.&quot;},
      {&quot;role&quot;: &quot;user&quot;, &quot;content&quot;: &quot;Write a Python function that finds the longest palindromic substring in O(n) time using Manacher algorithm.&quot;}
    ],
    &quot;stream&quot;: true,
    &quot;max_tokens&quot;: 4096
  }&#39;

```

### Response

```json
{
  &quot;id&quot;: &quot;chatcmpl-abc123&quot;,
  &quot;object&quot;: &quot;chat.completion&quot;,
  &quot;model&quot;: &quot;deepseek-v4-pro&quot;,
  &quot;choices&quot;: [
    {
      &quot;index&quot;: 0,
      &quot;message&quot;: {
        &quot;role&quot;: &quot;assistant&quot;,
        &quot;content&quot;: &quot;Here is Manacher&#39;s algorithm implementation...&quot;
      },
      &quot;finish_reason&quot;: &quot;stop&quot;
    }
  ],
  &quot;usage&quot;: {
    &quot;prompt_tokens&quot;: 42,
    &quot;completion_tokens&quot;: 356,
    &quot;total_tokens&quot;: 398
  }
}

```

## How it works

1. **將 RunAPI 設定為供應商** — 設定 RUNAPI_API_KEY 環境變數。在 OpenClaw 中，將 RunAPI 加為相容 OpenAI 的供應商，baseUrl 設為 https://runapi.ai/v1。DeepSeek 使用與 GPT 或 Claude 相同的供應商——無需獨立的供應商項目。
2. **選擇 DeepSeek 模型** — 將 model 設為 deepseek-v4-pro 追求品質，或 deepseek-v4-flash 追求速度。兩者皆使用 /v1/chat/completions 端點。若要啟用推理，傳入 thinking.type 設為 enabled——無需更改模型 slug。
3. **串流回應** — OpenClaw 以 OpenAI chat completions 格式的 SSE 串流接收回應。最終事件中回報 token 使用量以確保計費透明。無論透過 RunAPI 使用 DeepSeek、GPT 或 Claude，格式皆相同。

## Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `model` | `string` | 必填。deepseek-v4-pro 或 deepseek-v4-flash。 |
| `messages` | `array` | 必填。訊息物件陣列，每個物件包含 role（system、user、assistant）與 content 欄位。 |
| `stream` | `boolean` | 選填。設為 true 啟用 SSE 串流。預設為 false。 |
| `max_tokens` | `integer` | 選填。生成的最大 token 數量。 |
| `temperature` | `number` | 選填。取樣溫度，介於 0 到 2 之間。較低的值更具確定性。 |
| `thinking` | `object` | 選填。將 type 設為 &quot;enabled&quot; 以啟動 DeepSeek 的內建推理模式。 |

## FAQ

### 可以在 OpenClaw 中用 DeepSeek 直接替換 GPT 嗎？

可以。DeepSeek V4 支援 OpenAI chat completions 格式。將 OpenClaw 指向 RunAPI 的 /v1 base URL，將 model 參數改為 deepseek-v4-pro 或 deepseek-v4-flash，其餘設定保持不變。除了模型名稱外無需更改程式碼。

### 如何在 OpenClaw 中啟用 DeepSeek 推理模式？

在請求 body 中傳入 thinking.type 設為 enabled。DeepSeek 透過請求參數啟動思維鏈推理——無需獨立的模型 slug 或供應商。推理 token 計入使用量計費。

### deepseek-v4-flash 與 deepseek-v4-pro 有什麼差別？

Flash 優先速度，延遲與成本更低。Pro 優先品質，在複雜推理、編碼與多步驟任務上表現更佳。兩者使用相同端點並接受相同參數。

### RunAPI 會將 DeepSeek 請求路由經過中國嗎？

不會。RunAPI 透過自有基礎設施代理 DeepSeek。您的請求不會經過中國資料中心路由，您的 API key 也不會直接與 DeepSeek 分享。

### RunAPI 上的 DeepSeek 定價與直接使用 DeepSeek API 相比如何？

RunAPI 的 DeepSeek token 定價為 DeepSeek 官方費率的 50%。DeepSeek 已是每 token 成本最低的 LLM 供應商之一，因此透過 RunAPI，您可以取得具備推理能力模型的最低每 token 價格。按 token 計費，無訂閱、無最低消費。


## Links

- [OpenClaw 設定指南 →](https://runapi.ai/zh-TW/openclaw)
- [DeepSeek models →](https://runapi.ai/zh-TW/models/deepseek)
- [Model catalog](https://runapi.ai/zh-TW/models)
- [API docs](https://runapi.ai/zh-TW/docs)
