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

# 在 Hermes Agent 中使用 DeepSeek。

DeepSeek V4 透過 RunAPI 同時支援 OpenAI chat completions 與 Anthropic messages 協定。Hermes Agent 透過 custom:runapi 供應商連接——與您用於其他模型的相同 base URL 與 key。透過請求參數啟動推理模式。RunAPI 的 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 環境變數。如果您已在 Hermes Agent 中將 RunAPI 加為 custom:runapi，相同的供應商與 key 即可用於 DeepSeek——無需額外設定。若尚未設定，加入 RunAPI 並設定 base_url 為 https://runapi.ai/v1，api_mode 設為 chat_completions。
2. **選擇 DeepSeek 模型** — 將 model 切換為 deepseek-v4-pro 追求品質，或 deepseek-v4-flash 追求速度。兩者皆透過 custom:runapi 供應商使用 /v1/chat/completions 端點。傳入 thinking.type 設為 enabled 啟用推理——無需獨立的模型項目。
3. **串流回應** — Hermes Agent 以 OpenAI chat completions 格式的 SSE 串流接收回應。最終事件中顯示 token 使用量。無需更改供應商設定即可在 DeepSeek、GPT 與 Claude 模型之間切換——只需更改 model 欄位。

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

### Hermes Agent 可以透過現有的 RunAPI 供應商使用 DeepSeek 嗎？

可以。如果您已在 Hermes Agent 中設定 custom:runapi，將 model 切換為 deepseek-v4-pro 或 deepseek-v4-flash。base URL、API key 與 api_mode 保持不變。使用 hermes model 或直接編輯設定檔。

### RunAPI 上的 DeepSeek 支援 Anthropic messages 協定嗎？

支援。DeepSeek V4 透過 RunAPI 同時支援 /v1/chat/completions（OpenAI 格式）與 /v1/messages（Anthropic 格式）。如果您的 Hermes Agent 設定使用 Anthropic messages 介面，將 model 設為 deepseek-v4-pro 即可無需更改協定。

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

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

### 如何在 Hermes Agent 中啟動 DeepSeek 推理模式？

在請求 body 中傳入 thinking.type 設為 enabled。推理模式是請求參數，而非獨立模型。推理 token 以輸出 token 計費。此功能在 OpenAI 與 Anthropic 協定介面上均可運作。

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

RunAPI 的 DeepSeek token 定價為 DeepSeek 官方費率的 50%。由於 DeepSeek 在每 token 成本上已低於 GPT 與 Claude，透過 RunAPI 您可以取得單一 API 中具備推理能力 LLM 的最低價格。無訂閱、無最低消費——按 token 計費。


## Links

- [Hermes Agent 設定指南 →](https://runapi.ai/zh-TW/hermes-agent)
- [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)
