Grok Build CLIGrok 4.7.
Follow these steps in a terminal window. Choose your computer below.
Before you start
Have your API key and some Outrun credit ready. Keep your key private.
Open your computer’s Terminal app. Commands below are for this window.
Optional setup helperUse an AI assistant to walk through these steps
Copy the setup instructions into an AI assistant you already use. Review any file changes it suggests before allowing them.
Enter your API key directly in the app or local settings. Keep it out of the assistant’s chat.
Connection settingsShow
API address in custom model: https://api.outrun.to/v1
Key variable: OUTRUN_API_KEY
First model entry: outrun-grokGet your key from Outrun → API keys and enter it privately in the app or local settings. Test with “Reply with OK only.” Tests use credit; check Activity before retrying.
Setup Steps
- 1Install Grok Build
Open Commands and settings below. Follow the official Install Command for the computer you selected, then reopen your terminal.
- 2Open the settings file
Find ~/.grok/config.toml. Open your home folder in the file manager and show hidden files (often Ctrl+H). ~ means your home folder; folders starting with a dot are hidden. Open the file in a text editor. If the folder or file is missing, create it.
- 3Add the Outrun settings
Open Commands and settings below and copy the Configuration Template into this file. If the file already has settings, keep them and add only the Outrun provider/settings block. Save the file. Do not paste JSON or TOML settings into the terminal.
- 4Enter your key privately
Use the Environment Setup commands for your computer below. Replace KEY with your own Outrun key in your local terminal or settings file. Never put the key in an AI chat or screenshot.
- 5Reopen and test
Run grok inspect first and check that outrun-grok is listed. Then run grok -p "Reply with OK only" -m outrun-grok. This route is still being qualified; keep the existing service notes below in mind.
Commands and settings for LinuxShow
curl -fsSL https://x.ai/cli/install.sh | bash# Put your key in the OUTRUN_API_KEY variable (replace KEY with your own key).
# Add the line to whichever shell files you use, then open a new terminal.
echo 'export OUTRUN_API_KEY="KEY"' >> ~/.zshrc
echo 'export OUTRUN_API_KEY="KEY"' >> ~/.bashrc
source ~/.zshrc 2>/dev/null || source ~/.bashrc
# Check (prints only the first characters):
Replace KEY with your own key only in your local app, editor or terminal. Never send that key to an AI chat. Copy one command block at a time.
Configuration Template
# ~/.grok/config.toml (Windows: %USERPROFILE%\.grok\config.toml)
[model.outrun-grok]
model = "grok-4.7"
base_url = "https://api.outrun.to/v1"
name = "Grok 4.7 (Outrun)"
env_key = "OUTRUN_API_KEY"
api_backend = "chat_completions"
[model.outrun-grok-47]
model = "grok-4.7"
base_url = "https://api.outrun.to/v1"
name = "Grok 4.7 (Outrun)"
env_key = "OUTRUN_API_KEY"
api_backend = "chat_completions"
[models]
default = "outrun-grok"Optional: test with a script (uses credit)Show
curl https://api.outrun.to/v1/chat/completions \
-H "Authorization: Bearer $OUTRUN_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"grok-4.7","messages":[{"role":"user","content":"Reply with OK only."}],"max_tokens":16}' If something goes wrong
Key missing or rejected (401)
Copy your current key from API keys. Paste it only into the app’s key field or your local key variable, then save and reopen the app.
Not enough available credit (402)
Check Balance and the key’s spending cap. Another request may have temporarily reserved credit; read the message before adding funds.
Wrong URL, model or limit (400/404)
Copy the exact values above. Do not add an operation such as /chat/completions to a Base URL. For GLM, context is 1000000 and maximum output is 65536.
Busy or rate limited (429)
Wait for the active request to finish or the rate limit to reset. Avoid repeatedly submitting the same request.
Interrupted request or uncertain charge
Check Activity first. Keep the request ID for support; never include your key in a message or screenshot.
Model choices and service notes
Grok Build reaches Outrun through a custom model entry in ~/.grok/config.toml. This setup has not been fully tested with Outrun yet; if tool calls misbehave, use grok-4.7 through OpenCode instead. If a request returns 402, check your account balance and key spending cap. For 429, read the error: wait for the active request to finish or the rate limit to reset. If a paid request is interrupted or its outcome is uncertain, check Activity before trying again; do not automatically repeat it. Choose an available model from Models & Pricing; paused models cannot be used.