零成本AI自由:Hermes接入硅基流动免费API全攻略Zero-Cost AI Freedom: A Complete Guide to Hermes Accessing Silicon-based Flow's Free API


AI free token/AI免费积分

零成本AI自由:Hermes接入硅基流动免费API全攻略


一、概述

Hermes Agent 是 Nous Research 于 2026 年 2 月发布的开源 AI 代理框架,支持 200+ SOTA 模型。硅基流动(SiliconFlow)是国内提供高性价比 API 服务的平台,API 格式兼容 OpenAI,Hermes 可直接对接。

本文档记录将 Hermes Agent 接入硅基流动 API 的完整流程,包含安装、配置、验证及常见问题排查。


二、准备工作

2.1 系统要求

项目 要求
操作系统 Linux / macOS / WSL2(Windows 需 WSL2)
Node.js 22+
Git 已安装
网络 能访问 https://api.siliconflow.cn/v1

2.2 注册硅基流动并获取 API Key(免费)

  1. 访问硅基流动官网:https://cloud.siliconflow.cn/i/BvcOKsRz(使用此链接注册可获赠免费额度)
  2. 注册并登录账号
  3. 进入控制台 → API 密钥管理(或 https://cloud.siliconflow.com/account/ak)
  4. 点击 「创建API密钥」,完成创建
  5. 复制并妥善保管 API Key(格式以 sk- 开头)

💡 邀请码:BvcOKsRz — 通过上方链接或输入此邀请码注册,可获得额外免费额度。

2.3 确认模型 ID

硅基流动支持多种模型,常见模型 ID 包括:

模型 Model ID
DeepSeek-R1 Pro/deepseek-ai/DeepSeek-R1
DeepSeek-V3 deepseek-ai/DeepSeek-V3
DeepSeek-V4-Flash deepseek-ai/DeepSeek-V4-Flash
Qwen2.5-7B Qwen/Qwen2.5-7B-Instruct
Qwen2.5-32B Qwen/Qwen2.5-32B-Instruct

完整模型列表请参考:硅基流动模型库


三、安装 Hermes Agent

3.1 一键安装(推荐)

  •  
curl -fsSL https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh | bash

安装过程中会自动检测并安装 uv、Python、Node.js、ripgrep、ffmpeg 等依赖。

3.2 刷新环境变量

  •  
  •  
  •  
source ~/.bashrc# 或source ~/.zshrc

3.3 验证安装

  •  
hermes --version

图片


四、配置硅基流动 API

Hermes 提供了两种配置方式:交互式配置向导(hermes setup)和 模型提供商切换命令(hermes model)。两者均可完成配置,用户可根据习惯选择。


4.1 方式一:使用 hermes setup 交互式向导(推荐新手)

运行配置向导:

  •  
hermes setup

关键步骤说明:

步骤 操作 说明
1 选择设置方式 选 Full setup(完整设置),以便手动配置自定义端点
2 选择推理提供商 向下滚动,选择 Custom endpoint (enter URL manually)
3 填写 Base URL https://api.siliconflow.cn/v1
4 填写 API Key 粘贴硅基流动 API Key
5 填写 Model Name 例如 deepseek-ai/DeepSeek-V4-Flash
6 API 兼容模式 选择 Chat Completions 或 Auto-detect
7 显示名称 可填 SiliconFlow 或直接回车
8 其他配置 TTS、终端后端等可直接回车使用默认值

4.2 方式二:使用 hermes model 切换提供商(更快速)

如果仅需修改模型提供商,无需走完整向导,可直接使用 hermes model 命令。

步骤 1:运行命令

  •  
hermes model

步骤 2:选择提供商

终端显示如下菜单(部分):

  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
Select provider:  ↑↓ navigate  ENTER/SPACE select  ESC cancel   (●) Nous Portal ...   (○) OpenRouter ...   ...   (○) custom (direct API)   (○) Custom endpoint (enter URL manually)   (○) Configure auxiliary models...   (○) Leave unchanged

正确选择:按 向下箭头(↓) 翻到接近末尾,高亮选中 Custom endpoint (enter URL manually) 或 custom (direct API)(两者均可,前者更明确),然后按 回车。

⚠️ 注意:不要选择 OpenAI 或 OpenAI ▸,因为这些选项默认指向官方 OpenAI 服务,无法自定义 Base URL,会导致后续请求失败。

步骤 3:填写接入信息

选择后,系统会依次提示输入:

  • Base URL:输入 https://api.siliconflow.cn/v1
  • API Key:粘贴您的硅基流动 API Key(以 sk- 开头)
  • Model name:输入您要使用的模型 ID,例如 deepseek-ai/DeepSeek-V4-Flash

步骤 4:确认保存

输入完成后,配置会自动写入 ~/.hermes/config.yaml 和 ~/.hermes/.env,无需额外操作。


4.3 方式三:手动编辑配置文件(高级)

配置文件位置:~/.hermes/config.yaml

编辑该文件,确保 model 部分配置如下:

  •  
  •  
  •  
  •  
  •  
model:  default: deepseek-ai/DeepSeek-V4-Flash  provider: custom  base_url: https://api.siliconflow.cn/v1  api_key_env: SILICONFLOW_API_KEY

API Key 存放于 ~/.hermes/.env:

  •  
SILICONFLOW_API_KEY=sk-你的真实密钥

五、验证配置

5.1 诊断检查

  •  
hermes doctor

检查是否存在配置问题,如有问题可按提示修复。

5.2 测试对话

  •  
hermes chat -q "你好,请用一句话介绍自己"

图片

或进入交互式聊天:

  •  
hermes

成功时,终端底部会显示当前模型、token 用量和响应时间,确认硅基流动 API 已连接并正常工作。图片


六、常见问题与排查

6.1 HTTP 401: “Api key is invalid”

原因:API Key 无效或未正确传递。

解决方案:

  1. 确认 API Key 以 sk- 开头且完整无误
  2. 检查 ~/.hermes/.env 中 SILICONFLOW_API_KEY 是否正确设置
  3. 用 curl 直接测试 Key 是否有效:
    •  
    •  
    curl https://api.siliconflow.cn/v1/models \  -H "Authorization: Bearer sk-你的密钥"
  •  
  •  
  • 如返回 "Api key is invalid",需重新生成 Key
  • 6.2 provider 错误

    错误信息:Unknown provider 'openai-compatible'

    原因:Hermes 不识别 openai-compatible 作为 provider 值。

    解决方案:将 model.provider 改为 custom:

    •  
    hermes config set model.provider custom

    或通过 hermes model 重新选择 Custom endpoint。

    6.3 模型名称错误(HTTP 404)

    原因:模型 ID 与硅基流动模型库中的名称不一致。

    解决方案:

    1. 访问 硅基流动模型库 确认准确的模型 ID
    2. 注意大小写和路径前缀(如 Pro/ 前缀)
    3. 更新配置:
      •  
      hermes config set model.default <正确的模型ID>
    •  

    6.4 网络连接问题

    症状:超时或连接被重置。

    解决方案:

    1. 确认服务器能访问 https://api.siliconflow.cn/v1
    2. 如有代理,设置环境变量:
      •  
      export https_proxy=http://代理地址:端口
    •  

    七、常用命令速查

    命令 说明
    hermes 启动新聊天会话
    hermes "消息" 单次消息发送
    hermes -c 恢复上一次会话
    hermes model 切换模型提供商(快速配置)
    hermes config 查看当前配置
    hermes config edit 编辑配置文件
    hermes doctor 诊断连接问题
    hermes update 更新到最新版本

    八、参考资源

    • Hermes Agent 官方 GitHub:NousResearch/hermes-agent
    • 硅基流动官网(推荐链接,含免费额度):https://cloud.siliconflow.cn/i/BvcOKsRz
    • 硅基流动邀请码:BvcOKsRz
    • 硅基流动 API Key 管理:https://cloud.siliconflow.com/account/ak
    • 硅基流动模型库:https://www.siliconflow.com/models
    • 硅基流动 API 文档:https://docs.siliconflow.cn

     

    Zero-Cost AI Freedom: Complete Guide to Connecting Hermes with SiliconFlow's Free API

    I. Overview

    Hermes Agent is an open-source AI agent framework released by Nous Research in February 2026, supporting 200+ SOTA models. SiliconFlow is a domestic platform offering cost-effective API services; its API format is compatible with OpenAI, allowing Hermes to connect directly.

    This document records the complete process of connecting Hermes Agent to SiliconFlow's API, including installation, configuration, verification, and troubleshooting for common issues.

    II. Preparation

    2.1 System Requirements

    2.2 Register with SiliconFlow and Obtain API Key (Free)

    Visit the SiliconFlow official website: https://cloud.siliconflow.cn/i/BvcOKsRz (Registering via this link grants free quota)

    Register and log in to your account

    Go to Console → API Key Management (or https://cloud.siliconflow.com/account/ak)

    Click "Create API Key" to complete creation

    Copy and securely store your API Key (format starts with sk-)

    💡 Invitation Code: BvcOKsRz — Register via the link above or enter this invitation code to receive additional free quota.

    2.3 Confirm Model ID

    SiliconFlow supports various models; common model IDs include:

    For the complete model list, refer to: SiliconFlow Model Library

    III. Install Hermes Agent

    3.1 One-Click Installation (Recommended)

    During installation, dependencies such as uv, Python, Node.js, ripgrep, and ffmpeg will be automatically detected and installed.

    3.2 Refresh Environment Variables

    3.3 Verify Installation

    图片

    IV. Configure SiliconFlow API

    Hermes provides two configuration methods: the Interactive Configuration Wizard (hermes setup) and the Model Provider Switch Command (hermes model). Both can complete the configuration; users can choose based on preference.

    4.1 Method 1: Use hermes setup Interactive Wizard (Recommended for Beginners)

    Run the configuration wizard:

    Key Steps Explanation:

    4.2 Method 2: Use hermes model to Switch Provider (Faster)

    If you only need to modify the model provider, you can skip the full wizard and directly use the hermes model command.

    Step 1: Run the Command

    Step 2: Select Provider

    The terminal displays the following menu (partial):

    Correct Selection: Press the Down Arrow (↓) to scroll near the end, highlight and select Custom endpoint (enter URL manually) or custom (direct API) (both work, the former is more explicit), then press Enter.

    ⚠️ Note: Do not select OpenAI or OpenAI ▸, as these options default to the official OpenAI service, cannot customize the Base URL, and will cause subsequent requests to fail.

    Step 3: Fill in Access Information

    After selection, the system will prompt you to enter:

    Base URL: Enter https://api.siliconflow.cn/v1

    API Key: Paste your SiliconFlow API Key (starting with sk-)

    Model name: Enter the model ID you wish to use, e.g., deepseek-ai/DeepSeek-V4-Flash

    Step 4: Confirm and Save

    After input, the configuration is automatically written to ~/.hermes/config.yaml and ~/.hermes/.env; no further action is required.

    4.3 Method 3: Manually Edit Configuration File (Advanced)

    Configuration file location: ~/.hermes/config.yaml

    Edit this file to ensure the model section is configured as follows:

    API Key stored in ~/.hermes/.env:

    V. Verify Configuration

    5.1 Diagnostic Check

    Check for configuration issues; if any exist, follow the prompts to fix them.

    5.2 Test Conversation

    图片

    Or enter interactive chat:

    Upon success, the terminal bottom will display the current model, token usage, and response time, confirming that the SiliconFlow API is connected and functioning correctly.图片

    VI. Common Issues and Troubleshooting

    6.1 HTTP 401: "Api key is invalid"

    Cause: API Key is invalid or not correctly passed.

    Solution:

    Ensure the API Key starts with sk- and is complete and error-free

    Check if SILICONFLOW_API_KEY is correctly set in ~/.hermes/.env

    If returning "Api key is invalid", regenerate the Key

    6.2 Provider Error

    Error Message: Unknown provider 'openai-compatible'

    Cause: Hermes does not recognize openai-compatible as a provider value.

    Solution: Change model.provider to custom:

    Or re-select Custom endpoint via hermes model.

    6.3 Incorrect Model Name (HTTP 404)

    Cause: Model ID does not match the name in the SiliconFlow model library.

    Solution:

    Visit the SiliconFlow Model Library to confirm the accurate model ID

    Pay attention to case sensitivity and path prefixes (e.g., Pro/ prefix)

    6.4 Network Connection Issues

    Symptoms: Timeout or connection reset.

    Solution:

    Confirm the server can access https://api.siliconflow.cn/v1

    VII. Quick Reference for Common Commands

    VIII. Reference Resources

    Hermes Agent Official GitHub: NousResearch/hermes-agent

    SiliconFlow Official Website (Recommended Link, includes free quota): https://cloud.siliconflow.cn/i/BvcOKsRz

    SiliconFlow Invitation Code: BvcOKsRz

    SiliconFlow API Key Management: https://cloud.siliconflow.com/account/ak

    SiliconFlow Model Library: https://www.siliconflow.com/models

    SiliconFlow API Documentation: https://docs.siliconflow.cn

    暂无评论,快来发表第一条评论吧!No comments yet. Be the first!

    📮 需求咨询📮 Inquiry