Integrating Grok Build with the Turing Platform
Grok Build is xAI's terminal-based AI coding agent. It supports a full-screen TUI, headless command-line runs, and the Agent Client Protocol (ACP), so it can read repositories, run commands, edit files, and manage multi-turn tasks. Because Grok Build accepts custom OpenAI-compatible model endpoints, it can connect directly to the Turing Platform.
This guide uses Turing's turing/grok-4.6 through the v1/chat/completions API. Config parsing and model discovery were verified with Grok Build 1.0.5 and the Turing live China-region environment; to verify an actual inference request, use the optional test command below.
Prerequisites
- A Turing Platform API key (how to get one)
- macOS / Linux / WSL2, or Windows PowerShell
- Permission to set
TURING_API_KEYin the shell that starts Grok Build - The latest stable Grok Build release is recommended; the fields in this guide were verified against 1.0.5
Step 1: Install Grok Build
macOS / Linux / WSL2
curl -fsSL https://x.ai/cli/install.sh | bash
Restart your terminal after installation, or follow the installer's instructions to add ~/.grok/bin to PATH. Verify the installation:
grok --version
Windows PowerShell
irm https://x.ai/cli/install.ps1 | iex
The PowerShell installer adds %USERPROFILE%/.grok/bin to the user PATH. Open a new PowerShell window and run:
grok --version
Step 2: Prepare a Turing API key
Grok Build's custom-model configuration uses env_key to read the environment variable containing your API key. Keep only the environment variable name in the config file, not the key itself.
macOS / Linux / WSL2
Set it for the current shell:
export TURING_API_KEY="your-turing-api-key"
To persist it, add the same line to ~/.zshrc (or ~/.bashrc for bash users), then reload the file:
source ~/.zshrc
You can check whether the variable is set without printing the key:
if [ -n "${TURING_API_KEY:-}" ]; then
echo "TURING_API_KEY is set"
else
echo "TURING_API_KEY is missing"
fi
Windows PowerShell
$env:TURING_API_KEY = "your-turing-api-key"
To persist it as a user environment variable, you can run setx TURING_API_KEY "your-turing-api-key" and then open a new PowerShell window.
Keep the actual key only in your shell configuration, system environment variables, or a secure secret manager. Do not put it in ~/.grok/config.toml, project files, documentation, screenshots, code repositories, or shared chats; the Grok config file should contain only the environment variable name TURING_API_KEY.
Step 3: Configure the custom model
Grok Build's user-level config file is ~/.grok/config.toml (or %USERPROFILE%/.grok/config.toml on Windows). Keep any existing [cli], [marketplace], or other settings. If the file already has a [models] table, merge default into that table instead of declaring the TOML table twice. Append the model block below:
[models]
default = "turing-grok-4.6"
[model."turing-grok-4.6"]
model = "turing/grok-4.6"
base_url = "https://live-turing.cn.llm.tcljd.com/api/v1"
name = "Turing Grok 4.6"
api_backend = "chat_completions"
env_key = "TURING_API_KEY"
[model."turing-grok-4.6"] is the complete TOML table name. Do not write [model.turing-grok-4.6]: TOML splits the dots into nested keys, and Grok Build then treats the final 6 as an unknown field and cannot resolve the default model.
Configuration fields
| Field | Purpose |
|---|---|
[models].default | The model selector used for new sessions; it must match the model table name below |
[model."turing-grok-4.6"] | The selector shown by Grok Build; this alias keeps the picker name separate from the request ID |
model | The model ID sent to the Turing API; keep it exactly as turing/grok-4.6 |
base_url | Turing's OpenAI-compatible root URL; do not append /chat/completions |
api_backend | Request protocol; chat_completions maps to /v1/chat/completions and is Grok's default |
env_key | The environment variable containing your API key; this guide uses TURING_API_KEY |
Set base_url only through /api/v1. Grok Build appends /chat/completions according to api_backend. Although the Turing backend maps this model to xAI's internal grok-4.6, the client must send the public model ID turing/grok-4.6.
If you want Grok Build to estimate compaction against the 500K context window listed in Turing's model catalog, you may add this optional field to the model table:
context_window = 500000
The field is optional; leaving it out does not affect the verified basic configuration.
Step 4: Inspect the config and start Grok
First ask Grok Build to show the config sources and discovered models:
grok inspect
grok models
You should see something like:
Default model: turing-grok-4.6
* turing-grok-4.6 (default)
grok models may also report that it could not refresh the official cli-chat-proxy catalog (for example, when no xAI login is present). This does not affect Turing as long as the custom model is shown as using its own API key and is marked default.
To make one minimal end-to-end inference request (this consumes one API quota unit), run:
grok -p "Reply with exactly OK" -m turing-grok-4.6 --max-turns 1 --no-alt-screen
Interactive TUI
Change into a project directory and start Grok:
cd your-project
grok
You can also choose the model explicitly:
grok -m turing-grok-4.6
Inside an open TUI, switch with /model turing-grok-4.6.
Headless mode
Use headless mode for scripts, automation, and CI:
grok -p "Explain this repository's architecture" -m turing-grok-4.6
For machine-readable output:
grok -p "Review the current changes for potential problems" -m turing-grok-4.6 --output-format streaming-json
ACP / IDE integration
Grok Build can run as an ACP agent for an ACP-capable editor or a custom client:
grok agent --always-approve --model turing-grok-4.6 stdio
--always-approve is suitable when an external client owns permission handling. For interactive use, keep Grok's default per-action confirmation.
Model capabilities and request notes
The Turing model catalog currently lists turing/grok-4.6 as follows:
- Text and image input, with text output
- Tool calling and Thinking support
v1/chat/completions,v1/messages, andv1/responses- 500K-token input and output limits
- Server-side Web Search is marked unsupported by Turing; do not configure this model as Grok's
[models].web_searchmodel
This guide defaults to Chat Completions because it is Grok's default custom-model protocol and the most direct Turing integration. If you switch to responses or messages, verify request-field compatibility with your Grok Build version and the model first.
Prices, cache billing, and model lifecycle can change. Use the live model list as the source of truth. At the time of writing, the catalog shows $2 input, $6 output, and $0.5 cached input per million tokens; requests with ≥200K input tokens use the tiered multiplier, including cached input.
Troubleshooting
| Symptom | What to do |
|---|---|
The default model is missing from grok models | Check that the table header is [model."turing-grok-4.6"] and that [models].default matches it exactly; run grok inspect again |
grok models says No auth credentials for cli-chat-proxy | This is the official catalog refresh notice; proceed if the Turing model says using its own API key |
| HTTP 401 / 403 | Confirm TURING_API_KEY is visible in the shell that starts Grok and contains a valid Turing Platform API key; do not mix a live key with a test URL |
| HTTP 404 | Use https://live-turing.cn.llm.tcljd.com/api/v1 as base_url; keep /v1, and do not append /chat/completions manually |
Model not found / Model not exist | The model field must be the public catalog ID turing/grok-4.6, not the internal upstream ID xai/grok-4.6 |
| Changes do not take effect | Grok reads config at session startup; restart Grok, and remember that an existing session may retain the model it was created with |
References
- Grok Build official documentation - installation, TUI, headless mode, ACP, and custom models
- Turing Platform model list - capabilities, prices, regions, and protocols
- Get a Turing API key
- Chat Completions API
- Responses API