HERMES + DEEPSEEK

在 Hermes Agent 中使用 DeepSeek。

DeepSeek V4 通过 RunAPI 同时支持 OpenAI 聊天补全和 Anthropic messages 协议。Hermes Agent 通过 custom:runapi 提供商连接——使用你用于其他模型的相同基础 URL 和密钥。用一个请求参数激活推理模式。RunAPI 以官方费率的 50% 对 DeepSeek 定价。

一个 API 密钥 · OpenAI + Anthropic 协议 · 支持流式传输
使用 RunAPI 通过 Hermes Agent 的 custom:runapi 提供商调用 DeepSeek V4 Pro。

要求:
- 使用 Hermes Agent 中已配置的 custom:runapi 提供商
- 调用 RunAPI 聊天补全端点 https://runapi.ai/v1/chat/completions
- 将 model 设置为 "deepseek-v4-pro"
- RUNAPI_API_KEY 环境变量提供授权
- 响应以 OpenAI 聊天补全格式的 SSE 事件流式返回
- 如需启用推理,在请求体中将 thinking.type 设置为 "enabled"
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

Configure RunAPI provider

Set the RUNAPI_API_KEY environment variable. If you already added RunAPI as custom:runapi in Hermes Agent, the same provider and key work for DeepSeek — no extra configuration. If not, add RunAPI with base_url https://runapi.ai/v1 and api_mode chat_completions.

export RUNAPI_API_KEY=runapi_xxx
2

Select a DeepSeek model

Switch the model to deepseek-v4-pro for quality or deepseek-v4-flash for speed. Both use the /v1/chat/completions endpoint through the custom:runapi provider. Enable reasoning by passing thinking.type set to enabled — no separate model entry needed.

model: deepseek-v4-pro
3

Stream the response

Hermes Agent receives the response as an SSE stream in OpenAI chat completions format. Token usage appears in the final event. Switch between DeepSeek, GPT, and Claude models without changing the provider config — only the model field changes.

stream: true
参数

DeepSeek 聊天补全参数

参数 类型 说明
model string Required. deepseek-v4-pro or deepseek-v4-flash.
messages array Required. Array of message objects with role (system, user, assistant) and content fields.
stream boolean Optional. Set to true for SSE streaming. Default false.
max_tokens integer Optional. Maximum number of tokens to generate.
temperature number Optional. Sampling temperature between 0 and 2. Lower values are more deterministic.
thinking object Optional. Set type to "enabled" to activate DeepSeek's built-in reasoning mode.

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 通用配置

尚未配置?请从 Hermes Agent 的 RunAPI 配置指南开始。

Hermes Agent 配置指南 →

DeepSeek 模型目录

查看 DeepSeek V4 版本、定价和 API 文档。

DeepSeek 模型 →

立即在 Hermes Agent 中试用 DeepSeek。

免费获取 RunAPI 密钥,在 Hermes Agent 中将 model 设置为 deepseek-v4-pro,以直连 DeepSeek 访问一半的成本开始推理。