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

Grok AI Provider connects Drupal’s
AI module with xAI, making
Grok chat and Imagine media-generation models available to Drupal AI and
compatible contributed modules.

The module provides a native Drupal AI provider integration for
conversational AI, multimodal prompts, structured output, function calling,
image generation, and text-to-video generation. Administrators can securely
select an xAI API key through Drupal’s Key module, discover the models
available to that key, and configure Grok as the default provider for
supported Drupal AI operations.


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

Features

  • Text generation and conversational chat
  • Streaming chat responses
  • Image input for supported multimodal Grok models
  • Drupal AI function and tool calling
  • JSON and structured responses on supported models
  • Text-to-image generation using Grok Imagine models
  • Best-effort transparent-background image prompting
  • Text-to-video generation using grok-imagine-video
  • Configurable video duration, aspect ratio, and resolution
  • AI Explorer integration for testing chat, image, and video generation
  • Model discovery using the configured xAI account
  • Token usage, reasoning usage, citations, and rate-limit metadata
  • Configurable API endpoint and request timeouts

The provider automatically uses xAI’s Chat Completions API for standard
Drupal AI requests and the Responses API when xAI-hosted tools are requested.

Optional xAI-hosted tools

Administrators can explicitly permit supported xAI-hosted tools:

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

Hosted tools are disabled by default. They must be permitted at the provider
level and then selected for the individual request or model configuration
that needs them. This helps prevent unexpected external access or additional
xAI charges.

Installation and configuration

Install the module and its dependencies using Composer:

composer require drupal/grok_ai_provider

Enable Grok AI Provider, then:

  1. Create a Key entity containing your xAI API key.
  2. Open the Grok provider settings under
    Configuration → AI → AI providers.
  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 the required operations.
  6. Configure individual AI integrations, including AI CKEditor, to use Grok
    or the appropriate site-wide default.

An optional Drupal recipe is included to install the provider and its
required AI and Key modules.

Supported Drupal AI operations

The current release supports:

  • Chat
  • Text to Image
  • Text to Video

Grok does not currently provide a generally documented public embeddings
service suitable for this integration. Features that require embeddings,
speech, or other unsupported operation types must use another Drupal AI
provider.

Security and privacy

API credentials are managed through Drupal’s Key module and are not stored
directly in the provider configuration.

xAI-hosted tools can send prompt content to external search, execution,
collection, or MCP services. Administrators should enable only the tools
they trust and review xAI’s current privacy, data-retention, and pricing
policies before using the provider on a production website.

Remote MCP servers must use HTTPS and require an explicit list of permitted
tools.

Important considerations

  • An xAI account and API key are required.
  • API requests may incur xAI usage charges.
  • Available models depend on the models accessible to the configured API key.
  • Generated video is downloaded promptly because xAI result URLs are
    temporary.
  • Image transparency is best-effort and depends on the selected model and
    generated output.
  • Streaming is supported for ordinary chat, but not currently for Responses
    API hosted-tool requests.
  • Embeddings, voice APIs, file management, and stateful response continuation
    are not currently included.

Translations

The module uses Drupal’s translation system for its administrative interface
and user-facing messages. Basic translation files are packaged with releases
as a fallback while community translations become available through Drupal
localization.

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, hosted tools, privacy, or API costs
are significant.

Project information

Releases