NanoClaw 轻量级 AI 助手搭建教程

NanoClaw 轻量级 AI 助手搭建教程

超轻量级个人 AI 助手,仅 ~4000 行代码,比 OpenClaw 小 99%!

项目简介

NanoClaw (nanobot) 是由 HKUDS 开发的超轻量级 AI 助手:

  • 25,906+ Stars GitHub 热门项目
  • 📏 仅 3,932 行核心代码
  • 🚀 闪电般启动,更低资源占用
  • 🔌 支持多种聊天平台:Telegram、Discord、Feishu、Slack 等

功能特性

功能说明
🤖 AI 对话支持 Claude、GPT、DeepSeek 等模型
🔍 网络搜索集成 Brave Search
🧠 记忆系统持久化对话上下文
📅 定时任务自动执行计划任务
🔌 插件支持MCP 插件系统
💬 多平台Telegram/Discord/飞书/Slack/QQ

快速开始

方式一:pip 安装(推荐)

# 安装
pip install nanobot-ai

# 初始化
nanobot onboard

方式二:源码安装

git clone https://github.com/HKUDS/nanobot.git
cd nanobot
pip install -e .

配置指南

1. 添加 API Key

编辑配置文件 ~/.nanobot/config.json

{
  "providers": {
    "openrouter": {
      "apiKey": "***"
    }
  },
  "agents": {
    "defaults": {
      "model": "anthropic/claude-opus-4-5",
      "provider": "openrouter"
    }
  }
}

2. 获取 API Key

提供商地址
OpenRouterhttps://openrouter.ai/keys
DeepSeekhttps://platform.deepseek.com
Anthropichttps://console.anthropic.com
智谱 GLMhttps://open.bigmodel.cn

对话使用

# 启动对话
nanobot agent

接入聊天平台

Telegram(推荐)

  • 创建机器人
    • 搜索 @BotFather
    • 发送 /newbot
    • 复制 Token
  • 配置
{
  "channels": {
    "telegram": {
      "enabled": true,
      "token": "***",
      "allowFrom": ["YOUR_USER_ID"]
    }
  }
}
  • 启动
nanobot gateway

飞书

{
  "channels": {
    "feishu": {
      "enabled": true,
      "app_id": "YOUR_APP_ID",
      "app_secret": "YOUR_APP_SECRET"
    }
  }
}

Discord

{
  "channels": {
    "discord": {
      "enabled": true,
      "token": "YOUR_D...OKEN"
    }
  }
}

Docker 部署

# docker-compose.yml
version: '3.8'
services:
  nanobot:
    image: ghcr.io/hkuds/nanobot:latest
    volumes:
      - ./config:/root/.nanobot
    environment:
      - NANOBOT_CONFIG=/root/.nanobot/config.json
    restart: unless-stopped
docker-compose up -d

常用命令

命令说明
nanobot agent启动对话模式
nanobot gateway启动网关(多平台)
nanobot onboard初始化配置
nanobot --help查看帮助

总结

NanoClaw 是目前最轻量的 AI 助手方案:

  • ✅ 超轻量(~4000行代码)
  • ✅ 部署简单(pip/Docker)
  • ✅ 多平台支持
  • ✅ 开源免费

GitHub: https://github.com/HKUDS/nanobot

发表回复

后才能评论