HERMES + DEEPSEEK

在 Hermes Agent 中使用 DeepSeek。

DeepSeek V4 透過 RunAPI 同時支援 OpenAI chat completions 與 Anthropic messages 協定。Hermes Agent 透過 custom:runapi 供應商連接——與您用於其他模型的相同 base URL 與 key。透過請求參數啟動推理模式。RunAPI 的 DeepSeek 定價為官方費率的 50%。

一個 API key · OpenAI + Anthropic 協定 · 串流支援
Use RunAPI to call DeepSeek V4 Pro through Hermes Agent's custom:runapi provider.

Requirements:
- Use the custom:runapi provider already configured in Hermes Agent
- Call the RunAPI chat completions endpoint at https://runapi.ai/v1/chat/completions
- Set model to "deepseek-v4-pro"
- The RUNAPI_API_KEY environment variable provides authorization
- The response streams back as SSE events in OpenAI chat completions format
- To enable reasoning, set thinking.type to "enabled" in the request body
curl -X POST https://runapi.ai/v1/chat/completions \
  -H "Authorization: Bearer $RUNAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-v4-pro",
    "messages": [
      {"role": "system", "content": "You are a helpful coding assistant."},
      {"role": "user", "content": "Write a Python function that finds the longest palindromic substring in O(n) time using Manacher algorithm."}
    ],
    "stream": true,
    "max_tokens": 4096
  }'
{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "model": "deepseek-v4-pro",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Here is Manacher's algorithm implementation..."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 42,
    "completion_tokens": 356,
    "total_tokens": 398
  }
}
複製 curl 指令進行測試 deepseek
運作原理

三步驟在 Hermes Agent 中使用 DeepSeek

1

設定 RunAPI 供應商

設定 RUNAPI_API_KEY 環境變數。如果您已在 Hermes Agent 中將 RunAPI 加為 custom:runapi,相同的供應商與 key 即可用於 DeepSeek——無需額外設定。若尚未設定,加入 RunAPI 並設定 base_url 為 https://runapi.ai/v1,api_mode 設為 chat_completions。

export RUNAPI_API_KEY=runapi_xxx
2

選擇 DeepSeek 模型

將 model 切換為 deepseek-v4-pro 追求品質,或 deepseek-v4-flash 追求速度。兩者皆透過 custom:runapi 供應商使用 /v1/chat/completions 端點。傳入 thinking.type 設為 enabled 啟用推理——無需獨立的模型項目。

model: deepseek-v4-pro
3

串流回應

Hermes Agent 以 OpenAI chat completions 格式的 SSE 串流接收回應。最終事件中顯示 token 使用量。無需更改供應商設定即可在 DeepSeek、GPT 與 Claude 模型之間切換——只需更改 model 欄位。

stream: true
參數

DeepSeek chat completions 參數

參數 類型 說明
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 設為 "enabled" 以啟動 DeepSeek 的內建推理模式。

Hermes Agent 上的 DeepSeek 是什麼?

DeepSeek V4 是在 RunAPI 上同時支援 OpenAI 和 Anthropic 協議介面的低成本 LLM。Hermes Agent 透過與 GPT 和 Claude 相同的 custom:runapi provider 呼叫它——只需更改 model 參數。內建推理模式透過請求參數啟用,RunAPI 以官方費率的 50% 定價 DeepSeek,使其成為單一 API key 可用的最低成本推理型模型。

DeepSeek 使用情境

自托管替代方案評估

在決定是否自托管開源權重前,先透過 RunAPI 的 API 測試 DeepSeek。若 API 成本低於基礎設施盈虧平衡點,繼續使用託管版本;若使用量合理,再以相同模型本地部署。

構建顯示思維鏈的推理 UI

啟用思考模式,在 UI 中顯示思考 token,讓使用者看到模型如何解決問題。適用於輔導應用程式、程式碼除錯工具或決策支援系統。

最低成本的高量批次處理

使用 DeepSeek Flash 快速、低成本地處理大量文件集、分類任務或資料提取工作,適合每 token 成本比峰值品質更重要的場景。

FAQ

DeepSeek + Hermes Agent 常見問題

Hermes Agent 通用設定

尚未設定?請從 Hermes Agent 的 RunAPI 設定指南開始。

Hermes Agent 設定指南 →

DeepSeek 模型目錄

查看 DeepSeek V4 變體、定價與 API 文件。

DeepSeek models →

立即在 Hermes Agent 中試用 DeepSeek。

取得免費 RunAPI key,在 Hermes Agent 中將 model 設為 deepseek-v4-pro,以直接使用 DeepSeek 一半的成本開始推理。