在 Hermes Agent 中使用 DeepSeek。
DeepSeek V4 通过 RunAPI 同时支持 OpenAI 聊天补全和 Anthropic messages 协议。Hermes Agent 通过 custom:runapi 提供商连接——使用你用于其他模型的相同基础 URL 和密钥。用一个请求参数激活推理模式。RunAPI 以官方费率的 50% 对 DeepSeek 定价。
使用 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
}
}
三步在 Hermes Agent 中使用 DeepSeek
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
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
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 常见问题
Yes. If you already have custom:runapi configured in Hermes Agent, switch the model to deepseek-v4-pro or deepseek-v4-flash. The base URL, API key, and api_mode stay the same. Use hermes model or edit the config file directly.
When you enable reasoning (thinking.type set to enabled), DeepSeek generates additional "thinking" tokens that show its chain-of-thought process. These tokens count as output tokens and are billed accordingly. They improve accuracy on complex tasks but increase total token usage.
Self-hosting requires significant GPU infrastructure (80GB+ VRAM for the full model). Through RunAPI at 50% of DeepSeek's already low rates, most teams save money on the API until they hit very high sustained volume. Start with the API and evaluate self-hosting once your monthly token spend justifies the hardware cost.
Pass thinking.type set to enabled in the request body. Reasoning mode is a request parameter, not a separate model. The reasoning tokens are billed as output tokens. This works through both the OpenAI and Anthropic protocol surfaces.
RunAPI prices DeepSeek tokens at 50% of official DeepSeek rates. Since DeepSeek already undercuts GPT and Claude on per-token cost, this makes it the lowest-priced reasoning-capable LLM available through a single API. No subscription, no minimum — pay per token.
Configure the provider type in Hermes Agent. Use the OpenAI-compatible provider for chat completions format, or the Anthropic-compatible provider for messages format. Both route through RunAPI to the same DeepSeek models.
Yes. Set the model parameter in each request to the desired variant. Hermes Agent can route quick tasks to Flash and complex reasoning to Reasoner, all through the same custom:runapi provider and API key.
立即在 Hermes Agent 中试用 DeepSeek。
免费获取 RunAPI 密钥,在 Hermes Agent 中将 model 设置为 deepseek-v4-pro,以直连 DeepSeek 访问一半的成本开始推理。