Skip to content

OpenClaw 配置模板(一键复制)

本页提供3cmAPI接入 OpenClaw 所需的 3 个配置文件的完整模板,可直接复制粘贴使用。

使用前请将所有 sk-你的Key 替换为你在 3cmAPI控制台 获取的真实 API Key。


文件 1:~/.openclaw/openclaw.json

这是 OpenClaw 的主配置文件。如果你已有其他提供商,只需将 3cmapi 相关内容合并进去即可。

json
{
  "models": {
    "mode": "merge",
    "providers": {
      "3cmapi": {
        "baseUrl": "https://api.3cm.me",
        "apiKey": "sk-你的Key",
        "api": "anthropic-messages",
        "models": [
          {
            "id": "claude-sonnet-4-6",
            "name": "Claude 4.6 Sonnet",
            "reasoning": false,
            "input": ["text", "image"],
            "contextWindow": 200000,
            "maxTokens": 8192
          },
          {
            "id": "claude-opus-4-6-thinking",
            "name": "Claude 4.6 Opus TK",
            "reasoning": true,
            "input": ["text", "image"],
            "contextWindow": 200000,
            "maxTokens": 8192
          }
        ]
      }
    }
  },
  "auth": {
    "profiles": {
      "3cmapi:default": {
        "provider": "3cmapi",
        "mode": "api_key"
      }
    }
  },
  "agents": {
    "defaults": {
      "model": {
        "primary": "3cmapi/claude-sonnet-4-6",
        "fallbacks": ["3cmapi/claude-opus-4-6-thinking"]
      },
      "models": {
        "3cmapi/claude-sonnet-4-6": { "alias": "sonnet" },
        "3cmapi/claude-opus-4-6-thinking": { "alias": "opus-tk" }
      }
    }
  }
}

文件 2:~/.openclaw/agents/main/agent/models.json

模型定义文件,包含每个模型的详细参数。

json
{
  "providers": {
    "3cmapi": {
      "baseUrl": "https://api.3cm.me",
      "models": [
        {
          "id": "claude-sonnet-4-6",
          "name": "Claude 4.6 Sonnet",
          "reasoning": false,
          "input": ["text", "image"],
          "contextWindow": 200000,
          "maxTokens": 8192,
          "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
          "api": "anthropic-messages"
        },
        {
          "id": "claude-opus-4-6-thinking",
          "name": "Claude 4.6 Opus TK",
          "reasoning": true,
          "input": ["text", "image"],
          "contextWindow": 200000,
          "maxTokens": 8192,
          "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
          "api": "anthropic-messages"
        }
      ]
    }
  }
}

文件 3:~/.openclaw/agents/main/agent/auth-profiles.json

认证密钥存储文件。

json
{
  "version": 1,
  "profiles": {
    "3cmapi:default": {
      "provider": "3cmapi",
      "type": "api_key",
      "key": "sk-你的Key"
    }
  },
  "lastGood": {
    "3cmapi": "3cmapi:default"
  }
}

参数速查表

参数说明
baseUrlhttps://api.3cm.me不带 /v1
apianthropic-messagesAnthropic 原生 messages 端点
reasoning: false普通模式标准响应
reasoning: truethinking 模式深度推理,输出思考过程
contextWindow200000最大上下文窗口
maxTokens8192最大输出 Token
cost0中转站自行计费,无需本地统计