---
title: "Grok CLI with EU-hosted models · Setup guide"
description: "Configure the Grok CLI (Grok Build) to run on open-weight models processed in EU data centres with a custom model entry in ~/.grok/config.toml."
canonical: "https://inference.eu/integrations/grok-cli/"
language: "en"
---

Coding agents · Grok CLI (Grok Build)

# Use the Grok CLI with open-source models hosted in the EU

Grok Build, the coding agent you start with the \`grok\` command, supports custom models from any OpenAI-compatible or Anthropic-compatible endpoint. Add inference.eu as a custom model in config.toml and the agent works on open-weight models processed in European data centres.

[Contact sales](https://inference.eu/contact/)[Setup](#setup)

1.  01API format: OpenAI and Anthropic
2.  02EU data centres
3.  03Covered by one DPA

## Set it up in a few minutes

1.  1

    Create an API key in your inference.eu account and export it as `INFERENCE_EU_API_KEY`.

2.  2

    Open `~/.grok/config.toml` and add a `[model.inference-eu]` table with the model id, the inference.eu base URL, `env_key` and `api_backend = "chat_completions"`.

3.  3

    Set `default` under `[models]` to `inference-eu`, and point `session_summary` at an inference.eu model as well.

4.  4

    Run `grok inspect` to check that Grok picked up the configuration.

5.  5

    Start `grok` in your project, or test headlessly with `grok -p "Hello" -m inference-eu`.

~/.grok/config.toml

```
[model.inference-eu]
model = "qwen3-coder-480b-a35b-instruct"
base_url = "https://api.inference.eu/v1"
name = "Qwen3 Coder 480B (inference.eu)"
env_key = "INFERENCE_EU_API_KEY"
api_backend = "chat_completions"
supports_backend_search = false

[model.inference-eu-glm]
model = "glm-5.3"
base_url = "https://api.inference.eu/v1"
name = "GLM-5.3 (inference.eu)"
env_key = "INFERENCE_EU_API_KEY"
api_backend = "chat_completions"
supports_backend_search = false

