codecamp

OpenClaw xAI 提供商配置指南

OpenClaw 内置了用于 Grok 模型的 xAI 提供商插件。

配置

  1. 在 xAI 控制台创建 API 密钥。
  2. 设置 XAI_API_KEY 环境变量,或者运行以下命令:

openclaw onboard --auth-choice xai-api-key

  1. 选择模型,例如:

{
agents: { defaults: { model: { primary: "xai/grok-4" } } },
}

内置模型目录

OpenClaw 开箱即用,已内置以下 xAI 模型系列:

  • grok-4grok-4-0709
  • grok-4-fast-reasoninggrok-4-fast-non-reasoning
  • grok-4-1-fast-reasoninggrok-4-1-fast-non-reasoning
  • grok-4.20-reasoninggrok-4.20-non-reasoning
  • grok-code-fast-1

该插件还会自动解析符合相同 API 格式的新版 grok-4*grok-code-fast* 模型 ID。

网页搜索

内置的 Grok 网页搜索提供商同样使用 XAI_API_KEY

openclaw config set tools.web.search.provider grok

已知限制

  • 目前仅支持 API 密钥鉴权,OpenClaw 暂未支持 xAI 的 OAuth / 设备码流程。
  • grok-4.20-multi-agent-experimental-beta-0304 暂不支持通过标准 xAI 提供商路径接入,因为它需要的上游 API 接口与标准的 OpenClaw xAI 传输层不兼容。
  • xAI 原生的服务端工具(如 x_searchcode_execution),在当前的内置插件中暂未作为一等的模型提供商功能支持。

说明

OpenClaw 会在共享运行路径中,自动应用 xAI 专属的工具 schema 与工具调用兼容性修复。

OpenClaw Volcengine(Doubao)提供商配置指南
OpenClaw 小米 MiMo 提供商配置指南
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

OpenClaw 消息渠道

OpenClaw 工具

OpenClaw 模型

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }