Asisten pemrograman
Penyiapan Grok Build
Konfigurasikan CLI Grok Build resmi dengan titik akhir Responses API.
1. Buat kunci API
Section titled “1. Buat kunci API”Buat kunci API Modelflare yang dapat mengakses grok-4.5.
2. Instal Grok Build
Section titled “2. Instal Grok Build”irm https://x.ai/cli/install.ps1 | iexgrok versioncurl -fsSL https://x.ai/cli/install.sh | bashgrok version3. Buat config.toml
Section titled “3. Buat config.toml”New-Item -ItemType Directory -Force "$HOME\.grok" | Out-NullSet-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)mkdir -p ~/.grokcd ~/.grokcat > 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"EOFchmod 600 config.toml4. Simpan kunci API Anda
Section titled “4. Simpan kunci API Anda”Ganti YOUR_MODELFLARE_API_KEY dengan kunci API Modelflare lengkap Anda.
[Environment]::SetEnvironmentVariable( "MODELFLARE_API_KEY", "YOUR_MODELFLARE_API_KEY", "User")$env:MODELFLARE_API_KEY = "YOUR_MODELFLARE_API_KEY"echo 'export MODELFLARE_API_KEY="YOUR_MODELFLARE_API_KEY"' >> ~/.bashrcsource ~/.bashrcecho 'export MODELFLARE_API_KEY="YOUR_MODELFLARE_API_KEY"' >> ~/.zshrcsource ~/.zshrc5. Mulai dan uji
Section titled “5. Mulai dan uji”Set-Location $HOMEgrok -p "Reply only: Modelflare connected" -m modelflare-grokgrokcd ~grok -p "Reply only: Modelflare connected" -m modelflare-grokgrok