Hermes Agent 是一款終端 AI 編程工具,可以通過隨用隨付、Coding Plan 或 Token Plan 團隊版接入阿里雲百鍊。
安裝 Hermes Agent
-
在終端中執行以下命令安裝 Hermes Agent,安裝指令碼會自動安裝 Python、Git 等依賴。
curl -fsSL https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh | bash說明Windows 不支援原生安裝,請先安裝 WSL2,在 WSL2 中運行以上命令。
-
安裝完成後,重新載入終端環境。
source ~/.bashrc # 如果使用 zsh,改為 source ~/.zshrc -
運行以下命令驗證安裝。若有版本號碼輸出,則表示安裝成功。
hermes --version
配置接入憑證
通過 hermes config set 命令配置接入參數,根據所選方案填入對應的 Base URL 和 API Key:
-
Token Plan 團隊版:按坐席訂閱,按 token 消耗抵扣 Credits。
-
Coding Plan:固定月費訂閱,按模型調用次數計量。
-
隨用隨付:按實際調用量後付費。
本文樣本均使用 Anthropic 相容協議:Base URL 以 /apps/anthropic 結尾,並將 api_mode 設為 anthropic_messages。Hermes Agent 同樣支援 OpenAI 相容協議:將 Base URL 結尾的 /apps/anthropic 替換為 /compatible-mode/v1,並刪除 api_mode 配置項即可。例如隨用隨付(華北2·北京)的 OpenAI 相容 Base URL 為 https://dashscope.aliyuncs.com/compatible-mode/v1。
除命令列版外,Hermes Agent 還提供案頭版(Hermes Desktop)。可從 Hermes 官網 下載安裝包,或在命令列版安裝完成後運行 hermes desktop 啟動。案頭版與命令列版共用同一份 ~/.hermes/config.yaml 設定檔,接入參數與本文一致;在案頭版中以自訂端點(Custom Endpoint)方式接入時,請使用上述 OpenAI 相容 Base URL。
Token Plan 團隊版
將 YOUR_API_KEY 替換為 Token Plan 團隊版專屬 API Key。可用模型請參考 Token Plan 團隊版支援的模型。
hermes config set model.provider custom
hermes config set model.base_url https://token-plan.ap-southeast-1.maas.aliyuncs.com/apps/anthropic
hermes config set model.api_mode anthropic_messages
hermes config set model.api_key YOUR_API_KEY
hermes config set model.default qwen3.7-max
以上命令將配置寫入 ~/.hermes/config.yaml。也可以直接編輯該檔案,寫入以下內容:
Coding Plan
將 YOUR_API_KEY 替換為 Coding Plan 專屬 API Key。可用模型請參考 Coding Plan 支援的模型。
hermes config set model.provider custom
hermes config set model.base_url https://coding-intl.dashscope.aliyuncs.com/apps/anthropic
hermes config set model.api_mode anthropic_messages
hermes config set model.api_key YOUR_API_KEY
hermes config set model.default qwen3.7-plus
以上命令將配置寫入 ~/.hermes/config.yaml。也可以直接編輯該檔案,寫入以下內容:
隨用隨付
將 YOUR_API_KEY 替換為阿里雲百鍊 API Key。可用模型請參考Anthropic 相容 API。
base_url 按地區設定,API Key 需與所選地區對應:
-
華北2(北京):
https://dashscope.aliyuncs.com/apps/anthropic -
新加坡:
https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/apps/anthropic,請將WorkspaceId替換為真實的擷取Workspace ID
hermes config set model.provider alibaba
hermes config set model.base_url https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/apps/anthropic
hermes config set model.api_mode anthropic_messages
hermes config set model.api_key YOUR_API_KEY
hermes config set model.default qwen3.7-max
以上命令將配置寫入 ~/.hermes/config.yaml。也可以直接編輯該檔案,寫入以下內容:
驗證配置
配置完成後,執行以下命令發送一條測試訊息:
hermes chat -q "你好"
如果返回正常的回複,則配置成功。如需切換模型,通過 -m 參數指定:
hermes chat -m qwen3.7-max
常見問題
錯誤碼
配置過程中遇到報錯,請參考對應計費方案的常見問題文檔:
-
隨用隨付:錯誤碼排查
-
Coding Plan:Coding Plan 常見問題
-
Token Plan 團隊版:Token Plan 團隊版常見問題