[models]
default = "inference-eu"
session_summary = "inference-eu-glm"
```

## What the Grok CLI is

Grok Build is xAI's coding agent for the terminal. You start it with `grok` for a full-screen interactive session, run it headlessly with `grok -p` in scripts, or embed it in other apps through the Agent Client Protocol. It reads and edits files, runs commands, uses MCP servers, skills and hooks, and can split work across subagents.

Grok Build ships with xAI's own models, but its settings reference documents custom models as a first-class option: any endpoint that speaks OpenAI Chat Completions, the Responses API or Anthropic Messages. That is how you connect it to inference.eu.

## How the configuration works

Custom models live in your user config, `~/.grok/config.toml`. Each `[model.<id>]` table defines one model: `model` is the id sent to the API, `base_url` is the inference.eu base URL ending in `/v1`, `env_key` names the variable holding your key, and `api_backend = "chat_completions"` selects the OpenAI format. `name` is the label shown in the model picker.

Under `[models]`, `default` picks the model for new sessions. Grok also uses separate models for session summaries, image descriptions and web search; set `session_summary` to an inference.eu model so those background calls go to inference.eu too. Project-level config files cannot define models, which keeps keys out of repositories.

## Which models to choose

The agent loop relies on reliable tool calls and on following instructions across many steps. `qwen3-coder-480b-a35b-instruct` is a strong default for everyday coding, with precise edits and dependable tool use. `glm-5.3` and `kimi-k3` suit planning, larger refactors and debugging that need more reasoning, and work well for session summaries.

`gpt-oss-120b` responds quickly and fits subagents, headless scripts and short questions. Set `context_window` on each model entry to match the model so that Grok compacts the conversation at the right time. You can restrict the picker to inference.eu models with `allowed_models` under `[models]`.

## Troubleshooting

A 401 error means the key did not reach the endpoint. Check that `INFERENCE_EU_API_KEY` is exported in the shell that starts `grok` and that `env_key` names exactly that variable. A 404 usually comes from a `base_url` with an extra path, or from `api_backend` set to a protocol that does not match the URL.

If tool calls fail or arrive malformed, set `stream_tool_calls = false` on the model; some custom endpoints need it. If web search errors, `supports_backend_search` must stay `false`, since Grok-hosted search tools do not run on other endpoints. `grok inspect` shows which config files and models Grok actually loaded.

## Keeping code and data in the EU

With inference.eu as the model, the files, diffs and command output Grok sends to the model are processed in EU data centres and never used for training. We sign a data processing agreement under Article 28 GDPR, publish our subprocessor list and bill in euros.

Grok Build is an xAI product, and some traffic can still go to xAI: the first-launch sign-in, Grok-hosted web search, and any background task still assigned to a Grok model. Point `session_summary` and `image_description` at inference.eu models, keep `supports_backend_search = false`, and restrict `allowed_models` so that sessions do not fall back to models outside the EU.

## Grok CLI (Grok Build)

Category

Coding agents

Maker

xAI

API format

OpenAI and Anthropic

Processing

EU data centres

Website

[docs.x.ai](https://docs.x.ai/build/overview)

Documentation

[docs.x.ai](https://docs.x.ai/build/settings/reference)

## Grok CLI (Grok Build): common questions

The questions buyers, developers and legal teams ask us most. Something missing? Ask us directly.

Yes. Grok Build supports custom models from any OpenAI-compatible or Anthropic-compatible endpoint. Add a \`\[model.<id>\]\` table to \`~/.grok/config.toml\` with \`model\`, \`base\_url\` and \`env\_key\`, then select it with \`-m\` or \`/model\`.

Use \`chat\_completions\`, the OpenAI Chat Completions format, with the base URL ending in \`/v1\`. \`messages\` selects the Anthropic format, which inference.eu also serves; use the base URL without \`/v1\` in that case. Both reach the same models.

Qwen3 Coder 480B is a strong default for coding sessions. GLM-5.3 and Kimi K3 suit planning, harder debugging and session summaries, and gpt-oss-120b is a quick option for subagents and headless scripts.

Model requests for your custom model go to inference.eu. Sign-in, Grok-hosted web search and background tasks left on Grok models still use xAI. Assign \`session\_summary\` and \`image\_description\` to inference.eu models and keep backend search off to limit this.

No. Project config can only contribute MCP servers, plugins and permissions. Models belong in your user config, \`~/.grok/config.toml\`. This prevents a repository from redirecting your key to an endpoint you did not choose.

Run \`grok -p "your prompt" -m inference-eu\`, adding \`--output-format streaming-json\` for machine-readable output. In CI, expose your key as \`INFERENCE\_EU\_API\_KEY\` and ship the user config with the job so the runner finds your model entries.

Grok-hosted search tools only run on xAI's own endpoint. Keep \`supports\_backend\_search = false\` on inference.eu models; the agent then relies on its client-side tools. If you need search, add an MCP server for a search provider of your choice.

Some custom endpoints handle streamed tool calls differently. Set \`stream\_tool\_calls = false\` on the model entry, or globally under \`\[models\]\`, so Grok requests complete tool calls. Also check that the model you picked supports tool calling.

Set \`allowed\_models\` under \`\[models\]\` to the ids of your inference.eu entries, for example \`\["inference-eu\*"\]\`. The picker, the default and \`-m\` then only accept those models, which keeps all model traffic with inference.eu.

The variable named in \`env\_key\` is empty or holds the wrong key. Export \`INFERENCE\_EU\_API\_KEY\` in the shell that starts \`grok\`, avoid also setting a conflicting inline \`api\_key\`, and check that the key is active in your inference.eu account.

[Ask a question](https://inference.eu/contact/)

## Related

[All integrations](https://inference.eu/integrations/)

-   [Claude CodePoint Claude Code at inference.eu with ANTHROPIC\_BASE\_URL and run it on open-weight models processed in EU data centres. No Anthropic account needed.Coding agents](https://inference.eu/integrations/claude-code/)
-   [OpenAI Codex CLIRun OpenAI's Codex CLI on open-weight models processed in EU data centres. Add a model\_providers block to config.toml and keep code in Europe.Coding agents](https://inference.eu/integrations/openai-codex/)
-   [OpenCodeRun the OpenCode terminal agent on open-weight models processed in EU data centres. Add one provider block to opencode.json and keep your code in Europe.Coding agents](https://inference.eu/integrations/opencode/)

## Move your AI workloads to EU infrastructure

Tell us which models you use and roughly how much traffic you have. We reply within one working day with pricing and next steps.

-   Reply within one working day
-   Pricing for your volume
-   DPA ready to sign
