This project is not covered by Drupal’s security advisory policy.

Grok AI Provider connects Drupal’s AI module to xAI, making Grok chat, vision, Imagine media-generation, speech, classification, moderation, and hosted-tool capabilities available through Drupal AI and compatible contributed modules.

Administrators can securely select an xAI API key through Drupal’s Key module, discover the models available to that key, and configure Grok for supported Drupal AI operations.

This is an unofficial community integration and is not affiliated with or endorsed by xAI.

Supported Drupal AI operations

  • Chat, streaming responses, vision input, function calling, and structured output
  • Text to Image using Grok Imagine models
  • Image to Image prompt-based editing, with aspect-ratio and output-resolution controls
  • Text to Video with configurable duration, aspect ratio, and resolution
  • Image to Video from an uploaded source image, with output up to 1080p
  • Text to Speech with live xAI voice discovery, language and speed controls, and MP3 output
  • Speech to Text with formatting, speaker diarization, filler-word, and key-term options
  • Image Classification with optional candidate labels and confidence scores
  • Model-based Moderation with safety categories, explanations, and confidence scores

The provider automatically uses xAI’s Chat Completions API for ordinary requests and the Responses API when xAI-hosted tools are requested. Moderation is a probabilistic Grok assessment rather than a dedicated safety or compliance endpoint.

Drupal AI Explorer enhancements

When Grok is selected, compatible Drupal AI Explorers provide:

  • Operation-specific example prompts
  • Image generation, image editing, video generation, and audio testing
  • MP4 previews for text-to-video and image-to-video results
  • Optional saving of generated MP3 and MP4 files to compatible Drupal Media types
  • Input, output, cached, and reasoning token details when available
  • xAI-reported or best-effort estimated request costs

Cost estimation

The provider configuration includes editable model-pricing JSON. Exact request costs reported by xAI are preferred. When xAI omits a cost, the module can estimate token, image, video, text-to-speech character, and speech-to-text audio-duration charges. Estimates are informational and may differ from final billing.

Optional xAI-hosted tools

Administrators can explicitly permit:

  • Web Search
  • X Search
  • Code Interpreter
  • Collections Search
  • Allowlisted remote MCP servers

Hosted tools are disabled by default. They must be permitted at site level and then enabled for the individual request or model configuration. Remote MCP servers must use HTTPS and provide an explicit allowed-tools list.

Installation and configuration

Install the current alpha release with Composer:

composer require 'drupal/grok:^1.0@alpha'

Enable Grok AI Provider, then:

  1. Create a Key entity containing your xAI API key.
  2. Open Configuration → AI → AI providers → Grok.
  3. Select the key and use Test connection and load models.
  4. Save the provider configuration.
  5. Open Drupal AI’s default-model settings and select Grok (xAI) for each required operation.
  6. Configure individual integrations, including AI CKEditor, to use Grok or the appropriate site-wide default.

An optional Drupal recipe is included. Language and localization modules are not hard dependencies.

Requirements

  • Drupal 10.3 or Drupal 11
  • Drupal AI 1.4 or later
  • Drupal Key 1.22 or later
  • PHP 8.1 or later
  • An xAI API key

Security, privacy, and limitations

  • API credentials are managed through Drupal’s Key module and are not stored directly in provider configuration.
  • xAI-hosted tools may send prompt content to external search, execution, collection, or MCP services.
  • Available models depend on the configured xAI account, and API requests may incur charges.
  • Generated videos are downloaded promptly because xAI-hosted result URLs are temporary.
  • Image transparency is best effort and depends on the selected model and output.
  • Embeddings, realtime speech-to-speech, custom voice management, image masks, collection/file management, and stateful response continuation are not currently included.

Translations

The module uses Drupal’s translation system and packages basic translations for several languages as a fallback while community localization becomes available.

Project status

The 1.0.0-alpha series is intended for evaluation and early integration. Test carefully before using it for production workflows, particularly where generated content, moderation, hosted tools, privacy, or API costs are significant.

Project information

Releases