Grok Build の設定
Modelflare APIキー、grok-4.5、Responses API エンドポイントを使って公式 Grok Build CLI を接続します。
1. APIキーを作成
grok-4.5 にアクセスできる Modelflare APIキーを作成します。
2. Grok Build をインストール
Windows PowerShell
irm https://x.ai/cli/install.ps1 | iex
grok version
Linux または macOS
curl -fsSL https://x.ai/cli/install.sh | bash
grok version
3. config.toml を作成
Windows 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
)
Linux または macOS
mkdir -p ~/.grok
cd ~/.grok
cat > config.toml << 'EOF'
[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"
EOF
chmod 600 config.toml
4. APIキーを保存
コマンドを実行する前に、YOUR_MODELFLARE_API_KEY を自分の完全な Modelflare APIキーに置き換えてください。
Windows PowerShell
[Environment]::SetEnvironmentVariable(
"MODELFLARE_API_KEY",
"YOUR_MODELFLARE_API_KEY",
"User"
)
$env:MODELFLARE_API_KEY = "YOUR_MODELFLARE_API_KEY"
Linux
echo 'export MODELFLARE_API_KEY="YOUR_MODELFLARE_API_KEY"' >> ~/.bashrc
source ~/.bashrc
macOS
echo 'export MODELFLARE_API_KEY="YOUR_MODELFLARE_API_KEY"' >> ~/.zshrc
source ~/.zshrc
5. 起動してテスト
Windows PowerShell
Set-Location $HOME
grok -p "Modelflare connected だけを返してください" -m modelflare-grok
grok
Linux または macOS
cd ~
grok -p "Modelflare connected だけを返してください" -m modelflare-grok
grok