跳到內容
開放式卡斯塔利控制台

程式設計助手

Grok Build 設定

使用 Responses API 端點設定官方 Grok Build CLI。

建立可以存取 grok-4.5 的 Modelflare API 金鑰。

終端機視窗PowerShell
irm https://x.ai/cli/install.ps1 | iex
grok version
終端機視窗PowerShell
New-Item -ItemType Directory -Force "$HOME\.grok" | Out-Null
Set-Location "$HOME\.grok"
$config = @'
[models]
default = "modelflare-grok"
[model.modelflare-grok]
model = "grok-4.5"
base_url = "https://modelflare.dev/v1"
name = "Modelflare Grok 4.5"
env_key = "MODELFLARE_API_KEY"
api_backend = "responses"
'@
$utf8NoBom = New-Object System.Text.UTF8Encoding -ArgumentList $false
[System.IO.File]::WriteAllText(
(Join-Path (Get-Location) "config.toml"),
$config,
$utf8NoBom
)

將 YOUR_MODELFLARE_API_KEY 替換為完整的 Modelflare API 金鑰。

終端機視窗PowerShell
[Environment]::SetEnvironmentVariable(
"MODELFLARE_API_KEY",
"YOUR_MODELFLARE_API_KEY",
"User"
)
$env:MODELFLARE_API_KEY = "YOUR_MODELFLARE_API_KEY"
終端機視窗PowerShell
Set-Location $HOME
grok -p "Reply only: Modelflare connected" -m modelflare-grok
grok