Skip to content

OpenClaw ​

OpenClaw 是一个开源的个人 AI 助理,可以接入飞书、微信等聊天工具,并通过 Skills 扩展能力。学校的大模型通过 OpenAI 兼容接口接入。

安装 OpenClaw ​

Linux / macOS:

bash
curl -fsSL https://openclaw.ai/install.sh | bash

Windows PowerShell:

powershell
iwr -useb https://openclaw.ai/install.ps1 | iex

更多安装说明请参考 OpenClaw 官方文档。为避免兼容性问题,建议使用最新版本。

配置模型 ​

在 我的令牌 中创建并复制您的 API Key,然后任选一种方式配置。

方式一:使用安装向导 ​

首次安装完成后会自动进入向导;已经安装过的用户可以执行下面的命令重新进入:

bash
openclaw onboard --install-daemon

在向导中依次选择或填写:

  • 安全提示 I understand this is personal-by-default and shared/multi-user use requires lock-down. Continue?:选择 Yes;
  • Setup mode:推荐选择 QuickStart;
  • 模型提供商:选择 Custom Provider(如果列表中没有,在 More… 里找);
  • Base URL:https://chat.ecnu.edu.cn/open/api/v1;
  • API Key:您的 API Key;
  • 接口兼容类型:选择 OpenAI 兼容;
  • Model ID:ecnu-max(或 ecnu-plus);
  • 其余配置(消息渠道、Skills 等)按需设置,新手可以选择 Skip for now。

向导会把提供商 ID 自动命名为 custom-chat-ecnu-edu-cn,并给模型填入偏小的默认值:上下文窗口 128000、单次输出上限 4096,输出上限过小会让较长的回答被截断。向导结束后请执行下面的命令修正(选择 ecnu-plus 时分别改为 256000 和 32000):

bash
openclaw config set 'models.providers.custom-chat-ecnu-edu-cn.models[0].contextWindow' 512000
openclaw config set 'models.providers.custom-chat-ecnu-edu-cn.models[0].maxTokens' 64000

向导一次只能添加一个模型。需要同时使用 ecnu-max 和 ecnu-plus 时,改用下面的方式二更方便。

方式二:编辑配置文件 ​

OpenClaw 的配置文件是 ~/.openclaw/openclaw.json(JSON5 格式,允许注释和结尾逗号)。将下面的内容合并进去,并把 your_api_key 替换为您的 API Key:

json5
{
  env: { vars: { CHATECNU_API_KEY: "your_api_key" } },
  agents: {
    defaults: {
      model: { primary: "chatecnu/ecnu-max" },
      models: {
        "chatecnu/ecnu-max": { alias: "ecnu-max" },
        "chatecnu/ecnu-plus": { alias: "ecnu-plus" },
      },
    },
  },
  models: {
    mode: "merge",
    providers: {
      chatecnu: {
        baseUrl: "https://chat.ecnu.edu.cn/open/api/v1",
        apiKey: "${CHATECNU_API_KEY}",
        api: "openai-completions",
        models: [
          {
            id: "ecnu-max",
            name: "ecnu-max",
            reasoning: false,
            input: ["text", "image"],
            contextWindow: 512000,
            maxTokens: 64000,
          },
          {
            id: "ecnu-plus",
            name: "ecnu-plus",
            reasoning: false,
            input: ["text", "image"],
            contextWindow: 256000,
            maxTokens: 32000,
          },
        ],
      },
    },
  },
}
字段说明
env.vars设置 CHATECNU_API_KEY 环境变量,供下面的 apiKey 引用
agents.defaults.model.primary默认模型,格式为 提供商 ID/模型 ID
models.modemerge 表示在 OpenClaw 自带的模型目录之外追加,不覆盖已有的提供商
api接口协议,openai-completions 对应 /chat/completions 对话接口
reasoning是否按思考模型处理。学校模型的思考模式默认关闭,这里保持 false
input模型接受的输入类型,两个主模型均支持图片
contextWindow / maxTokens上下文窗口与单次输出上限。输出上限取 64K / 32K 是 Agent 场景的推荐值(模型最大输出为 256K / 128K),把更多窗口留给输入,详见 模型介绍

开始使用 ​

在浏览器中打开 Web 界面,在 Chat 页面与 OpenClaw 对话:

bash
openclaw dashboard

在终端中打开 TUI:

bash
openclaw tui

注意:如果要把 OpenClaw 接入飞书、微信等聊天工具,对话内容会经过这些第三方平台,请留意其隐私政策,不要处理敏感数据。

注意:ecnu-max 同时最多处理 3 个请求,ecnu-plus 为 5 个,超出会返回 429,详见 配额限制。

您的请求将按 credits 配额统一处理,详见 配额限制。