BeansAI
模型定价文档
登录注册
模型定价文档
登录注册

快速接入

  • 概览

客户端

  • Claude Code
  • CC Switch
  • OpenClaw
  • Roo Code
  • OpenCode
  • Codex CLI
  • GPT Image 2
  • Seedance 2.0
  • SkyReels V4
  • Mureka Song
  • Cursor
  • Cherry Studio

参考

  • 原生 API
← 返回文档首页

OpenClaw

带 Web UI 的 AI 编程助手。把它配成 Custom Provider 指向 BeansAI。

概览

OpenClaw 是一款同时提供 Web UI 和命令行的 AI 编程助手。它支持把任意 OpenAI 或 Anthropic 兼容端点配置为 Custom Provider。对于 BeansAI,当前最稳妥的接法是走 OpenAI-compatible,并把默认模型设为 gpt-5.5。

环境要求

安装前先确认 node --version 输出的版本 ≥ 22。

安装

shell
npm install -g openclaw@latest

配置

第一步 —— 先写配置文件。

把下面这份配置写到 ~/.openclaw/openclaw.json。Windows 原生路径是 %USERPROFILE%\.openclaw\openclaw.json。

~/.openclaw/openclaw.json
{
  "agents": {
    "defaults": {
      "model": {
        "primary": "custom-api-beansai-dev/gpt-5.5"
      }
    }
  },
  "models": {
    "providers": {
      "custom-api-beansai-dev": {
        "baseUrl": "https://api.beansai.dev/v1",
        "apiKey": "sk-beans-...",
        "api": "openai-completions",
        "models": [
          {
            "id": "gpt-5.5",
            "name": "GPT-5.5",
            "contextWindow": 200000,
            "maxTokens": 8192
          },
          {
            "id": "gpt-5.1",
            "name": "GPT-5.1",
            "contextWindow": 400000,
            "maxTokens": 128000
          },
          {
            "id": "gpt-5.2",
            "name": "GPT-5.2",
            "contextWindow": 400000,
            "maxTokens": 128000
          },
          {
            "id": "gpt-5.3-codex-spark",
            "name": "GPT-5.3 Codex Spark",
            "contextWindow": 128000,
            "maxTokens": 16384
          }
        ]
      }
    }
  }
}

把 contextWindow 改为 200000,maxTokens改为 8192。api 字段必须是 openai-completions, 这样 OpenClaw 才会走 OpenAI 兼容的 /chat/completions 端点;同时用agents.defaults.model.primary 把默认模型固定为 gpt-5.5。 当前 schema 还要求 models[] 里的 name 字段必须存在, 不能省略。

第二步 —— 启动前先校验配置。

shell
openclaw config validate

第三步 —— 校验通过后再运行初始化。

shell
openclaw onboard --install-daemon

如果你不想先手写 JSON,而是想全程走交互式向导,就按下面这些选项填写:

  • Install daemon? 选 yes
  • Onboarding mode:选第一项
  • Model/auth provider:Custom Provider (Any OpenAI or Anthropic compatible endpoint)
  • API Base URL:https://api.beansai.dev/v1
  • API Key:你的 BeansAI 密钥(以 sk-beans- 开头)
  • Endpoint compatibility:OpenAI-compatible (Uses /chat/completions)
  • Model ID:gpt-5.5
  • Endpoint ID:保留默认
  • Model alias(可选):例如 gpt55
  • 初次使用 QuickStart / Skills / Hooks 都可以跳过
  • How do you want to hatch your bot?Open the Web UI

Windows

OpenClaw 目前支持原生 Windows,但官方仍更推荐 WSL2 作为日常编码环境。 如果你继续用原生 Windows,直接用上面的 PowerShell / CMD 命令即可。

openclaw onboard --install-daemon 会先尝试注册后台任务;如果 Windows 环境限制了这条路径,OpenClaw 会回退到登录后通过 Startup 启动。

基础用法

初始化完成后,浏览器会自动打开 Web UI。新建一段对话,选择刚才配置的模型即可开始使用。 OpenClaw 会像 BeansAI 控制台一样记录会话和费用。

shell
# Step 1: Install OpenClaw
npm install -g openclaw@latest

# Step 2: Validate config
openclaw config validate

# Step 3: Initialize
openclaw onboard --install-daemon

# If you use the interactive wizard instead of pasting the JSON below,
# configure it like this:
# - Install daemon: yes
# - Onboarding mode: first option
# - Model/auth provider: Custom Provider (Any OpenAI or Anthropic compatible endpoint)
# - API Base URL: https://api.beansai.dev/v1
# - API Key: sk-beans-...
# - Endpoint compatibility: OpenAI-compatible (Uses /chat/completions)
# - Model ID: gpt-5.5
# - Model alias (optional): gpt55
# - Hatch bot: Open the Web UI

# Step 4: Start OpenClaw
openclaw

使用技巧

  • 想加入更多模型,在 models 数组里继续追加即可 ——BeansAI 目录中的任意模型 ID 都支持。
  • 第一次使用建议先做一次简单对话,确认 key、Base URL、模型 ID 都配置正确,再处理正式任务。如果 openclaw 无法启动,先重新执行 openclaw config validate。
  • 这套 OpenAI-compatible 配置里,JSON 里的 baseUrl 要保留 /v1 后缀。