OpenClaw 配置指南

本指南将帮助你配置 OpenClaw 使用 YY52 服务。

什么是 OpenClaw?

OpenClaw 是一个强大的 AI 编程助手,支持多种模型和提供商。通过简单的配置,你可以让 OpenClaw 使用 YY52 提供的 Claude 模型。

开始之前

请确保你已准备好:

配置步骤

1
创建配置文件

将以下配置保存到 ~/.openclaw/openclaw.json 文件:

{
  "meta": {
    "lastTouchedVersion": "2026.2.2"
  },
  "models": {
    "mode": "merge",
    "providers": {
      "anthropic": {
        "baseUrl": "https://yy.52ai.ai",
        "apiKey": "sk-你的API密钥",
        "auth": "api-key",
        "api": "anthropic-messages",
        "headers": {},
        "authHeader": true,
        "models": [
          {
            "id": "claude-opus-4-6",
            "name": "Claude Opus 4.6",
            "api": "anthropic-messages",
            "reasoning": false,
            "input": ["text"],
            "cost": {"input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0},
            "contextWindow": 200000,
            "maxTokens": 16384,
            "compat": {
              "supportsStore": true,
              "supportsDeveloperRole": true,
              "supportsReasoningEffort": true
            }
          },
          {
            "id": "claude-opus-4-5-20251101",
            "name": "Claude Opus 4.5",
            "api": "anthropic-messages",
            "reasoning": false,
            "input": ["text"],
            "cost": {"input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0},
            "contextWindow": 200000,
            "maxTokens": 8192,
            "compat": {
              "supportsStore": true,
              "supportsDeveloperRole": true,
              "supportsReasoningEffort": true
            }
          },
          {
            "id": "claude-sonnet-4-6",
            "name": "Claude Sonnet 4.6",
            "api": "anthropic-messages",
            "reasoning": false,
            "input": ["text"],
            "cost": {"input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0},
            "contextWindow": 200000,
            "maxTokens": 16384,
            "compat": {
              "supportsStore": true,
              "supportsDeveloperRole": true,
              "supportsReasoningEffort": true
            }
          },
          {
            "id": "claude-sonnet-4-5-20250929",
            "name": "Claude Sonnet 4.5",
            "api": "anthropic-messages",
            "reasoning": false,
            "input": ["text"],
            "cost": {"input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0},
            "contextWindow": 200000,
            "maxTokens": 8192,
            "compat": {
              "supportsStore": true,
              "supportsDeveloperRole": true,
              "supportsReasoningEffort": true
            }
          },
          {
            "id": "claude-haiku-4-5-20251001",
            "name": "Claude Haiku 4.5",
            "api": "anthropic-messages",
            "reasoning": false,
            "input": ["text"],
            "cost": {"input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0},
            "contextWindow": 200000,
            "maxTokens": 8192,
            "compat": {
              "supportsStore": true,
              "supportsDeveloperRole": true,
              "supportsReasoningEffort": true
            }
          }
        ]
      }
    }
  },
  "agents": {
    "defaults": {
      "model": {
        "primary": "anthropic/claude-sonnet-4-5-20250929"
      },
      "models": {
        "anthropic/claude-opus-4-6": {"alias": "opus4.6"},
        "anthropic/claude-opus-4-5-20251101": {"alias": "opus"},
        "anthropic/claude-sonnet-4-6": {"alias": "sonnet4.6"},
        "anthropic/claude-sonnet-4-5-20250929": {"alias": "sonnet"},
        "anthropic/claude-haiku-4-5-20251001": {"alias": "haiku"}
      },
      "workspace": "~/.openclaw/workspace",
      "maxConcurrent": 4,
      "subagents": {
        "maxConcurrent": 8
      }
    }
  },
  "messages": {
    "ackReactionScope": "group-mentions"
  },
  "commands": {
    "native": "auto",
    "nativeSkills": "auto",
    "restart": true
  },
  "gateway": {
    "port": 18789,
    "mode": "local",
    "bind": "loopback",
    "auth": {
      "mode": "token"
    },
    "tailscale": {
      "mode": "off",
      "resetOnExit": false
    }
  }
}
2
替换 API 密钥

将配置中的 sk-你的API密钥 替换为你在 密钥管理界面 获取的真实 API 密钥。

请确保 API 密钥正确无误,以 sk- 开头。

3
重启 Gateway

保存配置文件后,运行以下命令重启 Gateway:

openclaw gateway restart

支持的模型

YY52 目前支持以下 Claude 模型:

配置说明

常见问题

无法连接?

请检查以下几点:

如何切换模型?

修改配置文件中 agents.defaults.model.primary 字段,可选值:

下一步

配置完成后,你可以探索更多功能: