xAI / Grok

Overview

xAI’s Grok is a first-class direct AI provider, configured the same way as Anthropic and OpenAI on its provider detail page under External Services. It is treated as a standard token-billed provider in capability-tier routing — not special-cased — and it carries the same sensitivity-clearance and grant gating as every other external provider.

Two models are seeded for routing:

Model Class Best for Context
Grok 4.3 reasoning Reasoning, analysis, long-context, tool use 1M tokens
Grok Build 0.1 code Agentic coding, web dev, Build Studio tasks, tool use 256K tokens

Both support tool use, streaming, structured output, images, thinking, and prompt caching. Because Build Studio OAuth connections can’t call xAI’s /v1/models discovery endpoint, these are seeded known models rather than discovered dynamically.

Authentication

Grok supports two authentication methods. Choose either on the provider detail page; you can switch between them at any time.

Obtaining an xAI API key from console.x.ai is poor UX, especially for a non-technical operator. Grok’s CLI ships a clean OAuth 2.0 device-code flow, and the platform drives it for you rather than reimplementing xAI’s OAuth in-portal:

  1. On the xAI provider page, click Sign in to Grok (or let a coworker start it — see below).
  2. The platform runs grok login --device-auth in the build sandbox and shows you a verification URL (accounts.x.ai/oauth2/device) plus a user code.
  3. Open the URL in your browser, sign in with the account method you already use (Google / X / Apple), and confirm the code.
  4. The platform reads the resulting ~/.grok/auth.json out of the sandbox, stores it encrypted as the xai credential, and activates the provider.

On each Build Studio dispatch, the stored credential is injected into the build sandbox’s ~/.grok/auth.json and the CLI self-refreshes it; the platform reads the refreshed token back out and persists it so the next build uses the latest token.

API key

The standard pay-per-token path: obtain a key from console.x.ai and paste it into the provider detail page. The platform sends it as the Authorization header against https://api.x.ai/v1. When the stored credential is an API key rather than an auth.json blob, dispatch falls back to XAI_API_KEY.

Coworker-driven setup

Because the device-code flow runs entirely through governed tools, an AI coworker can drive Grok setup on your behalf instead of you navigating the provider page:

Both tools require the manage_provider_connections capability and are recorded in the tool-execution log like any other governed action.

Sensitivity Clearance

Like all external providers, Grok is assigned a sensitivity-clearance set (public, internal, confidential, restricted) on its provider page. Routing’s hard filter refuses to send a request to Grok for data whose sensitivity its clearance does not cover. Local models remain the default for restricted data.

Cost Model

Grok uses a per-token cost model. Configured-provider usage flows into the Finance module through the Finance Bridge, so Grok spend appears alongside other AI providers under /finance/spend/ai.

Troubleshooting