跳转到内容
打开 Castaly控制台

接入编程助手

Grok Build 接入

使用 Responses API 入口配置官方 Grok Build CLI。

在 Modelflare 创建一个可以访问 grok-4.5 的 API Key。

终端窗口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 Key。

终端窗口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 "请只回复:Modelflare connected" -m modelflare-grok
grok