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 "Reply only: Modelflare connected" -m modelflare-grok
grok

Linux 또는 macOS

cd ~
grok -p "Reply only: Modelflare connected" -m modelflare-grok
grok