Bỏ qua để đến nội dung
Mở CastalyBảng điều khiển

Trợ lý lập trình

Thiết lập Grok Build

Định cấu hình CLI Grok Build chính thức với điểm cuối API Responses.

Tạo khóa API Modelflare có thể truy cập grok-4.5.

Terminal windowPowerShell
irm https://x.ai/cli/install.ps1 | iex
grok version
Terminal windowPowerShell
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
)

Thay thế YOUR_MODELFLARE_API_KEY bằng khóa API Modelflare hoàn chỉnh của bạn.

Terminal windowPowerShell
[Environment]::SetEnvironmentVariable(
"MODELFLARE_API_KEY",
"YOUR_MODELFLARE_API_KEY",
"User"
)
$env:MODELFLARE_API_KEY = "YOUR_MODELFLARE_API_KEY"
Terminal windowPowerShell
Set-Location $HOME
grok -p "Reply only: Modelflare connected" -m modelflare-grok
grok