1. 先按协议分组

同一个 GitHub Copilot 账户可能返回多种模型,但模型支持的端点并不相同。先查看 /v1/models/full/,再把模型放入对应 Provider:

  • openai-responses:模型支持 /responses
  • openai-completions:模型支持 /v1/chat/completions
  • anthropic-messages:模型支持 /v1/messages

2. Provider 示例

JSON fragment
{
  "models": {
    "mode": "merge",
    "providers": {
      "ghc-responses": {
        "baseUrl": "http://127.0.0.1:8313/v1",
        "apiKey": "1",
        "api": "openai-responses",
        "models": [{
          "id": "YOUR_RESPONSES_MODEL_ID",
          "name": "Responses model",
          "reasoning": true,
          "input": ["text", "image"],
          "contextWindow": 128000,
          "maxTokens": 16384,
          "cost": {"input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0}
        }]
      },
      "ghc-messages": {
        "baseUrl": "http://127.0.0.1:8313",
        "apiKey": "1",
        "api": "anthropic-messages",
        "models": [{
          "id": "YOUR_MESSAGES_MODEL_ID",
          "name": "Messages model",
          "reasoning": true,
          "input": ["text", "image"],
          "contextWindow": 128000,
          "maxTokens": 16384,
          "cost": {"input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0}
        }]
      }
    }
  }
}

如果 OpenClaw 与 ghc-api 位于不同容器,127.0.0.1 指向的是 OpenClaw 容器本身。应改用 compose service name(例如 http://ghc-api:8313)或宿主机可达地址。

3. 不要照抄价格和上下文数字

contextWindowmaxTokensinputreasoning 会影响 OpenClaw 如何构造请求与管理上下文。应基于实时模型元数据填写。cost 主要用于客户端估算;不确定时使用 0,避免制造虚假的账单精度。

Base URL 随协议不同。

OpenAI 兼容 Provider 通常写到 /v1;Anthropic Messages Provider 通常写服务根地址。最终以 OpenClaw 当前版本对该 API adapter 的约定为准。

4. 排错

  1. 容器环境先测试网络连通性。
  2. 确认模型位于正确 Provider,端点与 API 类型一致。
  3. 鉴权开启时使用批准后的 Token,不要继续使用占位值。
  4. 检查 ghc-api Dashboard 的实际路径和请求体。
  5. 升级 OpenClaw 后如配置 schema 变化,以其官方文档为准。

延伸阅读:OpenClaw model providers ↗

下一步

先查看当前账户真实可用的模型和端点,再把模型 ID 填入客户端配置。

查看模型与参数 →