1. 安装 Grok Build
到 xAI 官方网站 查阅 Grok Build 当前安装方式,选择与你的系统对应的安装包或命令。安装后重新打开终端并检查:
Shell
grok --version2. 打开 config.toml
PowerShell
$qsConfigDir = Join-Path $HOME '.grok'
New-Item -ItemType Directory -Force $qsConfigDir | Out-Null
$qsConfigFile = Join-Path $qsConfigDir 'config.toml'
if (Test-Path -LiteralPath $qsConfigFile) {
Copy-Item -LiteralPath $qsConfigFile -Destination "$qsConfigFile.$(Get-Date -Format 'yyyyMMdd-HHmmss').bak"
}
notepad $qsConfigFileShell
mkdir -p ~/.grok
if [ -f ~/.grok/config.toml ]; then
cp ~/.grok/config.toml ~/.grok/config.toml.$(date +%Y%m%d-%H%M%S).bak
fi
touch ~/.grok/config.toml
open -e ~/.grok/config.tomlShell
mkdir -p ~/.grok
if [ -f ~/.grok/config.toml ]; then
cp ~/.grok/config.toml ~/.grok/config.toml.$(date +%Y%m%d-%H%M%S).bak
fi
nano ~/.grok/config.toml3. 配置 Responses 入口
以下结构适用于采用该 config.toml 格式的 Grok Build 版本。把 QS_GROK_MODEL 的三处值同时替换为本站实际可用的 Grok 模型 ID:
TOML
[models]
default = "QS_GROK_MODEL"
[endpoints]
models_base_url = "https://qsapi.org/v1"
[model."QS_GROK_MODEL"]
model = "QS_GROK_MODEL"
name = "Qs API Grok"
api_key = "替换为你的_Qs_API_Key"
api_backend = "responses"模型的上下文上限、工具与搜索能力应按实际通道设置,本示例不假定 1M 上下文或联网搜索可用。
4. 启动并检查
Shell
grok