Skip to content

xAI

xAI is an OpenAI-compatible provider powering the Grok family of models. Use it through DeepIntShield with the standard OpenAI-compatible request format. Key features:

  • Full OpenAI compatibility - Chat, text completion, and responses
  • Vision support - Image URLs and base64 encoding for multimodal models
  • Streaming support - Server-Sent Events with delta-based updates
  • Reasoning support - Extended thinking for Grok reasoning models
  • Tool calling - Complete function definition and execution
  • Parameter filtering - Removes unsupported OpenAI-specific fields
OperationNon-StreamingStreamingEndpoint
Chat Completions✅✅/v1/chat/completions
Responses API✅✅/v1/responses
Text Completions✅✅/v1/completions
Image Generation✅-/v1/images/generations
List Models✅-/v1/models
Embeddings❌❌-
Speech (TTS)❌❌-
Transcriptions (STT)❌❌-
Files❌❌-
Batch❌❌-

xAI supports all standard OpenAI chat completion parameters. For full parameter reference and behavior, see OpenAI Chat Completions.

The following parameters are not supported by xAI and are ignored: prompt_cache_key, verbosity, store, service_tier.

grok-4.5 and grok-4.6 accept explicit reasoning effort; grok-4.6 also supports xhigh. Reasoning cannot be disabled on these models. See xAI’s reasoning guide.

{
"model": "xai/grok-4.6",
"messages": [{"role": "user", "content": "Explain the reasoning."}],
"reasoning_effort": "high"
}

DeepIntShield preserves effort for these models and legacy Grok 3 Mini. Older Grok 4 models retain their existing compatibility filtering.

xAI vision models support both image URLs and base64-encoded images:

{
"model": "xai/grok-2-vision-1212",
"messages": [{
"role": "user",
"content": [
{"type": "text", "text": "What is in this image?"},
{"type": "image_url", "image_url": {"url": "https://..."}}
]
}]
}

Supported Image Formats:

  • ✅ Image URLs
  • ✅ Base64-encoded images
  • ✅ Multiple images per message

xAI supports all standard OpenAI message types, tools, responses, and streaming formats. For details on message handling, tool conversion, responses, and streaming, refer to OpenAI Chat Completions.


xAI exposes a native Responses API at /v1/responses. It uses input, max_output_tokens, reasoning, and flat function-tool fields, with JSON and SSE output. Encrypted reasoning state is preserved for current Grok reasoning models, including tool continuations. Playground prefers Responses for bundled Grok 4.5, Grok 4.6, and Grok 4.20 multi-agent profiles and retains output items in saved sessions.


xAI supports legacy text completion format:

ParameterMapping
promptDirect pass-through
max_tokensmax_tokens
temperature, top_pDirect pass-through
stopStop sequences
frequency_penalty, presence_penaltyPenalty parameters

Streaming support available via stream: true.


xAI’s image generation uses the OpenAI-compatible format.

Request Behavior

xAI uses the same request format as OpenAI (see OpenAI Image Generation). Your model, prompt, and all other parameters are passed through in OpenAI format.

  • Endpoint: /v1/images/generations

Response Behavior

Responses are returned as-is in the DeepIntShield image-generation response format.

Streaming: Image generation streaming is not supported by xAI.


Lists available xAI models with their capabilities and context lengths.


FeatureReason
EmbeddingNot offered by xAI API
Speech/TTSNot offered by xAI API
Transcription/STTNot offered by xAI API
Batch OperationsNot offered by xAI API
File ManagementNot offered by xAI API