xai provider plugin for Grok models. The
recommended path is Grok OAuth with an eligible SuperGrok or X Premium
subscription. Gateway, config, routing, and tools stay local; only Grok
requests go to xAI’s API.
OAuth does not require an xAI API key or the Grok Build app. xAI may still
show Grok Build on the consent screen because OpenClaw uses xAI’s shared
OAuth client.
Setup
1
New install
Run onboarding with daemon install, then pick xAI/Grok OAuth at the
model/auth step:On a VPS or over SSH, select xAI OAuth directly; it uses device-code
verification and does not need a localhost callback:
2
Existing install
Sign in to xAI only; do not rerun full onboarding just to connect Grok:Apply Grok as the default model separately:Rerun full onboarding only if you intentionally want to change Gateway,
daemon, channel, workspace, or other setup choices.
3
API-key path
API-key setup still works for xAI Console keys and for media surfaces
that need key-backed provider config:
4
Pick a model
OpenClaw uses the xAI Responses API as the bundled xAI transport. The same
credential from
openclaw models auth login --provider xai --method oauth or
--method api-key also powers web_search (provider id grok), x_search,
code_execution, speech/transcription, and xAI image/video generation. If you
store an xAI key under plugins.entries.xai.config.webSearch.apiKey, the
bundled xAI model provider reuses it as a fallback too.OAuth troubleshooting
-
For SSH, Docker, VPS, or other remote setups, use
openclaw models auth login --provider xai --method oauth; it uses device-code verification, not a localhost callback. -
If sign-in succeeds but Grok is not the default model, run
openclaw models set xai/grok-4.3. -
Inspect saved xAI auth profiles:
- xAI decides which accounts can receive OAuth API tokens. If an account is not eligible, use the API-key path or check the subscription on xAI’s side.
Built-in catalog
Selectable ids in model pickers. The plugin still resolves older Grok 3, Grok 4, Grok 4 Fast, Grok 4.1 Fast, and Grok Code ids for existing configs; see legacy compatibility and moving aliases.Feature coverage
The bundled plugin maps supported xAI APIs onto OpenClaw’s shared provider and tool contracts. Capabilities that do not fit the shared contract are listed below or under known limits.OpenClaw uses xAI’s REST image/video/TTS/STT APIs for media generation and
batch transcription, xAI’s streaming STT WebSocket for live voice-call
transcription, xAI’s Grok Voice Agent WebSocket for Talk realtime sessions,
and the Responses API for chat, search, and code-execution tools.
Legacy fast-mode compatibility
/fast on or agents.defaults.models["xai/<model>"].params.fastMode: true
still rewrites older xAI configurations as follows. These target ids are
kept only for compatibility; use current selectable models for new
configurations.
Legacy compatibility and moving aliases
Older aliases normalize as follows:
The dated 0309 ids are the selectable catalog entries. OpenClaw sends all other
current Grok 4.20 aliases verbatim so xAI retains control of stable, latest,
beta, experimental, and dated alias semantics. The global
grok-latest alias is
also preserved verbatim.
xAI retired the following exact ids. OpenClaw keeps them as hidden compatibility
rows for shipped configurations, with the limits and pricing of their current
redirect targets:
openclaw doctor --fix updates persisted xAI server-tool defaults and the
retired quality image slug, removes stale generated catalog rows, and repairs
stale context metadata on active 4.20 rows. It does not pin active 4.20
beta-latest aliases to a dated snapshot.
Features
Web search
Web search
The bundled
grok web-search provider prefers xAI OAuth, then falls back
to XAI_API_KEY or a plugin web-search key:Video generation
Video generation
The bundled
xai plugin registers video generation through the shared
video_generate tool.- Default model:
xai/grok-imagine-video - Additional model:
xai/grok-imagine-video-1.5 - Classic modes: text-to-video, image-to-video, reference-image generation, remote video edit, and remote video extension
- Video 1.5 mode: image-to-video only, with exactly one first-frame image
- Aspect ratios:
1:1,16:9,9:16,4:3,3:4,3:2,2:3; classic and Video 1.5 image-to-video inherit the source image ratio when omitted - Resolutions: classic
480P/720P; Video 1.5 also supports1080P; all generation modes default to480P - Duration: 1-15 seconds for generation/image-to-video, 1-10 seconds when
using classic
reference_imageroles, 2-10 seconds for classic extension - Reference-image generation: set
imageRolestoreference_imagefor every supplied image; xAI accepts up to 7 such images - Video edit/extend inherit the input video’s aspect ratio and resolution; those operations do not accept geometry overrides
- Default operation timeout: 600 seconds unless
video_generate.timeoutMsoragents.defaults.videoGenerationModel.timeoutMsis set
grok-imagine-video-1.5-preview and
grok-imagine-video-1.5-2026-05-30 identifiers. OpenClaw forwards the
selected identifier unchanged, but applies the same image-only validation.To use xAI as the default video provider:See Video Generation for shared tool
parameters, provider selection, and failover behavior.
Image generation
Image generation
The bundled
xai plugin registers image generation through the shared
image_generate tool.- Default image model:
xai/grok-imagine-image - Additional model:
xai/grok-imagine-image-quality - Modes: text-to-image and reference-image edit
- Reference inputs: one
imageor up to threeimages - Aspect ratios:
1:1,16:9,9:16,4:3,3:4,3:2,2:3,2:1,1:2,19.5:9,9:19.5,20:9,9:20 - Resolutions:
1K,2K - Count: up to 4 images
- Default operation timeout: 600 seconds unless
image_generate.timeoutMsoragents.defaults.imageGenerationModel.timeoutMsis set
b64_json image responses so generated media can be
stored and delivered through the normal channel attachment path. Local
reference images are converted to data URLs; remote http(s) references
pass through unchanged.To use xAI as the default image provider:xAI also documents
quality, mask, user, and an auto aspect ratio.
OpenClaw forwards only the shared cross-provider image controls today;
these native-only knobs are not exposed through image_generate.Text-to-speech
Text-to-speech
The bundled
xai plugin registers text-to-speech through the shared tts
provider surface.- Voices: authenticated live catalog from xAI; list it with
openclaw infer tts voices --provider xai - Offline fallback voices:
ara,eve,leo,rex,sal - Default voice:
eve - Account custom voice IDs are forwarded even when they are absent from the built-in catalog response
- Formats:
mp3,wav,pcm,mulaw,alaw - Language: BCP-47 code or
auto - Speed: provider-native speed override
- Native Opus voice-note format is not supported
OpenClaw uses xAI’s batch
/v1/tts endpoint for buffered synthesis,
authenticated /v1/tts/voices catalog discovery, and native
wss://api.x.ai/v1/tts for streaming synthesis. Streaming is restricted to
the native api.x.ai host, so custom baseUrl values are rejected on this
path. It uses the existing language, voice, codec, and speed controls; xAI
defaults apply to sample rate and bit rate. Audio-file synthesis honors all
configured codecs. Voice-note targets use MP3 for streaming and buffered
fallback because xAI’s raw codecs do not carry codec/rate metadata. The
stream sends text.delta then
text.done, receives audio.delta, audio.done, or error, and applies an
idle timeoutMs that refreshes for every audio chunk. It is separate from
realtime voice sessions. See xAI’s Streaming TTS API contract.Speech-to-text
Speech-to-text
The bundled Language can be supplied through the shared audio media config or per-call
transcription request. Prompt hints are accepted by the shared OpenClaw
surface, but the xAI REST STT integration forwards only file and language
because those map to the current public xAI endpoint.
xai plugin registers batch speech-to-text through OpenClaw’s
media-understanding transcription surface.- Endpoint: xAI REST
/v1/stt - Input path: multipart audio file upload
- Model selection: xAI chooses the transcription model internally; the endpoint has no model selector
- Used wherever inbound audio transcription reads
tools.media.audio, including Discord voice-channel segments and channel audio attachments
Streaming speech-to-text
Streaming speech-to-text
The bundled Provider-owned config lives under
xai plugin also registers a realtime transcription provider
for live voice-call audio.- Endpoint: xAI WebSocket
wss://api.x.ai/v1/stt - Default encoding:
mulaw - Default sample rate:
8000 - Default endpointing:
800ms - Interim transcripts: enabled by default
plugins.entries.voice-call.config.streaming.providers.xai. Supported
keys are apiKey, baseUrl, sampleRate, encoding (pcm, mulaw, or
alaw), interimResults, endpointingMs, and language.This streaming provider is for Voice Call’s realtime transcription path.
Discord voice records short segments and uses the batch
tools.media.audio transcription path instead.Realtime voice (Talk)
Realtime voice (Talk)
The bundled Provider-owned config also resolves from
xai plugin registers Grok Voice Agent realtime sessions for
Talk mode through the shared registerRealtimeVoiceProvider contract.- Endpoint:
wss://api.x.ai/v1/realtime?model=<voice-model> - Default model:
grok-voice-latest - Default voice:
eve - Transport:
gateway-relay(iOS, Android, and Control UI relay paths) - Audio: PCM16 24 kHz or G.711 µ-law 8 kHz
- Barge-in: xAI server VAD interrupts the response; OpenClaw clears queued playback and truncates unplayed provider history
plugins.entries.voice-call.config.realtime.providers.xai when Voice Call
or shared realtime selectors reuse the same provider map. Supported keys are
apiKey, baseUrl, model, voice, vadThreshold, silenceDurationMs,
prefixPaddingMs, reasoningEffort, and sessionResumption.
reasoningEffort accepts only high or none, matching the xAI Voice Agent API.xAI’s server VAD always creates responses and handles audio interruption.
Use consultRouting: "provider-direct"; forced transcript routing and disabling
input-audio interruption are not supported by the xAI Voice Agent protocol.xAI OAuth or
XAI_API_KEY can authenticate realtime voice. Browser-owned
WebRTC is not part of this provider surface yet; use gateway-relay Talk on
native nodes or the Control UI relay path.sessionResumption defaults to false. When set to true, OpenClaw asks
xAI to retain enough session state to resume the same conversation after a
reconnect and then reconnects with the returned conversation id. Leave it
disabled when provider-side replay/retention is not acceptable; interrupted
sockets then fail closed instead of silently starting a fresh conversation.x_search configuration
x_search configuration
The bundled xAI plugin exposes
x_search as an OpenClaw tool for
searching X (formerly Twitter) content via Grok.Config path: plugins.entries.xai.config.xSearchCode execution configuration
Code execution configuration
The bundled xAI plugin exposes
code_execution as an OpenClaw tool for
remote code execution in xAI’s sandbox environment.Config path: plugins.entries.xai.config.codeExecutionThis is remote xAI sandbox execution, not local
exec.Known limits
Known limits
- xAI auth can use an API key, environment variable, plugin config fallback, or OAuth with an eligible xAI account. OAuth uses device-code verification without a localhost callback. xAI decides which accounts can receive OAuth API tokens, and the consent page may show Grok Build even though OpenClaw does not require the Grok Build app.
- OpenClaw does not currently expose the xAI multi-agent model family. xAI serves these models through the Responses API, but they do not accept the client-side or custom tools used by OpenClaw’s shared agent loop. See the xAI multi-agent limitations.
- xAI Realtime voice currently exposes gateway-relay Talk transport only. Browser-owned provider WebSocket sessions are not wired in the Control UI yet.
- xAI image
quality, imagemask, and extra native-only aspect ratios are not exposed until the sharedimage_generatetool has corresponding cross-provider controls.
Advanced notes
Advanced notes
- OpenClaw applies xAI-specific tool-schema and tool-call compatibility fixes automatically on the shared runner path.
- Native xAI requests default
tool_stream: true. Setagents.defaults.models["xai/<model>"].params.tool_streamtofalseto disable it. - The bundled xAI wrapper strips unsupported contains-count schema bounds
and unsupported reasoning effort payload keys before sending native
xAI requests. Grok 4.5 supports low, medium, and
high effort (default high). Grok 4.3 supports none, low, medium, and high
effort (default low). Other reasoning-capable xAI models do not expose a
configurable effort control, but still request
include: ["reasoning.encrypted_content"]so prior encrypted reasoning can be replayed on follow-up turns. web_search,x_search, andcode_executionare exposed as OpenClaw tools. OpenClaw attaches only the specific xAI built-in each tool needs to that tool’s request instead of attaching every native tool to every chat turn.- Grok
web_searchreadsplugins.entries.xai.config.webSearch.baseUrl.x_searchreadsplugins.entries.xai.config.xSearch.baseUrl, then falls back to the Grok web-search base URL. x_searchandcode_executionare owned by the bundled xAI plugin rather than hardcoded into the core model runtime.code_executionis remote xAI sandbox execution, not localexec.
Live testing
The xAI media paths are covered by unit tests and opt-in live suites. ExportXAI_API_KEY in the process environment before running live probes.
Related
Model selection
Choosing providers, model refs, and failover behavior.
Video generation
Shared video tool parameters and provider selection.
All providers
The broader provider overview.
Troubleshooting
Common issues and fixes.