Nanobot + 智谱 GLM-4.7 使用教程

一、安装教程

1.1 下载

使用默认命令安装可能会遇到环境管理错误:

复制代码
git clone https://github.com/HKUDS/nanobot.git
cd nanobot
pip install -e .

⚠️ 注意事项:pip install -e . 报错 externally-managed-environment,建议使用 uv 进行安装,以避免环境冲突。

推荐:使用 UV 安装
  1. 安装 uv

    curl -LsSf https://astral.sh/uv/install.sh | sh
    source $HOME/.local/bin/env
    uv --version

  2. 安装 nanobot

    uv tool install nanobot-ai

  3. 验证安装

    nanobot --help


1.2 Nanobot 初始化配置

运行以下命令开始配置流程:

复制代码
nanobot onboard

1.3 Config.json 配置

编辑配置文件:

复制代码
nano ~/.nanobot/config.json

以下是完整的配置模版(请根据实际情况修改 Key 和模型名):

复制代码
{
  "agents": {
    "defaults": {
      "workspace": "~/.nanobot/workspace",
      "model": "openai/glm-4.7",
      "maxTokens": 10240,
      "temperature": 0.7,
      "maxToolIterations": 20
    }
  },
  "channels": {
    "whatsapp": {
      "enabled": false,
      "bridgeUrl": "ws://localhost:3001",
      "allowFrom": []
    },
    "telegram": {
      "enabled": false,
      "token": "",
      "allowFrom": [],
      "proxy": null
    },
    "discord": {
      "enabled": false,
      "token": "",
      "allowFrom": [],
      "gatewayUrl": "wss://gateway.discord.gg/?v=10&encoding=json",
      "intents": 37377
    },
    "feishu": {
      "enabled": false,
      "appId": "",
      "appSecret": "",
      "encryptKey": "",
      "verificationToken": "",
      "allowFrom": []
    },
    "dingtalk": {
      "enabled": false,
      "clientId": "",
      "clientSecret": "",
      "allowFrom": []
    },
    "email": {
      "enabled": false,
      "consentGranted": false,
      "imapHost": "",
      "imapPort": 993,
      "imapUsername": "",
      "imapPassword": "",
      "imapMailbox": "INBOX",
      "imapUseSsl": true,
      "smtpHost": "",
      "smtpPort": 587,
      "smtpUsername": "",
      "smtpPassword": "",
      "smtpUseTls": true,
      "smtpUseSsl": false,
      "fromAddress": "",
      "autoReplyEnabled": true,
      "pollIntervalSeconds": 30,
      "markSeen": true,
      "maxBodyChars": 12000,
      "subjectPrefix": "Re: ",
      "allowFrom": []
    },
    "slack": {
      "enabled": false,
      "mode": "socket",
      "webhookPath": "/slack/events",
      "botToken": "",
      "appToken": "",
      "userTokenReadOnly": true,
      "groupPolicy": "mention",
      "groupAllowFrom": [],
      "dm": {
        "enabled": true,
        "policy": "open",
        "allowFrom": []
      }
    },
    "qq": {
      "enabled": false,
      "appId": "",
      "secret": "",
      "allowFrom": []
    }
  },
  "providers": {
    "anthropic": {
      "apiKey": "",
      "apiBase": null,
      "extraHeaders": null
    },
    "openai": {
      "apiKey": "密钥XXXXXX",
      "apiBase": "https://open.bigmodel.cn/api/paas/v4",
      "extraHeaders": null
    },
    "openrouter": {
      "apiKey": "",
      "apiBase": null,
      "extraHeaders": null
    },
    "deepseek": {
      "apiKey": "",
      "apiBase": null,
      "extraHeaders": null
    },
    "groq": {
      "apiKey": "",
      "apiBase": null,
      "extraHeaders": null
    },
    "zhipu": {
      "apiKey": "",
      "apiBase": "https://docs.litellm.ai/docs/providers",
      "extraHeaders": null
    },
    "dashscope": {
      "apiKey": "",
      "apiBase": null,
      "extraHeaders": null
    },
    "vllm": {
      "apiKey": "",
      "apiBase": null,
      "extraHeaders": null
    },
    "gemini": {
      "apiKey": "",
      "apiBase": null,
      "extraHeaders": null
    },
    "moonshot": {
      "apiKey": "",
      "apiBase": null,
      "extraHeaders": null
    },
    "aihubmix": {
      "apiKey": "",
      "apiBase": null,
      "extraHeaders": null
    }
  },
  "gateway": {
    "host": "0.0.0.0",
    "port": 18790
  },
  "tools": {
    "web": {
      "search": {
        "apiKey": "",
        "maxResults": 5
      }
    },
    "exec": {
      "timeout": 60
    },
    "restrictToWorkspace": false
  }
}

💡 配置提示:

  1. 确保 providers.openai.apiBase 指向智谱的官方地址。
  2. 原文中 zhipu.apiBase 指向了文档地址,代码中已修正为 API 地址,以避免潜在错误。

二、验证

配置完成后,运行以下命令验证效果:

复制代码
nanobot agent -m "what is 2 + 2"

效果:

相关推荐
AC赳赳老秦9 小时前
传感器数据自动汇总:OpenClaw 采集多类传感器数据、清洗入库、生成趋势分析
java·人工智能·python·自动化·github·php·openclaw
Ai尚研修-贾莲1 天前
基于Claude Code与Codex双Agent协作的WebGIS全链路开发
codex·webgis·ai-agent·claude code·maplibre·openclaw·leaflet交互地图
AC赳赳老秦2 天前
采购专员自动化:OpenClaw 自动比价、生成询价单、跟踪供应商报价进度实战指南
开发语言·数据库·人工智能·python·自动化·github·openclaw
七夜zippoe3 天前
OpenClaw 数据加密:敏感信息保护的完整方案
数据库·mysql·php·openclaw·敏感保护
yanwei20203 天前
NinChat:构建 AI 时代的实时新闻搜索基础设施
人工智能·ai agent·openclaw·hermes·meilishard·热点新闻聚合
Koma-forever3 天前
OpenClaw-使用本地Ollamam模型(opencalw config+ ollama launch)
ollama·openclaw
梦想的初衷~4 天前
【科研自动化实战】Codex × Claude Code × OpenClaw × Hermes:四位AI研究员的科研协作流水线搭建指南
人工智能·codex·claude code·openclaw·科研自动化·agent协作·ai科研助手
菜地里的小菜鸟4 天前
openclaw配置智谱GLM-4.7
openclaw·openclaw模型配置·openclaw配置智谱glm47
站在墙头上4 天前
Windows下安装 龙虾-Openclaw
windows·ai·openclaw
AC赳赳老秦5 天前
防火墙规则批量配置实战:OpenClaw 自动生成模板、批量下发与合规性校验全解析
java·开发语言·人工智能·python·github·php·openclaw