在 Hermes Agent 中使用 DeepSeek。
DeepSeek V4 透過 RunAPI 同時支援 OpenAI chat completions 與 Anthropic messages 協定。Hermes Agent 透過 custom:runapi 供應商連接——與您用於其他模型的相同 base URL 與 key。透過請求參數啟動推理模式。RunAPI 的 DeepSeek 定價為官方費率的 50%。
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
}
}
三步驟在 Hermes Agent 中使用 DeepSeek
設定 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
選擇 DeepSeek 模型
將 model 切換為 deepseek-v4-pro 追求品質,或 deepseek-v4-flash 追求速度。兩者皆透過 custom:runapi 供應商使用 /v1/chat/completions 端點。傳入 thinking.type 設為 enabled 啟用推理——無需獨立的模型項目。
model: deepseek-v4-pro
串流回應
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 是預算友好型 LLM,在 RunAPI 上同時支持 OpenAI 和 Anthropic 協議。Hermes Agent 通過與 GPT 和 Claude 相同的 custom:runapi provider 呼叫它——只需修改 model 參數。RunAPI 以 DeepSeek 已低價格的 50% 提供,成為通過單一 API key 可用的成本最低的推理能力模型。
DeepSeek 使用場景
自託管方案評估
在決定是否自託管開源權重之前,通過 RunAPI 的 API 先測試 DeepSeek。如果 API 成本低於基礎設施盈虧平衡點,繼續使用託管版本。
構建展示思維鏈的推理 UI
啓用思考模式,在 UI 中展示思考 token,讓用户看到模型解決問題的過程。適用於輔導應用、代碼調試工具或決策支持系統。
最低成本大批量處理
使用 DeepSeek Flash 對大量文檔集、分類任務或數據提取任務進行快速低成本處理,單 token 成本比峯值質量更重要的場景。
DeepSeek + Hermes Agent 常見問題
可以。如果您已在 Hermes Agent 中設定 custom:runapi,將 model 切換為 deepseek-v4-pro 或 deepseek-v4-flash。base URL、API key 與 api_mode 保持不變。使用 hermes model 或直接編輯設定檔。
支援。DeepSeek V4 透過 RunAPI 同時支援 /v1/chat/completions(OpenAI 格式)與 /v1/messages(Anthropic 格式)。如果您的 Hermes Agent 設定使用 Anthropic messages 介面,將 model 設為 deepseek-v4-pro 即可無需更改協定。
Flash 優先速度,延遲與成本更低。Pro 優先品質,在複雜推理、編碼與多步驟任務上表現更佳。兩者使用相同端點並接受相同參數。
在請求 body 中傳入 thinking.type 設為 enabled。推理模式是請求參數,而非獨立模型。推理 token 以輸出 token 計費。此功能在 OpenAI 與 Anthropic 協定介面上均可運作。
RunAPI 的 DeepSeek token 定價為 DeepSeek 官方費率的 50%。由於 DeepSeek 在每 token 成本上已低於 GPT 與 Claude,透過 RunAPI 您可以取得單一 API 中具備推理能力 LLM 的最低價格。無訂閱、無最低消費——按 token 計費。
立即在 Hermes Agent 中試用 DeepSeek。
取得免費 RunAPI key,在 Hermes Agent 中將 model 設為 deepseek-v4-pro,以直接使用 DeepSeek 一半的成本開始推理。