Overview
xAI is an OpenAI-compatible provider powering the Grok family of models. Bifrost delegates to the OpenAI implementation with standard parameter filtering. 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
Supported Operations
Unsupported Operations (❌): Embeddings, Speech, Transcriptions, Files, and Batch are not supported by the upstream xAI API. These return
UnsupportedOperationError.Setup & Configuration
Configure xAI as a provider.- Web UI
- config.json
- API
- Go SDK

- Navigate to Models > Model Providers. Look for xAI under Configured Providers. If it is missing, click on Add New Provider and select xAI.
- Click Add Key or edit an existing key.
- Set a name for your key.
- Paste your API key directly or use an environment variable (for example,
env.XAI_API_KEY). - Set Allowed Models to All Models (default) or the specific model allowlist you want this key to serve.
- Save the provider configuration.
1. Chat Completions
Request Parameters
xAI supports all standard OpenAI chat completion parameters. For full parameter reference and behavior, see OpenAI Chat Completions.Filtered Parameters
Removed for xAI compatibility:prompt_cache_key- Not supportedverbosity- Anthropic-specificstore- Not supportedservice_tier- Not supported
Reasoning Support
xAI’sgrok-3-mini model supports extended reasoning via the standard reasoning_effort field:
Reasoning structure to xAI’s reasoning_effort string format.
Vision Support
xAI vision models support both image URLs and base64-encoded images:- ✅ Image URLs
- ✅ Base64-encoded images
- ✅ Multiple images per message
2. Responses API
xAI’s Responses API is forwarded directly to/v1/responses:
3. Text Completions
xAI supports legacy text completion format:
Streaming support available via
stream: true.
4. Image Generation
xAI’s image generation uses the OpenAI-compatible format. Request Conversion xAI uses the same conversion as OpenAI (see OpenAI Image Generation):- Model & Prompt:
bifrostReq.Model→req.Model,bifrostReq.Prompt→req.Prompt - Parameters: All fields from
bifrostReq(ImageGenerationParameters) are embedded directly into the request struct via struct embedding - Endpoint:
/v1/images/generations
Note :
quality, size and style parameters are not supported by xAI’s API at the moment.BifrostImageGenerationResponse.
Streaming: Image generation streaming is not supported by xAI.
5. List Models
Lists available xAI models with their capabilities and context lengths.6. Context Compaction
xAI supports context compaction via its OpenAI-compatible/v1/responses/compact endpoint. Bifrost forwards the request to https://api.x.ai/v1/responses/compact.
Request and response format is identical to OpenAI Context Compaction. The response output contains the original user messages plus a final item with type: "response.compaction" and encrypted_content. Pass this output as input to future xAI Responses API calls.
Endpoint: POST /v1/responses/compact

